Browse Source

fixed the 80+ glitch when difficulity < 3

master
Liliana I. Tellio 4 years ago
committed by Brooke L. Rediker
parent
commit
48a16c51c3
  1. 11
      docs/pow.md
  2. 23
      templ/config.yml
  3. 15
      templ/genesis.yml
  4. BIN
      templ/keys.yml
  5. 16
      templ/nullblock.yml
  6. 11
      templ/txcoin.yml
  7. 15
      templ/txexemple.yml
  8. 11
      templ/txgen.yml

11
docs/pow.md

@ -10,11 +10,12 @@ where the difficulities is set to <span id=dif><i>:dif</i></span>.
hash algo: <input name="algo" value="SHA256" size="7">
<br>data: <input name="data" value="some data" size=24>
<!-- perl -Ilib -Mmisc -e 'print $misc::inonce'
5: 12131054599640746025
6: 12131054600136000000
8: 12131054604672000000
5: 12131054599640000000
6: 12131054600130000000
8: 12131054604670000000
9: 12131054702320000000
-->
<br>nonce: <input name="nonce" value="12131054604672000000" size=20>
<br>nonce: <input name="nonce" value="12131054702320000000" size=20>
<br>difficulty: <input name="dif" value="7" size="2">
<br>hashcash: <span name="hashcash"><i>?</i></span>
<br>proof: <span id="pow"><i>:pow</i></span>
@ -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;

23
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

15
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

BIN
templ/keys.yml

16
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: ~

11
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: ~

15
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'

11
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
Loading…
Cancel
Save