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.

51 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 $null);
  15. use toychain;
  16. use encode qw(mbase58);
  17. #printf "encode::EXPORT_OK: %s\n",join',',@encode::EXPORT_OK;
  18. printf "ZNull: %s\n",&mbase58($null);
  19. use YAML::Syck qw(Dump);
  20. my $seed = &seed::setseed('Intentionally good!');
  21. my $salt = rand64();
  22. printf "salt: %s\n",$salt;
  23. my $headhash = $toychain::HEADs[0]->{bkaddr};
  24. printf "genesis: %s\n",$headhash;
  25. print "// testing getTxMeta\n";
  26. my $txblock = getTxMeta();
  27. print "// testing blockCreation\n";
  28. # createBlock(seed,payload,txblock,comment)
  29. my $block = &createBlock($seed,"This is the 2nd block payload",$txblock,'1st comment for new block');
  30. displayBlock($block);
  31. print "// testing insertBlock:\n";
  32. my $chain = &insertBlock($toychain::HEADs[0],$block);
  33. #displayChain($toychain::chain);
  34. #$head = newBlock(1,'this is a playload',$ZNull,$head,$salt);
  35. #printf "head: %s\n",mbase58($head);
  36. exit $?;
  37. 1;