From 48a16c51c3899541cb0f4c086148a5f873075915 Mon Sep 17 00:00:00 2001 From: "Liliana I. Tellio" Date: Tue, 13 Jul 2021 20:21:17 +0200 Subject: [PATCH] fixed the 80+ glitch when difficulity < 3 --- docs/pow.md | 11 ++++++----- templ/config.yml | 23 +++++++++++++++++++++++ templ/genesis.yml | 15 +++++++++++++++ templ/keys.yml | Bin 0 -> 645 bytes templ/nullblock.yml | 16 ++++++++++++++++ templ/txcoin.yml | 11 +++++++++++ templ/txexemple.yml | 15 +++++++++++++++ templ/txgen.yml | 11 +++++++++++ 8 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 templ/config.yml create mode 100644 templ/genesis.yml create mode 100644 templ/keys.yml create mode 100644 templ/nullblock.yml create mode 100644 templ/txcoin.yml create mode 100644 templ/txexemple.yml create mode 100644 templ/txgen.yml diff --git a/docs/pow.md b/docs/pow.md index 7647817..f742f2b 100644 --- a/docs/pow.md +++ b/docs/pow.md @@ -10,11 +10,12 @@ where the difficulities is set to :dif. hash algo:
data: -
nonce: +
nonce:
difficulty:
hashcash: ?
proof: :pow @@ -57,7 +58,7 @@ sub hashcash { # ex: hashcash('SHA256',$data,$nonce,7); my $rate = ($n - $nonce) / $elapse / 1000; #printf "%d: %s %s %s %.0fkH/s %.1fmin\n",$l, $n,unpack('H*',$pn),$h16,$rate,$elapse/60; # count any zeros : ($h16 =~ m/0/g) ! - my $zc = ($h16 =~ /80+/) ? length($&) : 0; + my $zc = ($h16 =~ /80*/) ? length($&) : 0; #print "zc: $zc\n"; $l = $zc; last if $zc >= $difficulty; diff --git a/templ/config.yml b/templ/config.yml new file mode 100644 index 0000000..b4be93b --- /dev/null +++ b/templ/config.yml @@ -0,0 +1,23 @@ +--- # toychain's config +version: 1.06 +chain: toychain +apiver: '0.0' +ipfsgw: 8390 +port: 8089 + +# 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 + +# block parameters : +bkver: 0 +bkreward: 100 +# Proof of Work option +difficulty: 5 +maxdiff: 7 +# CAstore options +trackmode: 1 diff --git a/templ/genesis.yml b/templ/genesis.yml new file mode 100644 index 0000000..781ba46 --- /dev/null +++ b/templ/genesis.yml @@ -0,0 +1,15 @@ +--- # genesis block +ver: 0 +data: + seq: 0 + payload: /ipfs/QmWM48KvyK9YyPjJt69erxVPN3nbXVMgZWrncRJhAVkGAv + comment: "This is the genesis block" +meta: + seed: 0xb3560762 + salt: ~ # used in address computation + txroot: ~ +audit: + peerid: Z21GdiEggiGa7TPNaqGY8coBy97LoRNpPVu9fxig75nstq + tics: 1623830817245864895 + ip: 83.78.4.228 +prev: ZdtrjkYsAYUeBCs4DRjtVYwPevpxvHjGT2PRauANr3Vao diff --git a/templ/keys.yml b/templ/keys.yml new file mode 100644 index 0000000000000000000000000000000000000000..93ab0347097d8c65627f33d6567b3e021e5a1a5c GIT binary patch literal 645 zcmV;00($)bM@dveQdv+`0Na8jfcMyBj3&7N#L#5;%Ju;|gIxmUB|LHEDiwqW>4D6J zpsBX>j&-qoXVZJ=K+oMh8&UYO$@;MR8T;c}Lvk@5MaHnF>&atkyXBIcdb!4VS4UNi z=ERUN#tRo3KbMsxJ}NN-Th66JO!AZly)fn)GaCWY94}r;O;6n2XGIEp0#pl*2WaB& zGkY{%$%abPZ^iA%P=PvjDy;dgG92gdD#pea{f)G`$wXSPU;hI5cgka z--9s5>qSZOk1lNxk2%yW_$D?>&x%7tVcd(Z5@b?7`Rbq%x&M(Lkf&=kDQgC&Ynl+= zWr56O1$`77l2bXZuy_Ji`hn6L#V!)Q~6S|5F}14>FowT^vAe8)I> fwGDfDa;Ra0ZMK4y?hTu`HWxKLMCzzsb#6OlMV~l# literal 0 HcmV?d00001 diff --git a/templ/nullblock.yml b/templ/nullblock.yml new file mode 100644 index 0000000..c854162 --- /dev/null +++ b/templ/nullblock.yml @@ -0,0 +1,16 @@ +--- # null block +ver: 0 +data: + seq: -1 + payload: ~ + comment: "This is not a block (null block)" +meta: + seed: 0xb3560762 + salt: 12131054599640746025 # used in address computation + salt: ~ # used in address computation + txroot: ~ +audit: + peerid: Anonymous + tics: 0 + ip: 0.0.0.0 +prev: ~ diff --git a/templ/txcoin.yml b/templ/txcoin.yml new file mode 100644 index 0000000..abebb11 --- /dev/null +++ b/templ/txcoin.yml @@ -0,0 +1,11 @@ +--- +message: This is a coinbase transaction of 100 coins to be distributed to Z21GdiEggiGa7TPNaqGY8coBy97LoRNpPVu9fxig75nstq +inputs: + - coinbase: 100 +outputs: + - Z21GdiEggiGa7TPNaqGY8coBy97LoRNpPVu9fxig75nstq: 100 +timestamp: '1625385951347499858' +nonce: '3976914969180171529' +pow: '3976914969180292365' +signatures: + - coinbase: ~ diff --git a/templ/txexemple.yml b/templ/txexemple.yml new file mode 100644 index 0000000..6f222b8 --- /dev/null +++ b/templ/txexemple.yml @@ -0,0 +1,15 @@ +--- +message: This is an exemple of transaction with 3 coins going to Trina M. and 2 coins to Michel C. +timestamp: '1623693268225555737' +nonce: '3976914969180171529' +inputs: + - ZX3hz85Vayc3Nhfs43ADhTeJXkDJ3fnXtfRiDW4pQzYRQ: 3 +outputs: + - Z24zaLMH6SCfAoC8ndS9XunjrkVpZW5tprhrZdSq3CcXWQ: 3 + - Z21GdiEggiGa7TPNaqGY8coBy97LoRNpPVu9fxig75nstq: 2 +signatures: + - Z21GdiEggiGa7TPNaqGY8coBy97LoRNpPVu9fxig75nstq: + - ZHjX1cinn46FbTioY43qo2ZmfgnjZzXKRMiVN3tZRbxkzg61hNdKRoGptqeFa2tT5kzHqrSUTNcHFTfsLYSz5eDRGXmL3wzc1Gt + - anonymous: + - ZHjX1cin92axvE1YtoPZyakN1HSFZmXpFxqSVqaWz1S3eyVA5rxTohXUcjcR5sPG9apfTEy34dSUyMPPuN2ngQNDMEFrEgZqbMN +pow: '3976914969180292365' diff --git a/templ/txgen.yml b/templ/txgen.yml new file mode 100644 index 0000000..ac61f35 --- /dev/null +++ b/templ/txgen.yml @@ -0,0 +1,11 @@ +--- +timestamp: '1623683269225552702' +inputs: + - coinbase: 50 +nonce: '3976914969180171529' +outputs: + - Z21GdiEggiGa7TPNaqGY8coBy97LoRNpPVu9fxig75nstq: 50 +message: This is a coinbase transaction of 50 coins for the genesis block +pow: '3976914969180292365' +signatures: + - coinbase: Zan1RjVTw7GPVyd7aygjWSrGCtX3M8CVRu3NAyqLC8MToNPE93ju4RrFFjunnbeTYnudR2gSKCamK82xjEfWEtGzGvTRDw25MG