You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.1 KiB

  1. #!/usr/bin/perl -w
  2. #
  3. # Intent:
  4. # testing it !
  5. #
  6. # Note:
  7. # This work has been done during my time at Doctor I·T
  8. #
  9. # -- Copyright drit, 2021 --
  10. #
  11. BEGIN { print "// ToyChain !\n"; }
  12. use lib 'lib';
  13. use seed qw(rand64);
  14. use misc qw(khash $Zempty);
  15. use toychain;
  16. use encode qw(mbase58);
  17. #printf "encode::EXPORT_OK: %s\n",join',',@encode::EXPORT_OK;
  18. use YAML::Syck qw(Dump);
  19. my $seed = &seed::setseed('Intentionally good!');
  20. my $salt = rand64();
  21. printf "salt: %s\n",$salt;
  22. my $headhash = $toychain::HEADs[0]->{bkaddr};
  23. printf "genesis: %s\n",$headhash;
  24. print "// testing getTxMeta\n";
  25. my $txblock = getTxMeta();
  26. print "// testing blockCreation\n";
  27. # createBlock(seed,payload,txblock,comment)
  28. my $block = &createBlock($seed,"This is the 2nd block payload",$txblock,'1st comment for new block');
  29. displayBlock($block);
  30. print "// testing insertBlock:\n";
  31. my $chain = &insertBlock($toychain::HEADs[0],$block);
  32. createDot($toychain::chain);
  33. displayChain($toychain::chain);
  34. #$head = newBlock(1,'this is a playload',$Zempty,$head,$salt);
  35. #printf "head: %s\n",mbase58($head);
  36. exit $?;
  37. 1;