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 0000000..93ab034 Binary files /dev/null and b/templ/keys.yml differ 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