From de39a7a3cb7d02919a44824801b2eaa6f45d76bc Mon Sep 17 00:00:00 2001 From: "Bridget R. Perrington" Date: Mon, 21 Jun 2021 16:32:08 +0200 Subject: [PATCH] libraries update --- _data/timelog.yml | 1 + lib | 2 +- notes.md | 16 +++++++++++++++ t/encode.t | 24 +++++++++++++++++++++++ testing.pl | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 t/encode.t create mode 100644 testing.pl diff --git a/_data/timelog.yml b/_data/timelog.yml index 8c8fed9..de5174b 100644 --- a/_data/timelog.yml +++ b/_data/timelog.yml @@ -10,3 +10,4 @@ 1624075325993120885: start toptal chaining -- /drg/toychain 1624117500619195903: stop toptal -- /drg/toychain 1624171149798092491: start toptal -- /drg/toychain +1624219990488746675: stop toptal -- /drg/toychain diff --git a/lib b/lib index c73ee3d..eaa1d82 160000 --- a/lib +++ b/lib @@ -1 +1 @@ -Subproject commit c73ee3d50c2842d0beb4d7e8ae20554da32660d4 +Subproject commit eaa1d8258b1c171c4e90fc62f4019301e6b2f4f5 diff --git a/notes.md b/notes.md index 2387c79..2e81f48 100644 --- a/notes.md +++ b/notes.md @@ -16,3 +16,19 @@ minimally sized blocks : - segreated signature, timestamp, audit etc. - block: {address, previous, pow} + + +## observation ... + + +- revokable block if sign w/ a DH on txo and ECDSA on txi + +- txroot (merkle root can be global) + +- PoW is to slow down chainupdate to avois spam +- consensus is on the longest length +- /!\ maximal work is hackable + +- sort of tx sequence can be done on node side +- block chain can store tx out of order (FIFO style) + diff --git a/t/encode.t b/t/encode.t new file mode 100644 index 0000000..fd989ce --- /dev/null +++ b/t/encode.t @@ -0,0 +1,24 @@ +BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } } + +use encode qw(encode_basen decode_basen); + +my $msg = 'no work yet !'; +my $nonce = unpack 'Q',&decode_basen($msg,29); +printf "nonce: %s\n",$nonce; +printf "monce29: %s\n",&encode_basen(pack('Q',$nonce),29); + +my $nonce = unpack 'Q',&decode_basen('initial nonce',29); +printf "nonce: %s\n",$nonce; +printf "nonce16: 0x%x\n",$nonce; +printf "monce29: %s\n",&encode_basen(pack('Q',$nonce),29); + +$msg = &encode_basen("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",29); +printf "msg: %s\n",$msg; + +my $m29 = &decode_basen($msg.$msg,29); +printf "m29: %s (%dc)\n",join('_',unpack('Q*',$m29)),length($m29); +printf "m16: %s\n",unpack('H*',$m29); +exit $?; + +1; + diff --git a/testing.pl b/testing.pl new file mode 100644 index 0000000..adc37e1 --- /dev/null +++ b/testing.pl @@ -0,0 +1,50 @@ +#!/usr/bin/perl + +# +# Intent: +# testing it ! +# +# Note: +# This work has been done during my time at Doctor I·T +# +# -- Copyright drit, 2021 -- +# +BEGIN { print "// ToyChain !\n"; } + +use lib 'lib'; +use seed qw(rand64); +use misc qw(khash $null); +use toychain; +use encode qw(mbase58); + +#printf "encode::EXPORT_OK: %s\n",join',',@encode::EXPORT_OK; + +printf "ZNull: %s\n",&mbase58($null); +use YAML::Syck qw(Dump); + +my $seed = &seed::setseed('Intentionally good!'); +my $salt = rand64(); +printf "salt: %s\n",$salt; + +my $headhash = $toychain::HEAD->{bkaddr}; +printf "genesis: %s\n",$headhash; +print "// testing getTxMeta\n"; +my $txblock = getTxMeta(); + +print "// testing blockCreation\n"; +my $block = &createBlock($seed,"This is the block payload",$txblock,'comment here!'); +displayBlock($block); +print "// testing insertBlock:\n"; +my $chain = &insertBlock($toychain::HEAD,$block); + +displayChain($toychain::chain); + + + +#$head = newBlock(1,'this is a playload',$ZNull,$head,$salt); +#printf "head: %s\n",mbase58($head); + +exit $?; + + +1;