Browse Source

library update (9d739e5) on Mon Jun 21 08:49:17 PM CEST 2021

master
Peter C. Levecke 3 years ago
committed by Brooke L. Rediker
parent
commit
124cdf2f17
  1. 7
      block0.yml
  2. 15
      genesis.yml
  3. 2
      lib
  4. 20
      t/encode.t
  5. 5
      testing.pl

7
block0.yml

@ -1,7 +0,0 @@
--- # block genesis
ver: 0x00
seq: 0 # blocknumber (on 32bit max block-number : 4294967296)
# ipfs object new unixfs-dir
data: QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
# echo -n '' | ipfs add
bkprev: QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH

15
genesis.yml

@ -0,0 +1,15 @@
--- # genesis block
ver: 0
data:
seq: 0
payload: QmWM48KvyK9YyPjJt69erxVPN3nbXVMgZWrncRJhAVkGAv
comment: "This is the genesis block"
meta:
seed: 0xb3560762
salt: 442360558803467359 # used in address computation
txroot: ~
audit:
peerid: QmcfHufAK9ErQ9ZKJF7YX68KntYYBJngkGDoVKcZEJyRve
tics: 1623830817245864895
ip: 83.78.4.228
prev: ZgjNT5GbSC81KmUPncwhzQAGV3GUeAXafmkMPBw2GMHWM

2
lib

@ -1 +1 @@
Subproject commit d0e0fdddfdffff4d23405b029266ab02498a009e
Subproject commit 9d739e5c4bb0b27babea7bdc441cfed6a85bb694

20
t/encode.t

@ -2,21 +2,21 @@ BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use encode qw(encode_basen decode_basen); use encode qw(encode_basen decode_basen);
my $msg = 'no work yet !';
my @msg = (
'no work yet !',
'genesis nonce',
'default nonce for block address',
'initial nonce'
);
for my $msg (@msg) {
print "msg: $msg\n";
my $nonce = unpack 'Q',&decode_basen($msg,29); my $nonce = unpack 'Q',&decode_basen($msg,29);
printf "nonce: %s\n",$nonce; printf "nonce: %s\n",$nonce;
printf "nonce16: %s\n",unpack'H*',pack('Q',$nonce); printf "nonce16: %s\n",unpack'H*',pack('Q',$nonce);
printf "monce29: %s\n",&encode_basen(pack('Q',$nonce),29); printf "monce29: %s\n",&encode_basen(pack('Q',$nonce),29);
print ".\n";
}
my $nonce = unpack 'Q',&decode_basen('genesis nonce',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);
my $nonce = unpack 'Q',&decode_basen('initial nonce',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);
$msg = &encode_basen("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",29); $msg = &encode_basen("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",29);
printf "msg: %s\n",$msg; printf "msg: %s\n",$msg;

5
testing.pl

@ -13,13 +13,12 @@ BEGIN { print "// ToyChain !\n"; }
use lib 'lib'; use lib 'lib';
use seed qw(rand64); use seed qw(rand64);
use misc qw(khash $null);
use misc qw(khash $ZNull);
use toychain; use toychain;
use encode qw(mbase58); use encode qw(mbase58);
#printf "encode::EXPORT_OK: %s\n",join',',@encode::EXPORT_OK; #printf "encode::EXPORT_OK: %s\n",join',',@encode::EXPORT_OK;
printf "ZNull: %s\n",&mbase58($null);
use YAML::Syck qw(Dump); use YAML::Syck qw(Dump);
my $seed = &seed::setseed('Intentionally good!'); my $seed = &seed::setseed('Intentionally good!');
@ -38,7 +37,7 @@ displayBlock($block);
print "// testing insertBlock:\n"; print "// testing insertBlock:\n";
my $chain = &insertBlock($toychain::HEADs[0],$block); my $chain = &insertBlock($toychain::HEADs[0],$block);
#displayChain($toychain::chain);
displayChain($toychain::chain);

Loading…
Cancel
Save