diff --git a/.gitattributes b/.gitattributes index 5d7abd8..e4062a2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,7 @@ *.mbox filter=git-crypt diff=git-crypt *.sec* filter=git-crypt diff=git-crypt *.key* filter=git-crypt diff=git-crypt +#config.yml filter=git-crypt diff=git-crypt secrets/** filter=git-crypt diff=git-crypt *.asc !filter !diff .gitattributes !filter !diff diff --git a/_data/timelog.yml b/_data/timelog.yml index de5174b..d6025fc 100644 --- a/_data/timelog.yml +++ b/_data/timelog.yml @@ -11,3 +11,5 @@ 1624117500619195903: stop toptal -- /drg/toychain 1624171149798092491: start toptal -- /drg/toychain 1624219990488746675: stop toptal -- /drg/toychain +1624361700774728980: start toptal pow -- /drg/toychain +1624395286300684038: stop toptal -- /drg/toychain diff --git a/config.yml b/config.yml index 22ea0bd..5842fe5 100644 --- a/config.yml +++ b/config.yml @@ -1,10 +1,15 @@ --- # toychain's config +version: 1.01 +chain: toychain +# p2p network = api+1 apis: - 127.0.0.1:8091 - 127.0.0.2:8093 - 127.0.0.3:8095 - 127.0.0.4:8097 - 127.0.0.5:8099 -# network = api+1 -difficulty: 2 -reward: 100 + +# block parameters : +bkver: 0 +difficulty: 5 +bkreward: 100 diff --git a/genesis.yml b/genesis.yml index 24d41ca..62f4751 100644 --- a/genesis.yml +++ b/genesis.yml @@ -2,14 +2,14 @@ ver: 0 data: seq: 0 - payload: QmWM48KvyK9YyPjJt69erxVPN3nbXVMgZWrncRJhAVkGAv + payload: /ipfs/QmWM48KvyK9YyPjJt69erxVPN3nbXVMgZWrncRJhAVkGAv comment: "This is the genesis block" meta: seed: 0xb3560762 - salt: 442360558803467359 # used in address computation + salt: 442360558864191384 # used in address computation txroot: ~ audit: peerid: QmcfHufAK9ErQ9ZKJF7YX68KntYYBJngkGDoVKcZEJyRve tics: 1623830817245864895 ip: 83.78.4.228 -prev: ZgjNT5GbSC81KmUPncwhzQAGV3GUeAXafmkMPBw2GMHWM +prev: ZdtrjkYsAYUeBCs4DRjtVYwPevpxvHjGT2PRauANr3Vao diff --git a/lib b/lib index 9d739e5..0d8920d 160000 --- a/lib +++ b/lib @@ -1 +1 @@ -Subproject commit 9d739e5c4bb0b27babea7bdc441cfed6a85bb694 +Subproject commit 0d8920d1f5b431c583a1a23d230b8ad0b0675c5d diff --git a/notes.md b/notes.md index 2e81f48..ad0b987 100644 --- a/notes.md +++ b/notes.md @@ -27,8 +27,23 @@ - PoW is to slow down chainupdate to avois spam - consensus is on the longest length -- /!\ maximal work is hackable +- /!\ maximal work is hackable (as pow is exponential to difficulties) - sort of tx sequence can be done on node side - block chain can store tx out of order (FIFO style) +- does mining really need to be conpetitive ? +- if mining is done by all node the recipient of txo will be willing to mine! +- if a .2% tax on transaction can replace/solve all VAT taxes + then mining rewards is "artificially" inflated to compensate for a wasteful + technology + +- nano-trading is stealing (i.e. taking advantage of who has the power to be informed fast) + on need to put a "lowpass" filter on trading : + speculation is necessary for long term protection against future uncertainty... + short term predicition make no sense ! + + long unpredictable queue time (mempools) can deter speculator as it would be like "lotery" + lotery is a "gamified" tax extractor. + + diff --git a/secrets/keys.yml b/secrets/keys.yml new file mode 100644 index 0000000..45c5918 Binary files /dev/null and b/secrets/keys.yml differ diff --git a/t/cashash.t b/t/cashash.t new file mode 100644 index 0000000..072416d --- /dev/null +++ b/t/cashash.t @@ -0,0 +1,31 @@ + +BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } } + +use seed qw(getsalt); + +seed::setseed(0x1245356); + +use encode qw(decode_base58f encode_base58f); +use CAStore qw(cashash CASWrite); +printf "v16: %s\n",unpack'H*',decode_base58f('TxG4cMYVXUM4T8GdwCyauYe4UkKYWnrkFsZVxe3KRfg'); +printf "v58: %s\n",encode_base58f(pack'H*','0d347435dc89c141487f8ec816d71bdc05341b52f40b53fb6bd8469885bcee57'); +printf "v58: %s\n",encode_base58f(pack'H*','0d34000000000000000000000000000000000000000000000000000000000000'); +printf "len: %d\n",length('TxG4cMYVXUM4T8GdwCyauYe4UkKYWnrkFsZVxe3KRfg'); +my $type = 'Txi'; +my $salt = &getsalt(); +printf "type: %s\n",$type; +my ($addr,$pow) = cashash('SHA256','~',$salt,$type,5); +printf "addr16: f%s\n",unpack'H*',$addr; +printf "addr58: %s\n",encode_base58f($addr); + + $addr = CASWrite(undef,$salt,$type,5); +printf "addr: %s\n",$addr; + + + + + +exit $?; + +1; + diff --git a/t/encode.t b/t/encode.t index 7b105c3..cc1eb76 100644 --- a/t/encode.t +++ b/t/encode.t @@ -6,11 +6,12 @@ my @msg = ( 'no work yet !', 'genesis nonce', 'default nonce for block address', + 'CAStore nonce', 'initial nonce' ); for my $msg (@msg) { print "msg: $msg\n"; -my $nonce = unpack 'Q',&decode_basen($msg,29); +my $nonce = unpack 'Q',&decode_basen(lc($msg),29); printf "nonce: %s\n",$nonce; printf "nonce16: %s\n",unpack'H*',pack('Q',$nonce); printf "monce29: %s\n",&encode_basen(pack('Q',$nonce),29); diff --git a/testing.pl b/testing.pl index 8ab351c..376bd55 100644 --- a/testing.pl +++ b/testing.pl @@ -13,7 +13,7 @@ BEGIN { print "// ToyChain !\n"; } use lib 'lib'; use seed qw(rand64); -use misc qw(khash $ZNull); +use misc qw(khash $Zempty); use toychain; use encode qw(mbase58); @@ -30,6 +30,7 @@ printf "genesis: %s\n",$headhash; print "// testing getTxMeta\n"; my $txblock = getTxMeta(); + print "// testing blockCreation\n"; # createBlock(seed,payload,txblock,comment) my $block = &createBlock($seed,"This is the 2nd block payload",$txblock,'1st comment for new block'); @@ -37,11 +38,13 @@ displayBlock($block); print "// testing insertBlock:\n"; my $chain = &insertBlock($toychain::HEADs[0],$block); +createDot($toychain::chain); + displayChain($toychain::chain); -#$head = newBlock(1,'this is a playload',$ZNull,$head,$salt); +#$head = newBlock(1,'this is a playload',$Zempty,$head,$salt); #printf "head: %s\n",mbase58($head); exit $?;