|
|
@ -0,0 +1,50 @@ |
|
|
|
#!/usr/bin/perl |
|
|
|
|
|
|
|
# |
|
|
|
# Intent: |
|
|
|
# testing it ! |
|
|
|
# |
|
|
|
# Note: |
|
|
|
# This work has been done during my time at Doctor I·T |
|
|
|
# |
|
|
|
# -- Copyright drit, 2021 -- |
|
|
|
# |
|
|
|
BEGIN { print "// ToyChain !\n"; } |
|
|
|
|
|
|
|
use lib 'lib'; |
|
|
|
use seed qw(rand64); |
|
|
|
use misc qw(khash $null); |
|
|
|
use toychain; |
|
|
|
use encode qw(mbase58); |
|
|
|
|
|
|
|
#printf "encode::EXPORT_OK: %s\n",join',',@encode::EXPORT_OK; |
|
|
|
|
|
|
|
printf "ZNull: %s\n",&mbase58($null); |
|
|
|
use YAML::Syck qw(Dump); |
|
|
|
|
|
|
|
my $seed = &seed::setseed('Intentionally good!'); |
|
|
|
my $salt = rand64(); |
|
|
|
printf "salt: %s\n",$salt; |
|
|
|
|
|
|
|
my $headhash = $toychain::HEAD->{bkaddr}; |
|
|
|
printf "genesis: %s\n",$headhash; |
|
|
|
print "// testing getTxMeta\n"; |
|
|
|
my $txblock = getTxMeta(); |
|
|
|
|
|
|
|
print "// testing blockCreation\n"; |
|
|
|
my $block = &createBlock($seed,"This is the block payload",$txblock,'comment here!'); |
|
|
|
displayBlock($block); |
|
|
|
print "// testing insertBlock:\n"; |
|
|
|
my $chain = &insertBlock($toychain::HEAD,$block); |
|
|
|
|
|
|
|
displayChain($toychain::chain); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#$head = newBlock(1,'this is a playload',$ZNull,$head,$salt); |
|
|
|
#printf "head: %s\n",mbase58($head); |
|
|
|
|
|
|
|
exit $?; |
|
|
|
|
|
|
|
|
|
|
|
1; |