Browse Source

re-release before system upgrade !

master
Logan M. Renigar 4 years ago
committed by Brooke L. Rediker
parent
commit
685a048b2e
  1. 4
      build.sh
  2. 5494
      qmDict/fnames.txt
  3. BIN
      secrets/keys.yml
  4. 19
      style.css
  5. 29
      t/botname.t
  6. 57
      t/coinbase.t
  7. 15
      t/dagread.t
  8. 14
      t/eckey0.t
  9. 16
      t/getChainHeight.t
  10. 12
      t/getTxMeta.t
  11. 24
      t/getnip.t
  12. 22
      t/gettics.t
  13. 23
      t/head.t
  14. 25
      t/isvalid.t
  15. 28
      t/minepool.t
  16. 22
      t/mkdir.t
  17. 14
      t/sdate.t
  18. 15
      t/seed.t
  19. 1
      t/sendhead.t
  20. 37
      t/signtx.t
  21. 15
      t/test.t
  22. 17
      t/txmeta.t
  23. 28
      t/txtime.t
  24. 19
      t/unlinked.t

4
build.sh

@ -0,0 +1,4 @@
#
find . -name '*~1' -delete
jekyll build

5494
qmDict/fnames.txt
File diff suppressed because it is too large
View File

BIN
secrets/keys.yml

19
style.css

@ -0,0 +1,19 @@
body {
background-color: #400244;
}
body > div:first-child {
background-color: #fdfcff;
max-width: 720px;
margin: auto;
padding: 0.7rem;
opacity: 0.99;
}
div#nav {
position: fixed;
top: 0;
right: 0;
}
textarea {
width: calc(100% - 1rem);
}

29
t/botname.t

@ -0,0 +1,29 @@
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use seed;
use botname qw(botname fullname);
my $seed = &seed::setseed(5451361247321);
printf "seed: %s\n",$seed;
my $n0 = seed::rand64(); # n < 18446744073709551616
my $n1 = seed::rand64();
printf "n0:%s\n",$n0;
printf "n1:%s\n",$n1;
my $q2 = pack'Q2',$n0,$n1;
my @fullnames = &fullname($q2);
printf "fullname: %s\n",join', ',@fullnames;
my $data58 = "ZHjX1cimgEBVjmyxXsGyPU7YLXDG5SM5oDaaYwuKivtuuJtfBmyPDt5cMyN7nidCDQuKtMowxThXS58AKFz97yFqaYh6L9adQhY";
my $databin = &botname::decode_base58f($data58);
printf "fullname: %s\n",join', ',fullname($databin);
printf "botname: %s\n",botname($data58);
printf "uname: %s\n",lc(substr((&fullname($databin))[0],0,1)) . lc((&fullname($databin))[-2]);
exit $?;
1;

57
t/coinbase.t

@ -0,0 +1,57 @@
#
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
our $dbug=1;
print "--- $0\n";
use YAML::Syck qw(Dump);
use seed qw(readsalt);
use encode qw(mbase58);
use CAStore qw(CASRead);
use botname qw(botname);
use ECKeys qw($keys ecsign ecverif loadKeys eckeygen saveKeys);
printf "--- keys %s...\n",Dump($keys);
use Genesis qw(createCoinBaseTx);
my $nonce = &readsalt($ENV{SITE}.'/salts/CBtxi.yml');
printf "=== createCoinBaseTx w/ default message ===\n";
# &createCoinBaseTx($tic,$msg,$nonce,$type,$dif);
# using default message ...
my ($txaddr,$txcoin) = &createCoinBaseTx(1625714463012468224,undef,$nonce,'CBtxi',($dbug?4:7));
printf "txaddr: %s\n",$txaddr;
printf "=== get it from the pool (for verification) ===\n";
my $tx = &CASRead($ENV{SITE}.'/txpool',$txaddr);
printf "--- tx %s...\n",Dump($tx);
use TXPOOL qw(isTxValid);
$TXPOOL::UTXO->{coinbase} = 100;
my $valid = isTxValid($tx);
printf "tx: %s is %s\n",$txaddr,($valid?'valid':'rejected');
if (0) {
my $msg= qq'["coinbase","100","default coinbase"]';
my $sig = &ecsign('coinbase',$msg);
printf "- default coinbase: %s\n",$sig;
my $key58 = $keys->{coinbase}{public};
print "verification ...";
my $sigok = &ecverif($key58,$sig,$msg);
print ($sigok?'ok':'failed'),"\n";
}
printf "DBUG %s @%s\n",$::db++,__LINE__; # <------------------------------------- /!\ ---
exit $?;
1;

15
t/dagread.t

@ -0,0 +1,15 @@
#!/usr/bin/perl
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use YAML::Syck qw(Dump);
use DAG qw(DAGRead);
my $blk = &DAGRead('blocks','123');
printf "--- # blk %s...\n",Dump($blk);
exit $?;
1;

14
t/eckey0.t

@ -0,0 +1,14 @@
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use ECKeys qw(eckeygen);
use YAML::Syck qw(Dump);
my $id = eckeygen('tb','Test Bot');
printf "keys: %s\n",Dump($ECKeys::keys);
exit $?;
1;

16
t/getChainHeight.t

@ -0,0 +1,16 @@
#!/usr/bin/perl
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use toychain;
use YAML::Syck qw(Dump);
print "// testing $0\n";
my $height = getChainHeight();
printf "height: %s\n",$height;
exit $?;
1;#

12
t/getTxMeta.t

@ -0,0 +1,12 @@
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use TXPOOL qw(getTxMeta);
my $txmeta = &getTxMeta();
exit $?;
1;

24
t/getnip.t

@ -0,0 +1,24 @@
#!/usr/bin/perl
#
# Intent:
# testing getnip !
#
# Note:
# This work has been done during my time at Doctor I·T
#
# -- Copyright drit, 2021 --
#
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use essential qw(getnip);
my $nip = &getnip();
printf "nip: 0x%08x\n",$nip;
exit $?;
1;

22
t/gettics.t

@ -0,0 +1,22 @@
#!/usr/bin/perl
#
# Intent:
# getting time w/ nanosecond accuracy ...
#
# Note:
# This work has been done during my time at Doctor I·T
#
# -- Copyright drit, 2021 --
#
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use essential qw(gettics);
my $tics = &gettics();
printf "tics: %u, 0x%08x\n",$tics,$tics;
exit $?;
1;

23
t/head.t

@ -0,0 +1,23 @@
#
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use toychain;
use DAG qw(DAGRead);
my $headblock = $toychain::HEADs[0];
my $headhash = $headblock->{bkhash};
my $headaddr = $headblock->{bkaddr};
printf "headhash: %s\n",$headhash;
printf "headaddr: %s\n",$headaddr;
my $blk = &DAGRead('blocks',$headhash);
#printf "--- blk %s...\n",Dump($blk);
&displayBlock($blk);
exit $?;
1;

25
t/isvalid.t

@ -0,0 +1,25 @@
#
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use TXPOOL qw(isTxValid);
use misc qw(kwdigest);
use YAML::Syck qw(LoadFile Dump);
#printf "--- keys %s...\n",Dump($ECKeys::keys);
printf "--- nicknames %s...\n",Dump($ECKeys::nicknames);
$UTXO->{$ECKeys::keys->{verification}{public}} = $config->{coinbase}{reward};
printf "--- UTXO %s...\n",Dump($UTXO);
my $tx = LoadFile($ENV{SITE}.'/templ/txcb01.yml');
my $txkw = &kwdigest($tx);
printf "--- tx (%s) %s...\n",$txkw,Dump($tx);
my $txok = &isTxValid($tx);
printf "is %s valid: ? %s\n",$txkw,$txok;
exit $?;
1;

28
t/minepool.t

@ -0,0 +1,28 @@
#!/usr/bin/perl
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use seed;
use toychain;
use TXPOOL qw(getTxMeta);
use YAML::Syck qw(Dump);
my $seed = &seed::setseed('beautiful toy chain');
my $height = &getChainHeight();
my $n = $height + 1;
printf "height: %s\n",$height;
my $txmeta = getTxMeta();
my $payload = "testing $0";
my $comment = "new block $n";
my $block = &createBlock($seed,$payload,$txmeta,$comment);
#printf "--- # block %s...\n",Dump($block);
my $blk = &insertBlock($block);
printf "--- # blk %s...\n",Dump($blk);
exit $?;
1;

22
t/mkdir.t

@ -0,0 +1,22 @@
#!/usr/bin/perl -w
use Cwd;
my $pwd = Cwd::cwd();
&mkdirp($pwd.'/a/b/c');
die unless -d 'a/b/c';
system 'rm -rf a/';
exit $?;
sub mkdirp { # TBD : implemend a mkdir -p
my @fp = ();
for my $p (split('/',$_[0])) {
push @fp,$p;
my $fp = join'/',@fp;
printf "fp: %s\n",$fp;
mkdir $fp unless -d $fp;
}
return $?;
}

14
t/sdate.t

@ -0,0 +1,14 @@
#!/usr/bin/perl
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use essential qw(sdate gettics);
my $tics = &gettics();
printf "tics: %s\n",$tics;
my $sdate = &sdate($tics);
printf "sdate: %s\n",$sdate;
exit $?;
1;

15
t/seed.t

@ -0,0 +1,15 @@
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use seed;
my $s0 = &seed::setseed(54321);
printf "s0:%s\n",$s0;
my $n0 = seed::rand64(); # n < 18446744073709551616
printf "n0:%s\n",$n0;
exit $?;
1;

1
t/sendhead.t

@ -0,0 +1 @@

37
t/signtx.t

@ -0,0 +1,37 @@
#
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use config qw($config);
use ECKeys qw($keys $registration);
use TXPOOL qw(signTx isTxValid);
use misc qw(kwdigest);
use botname qw(botname);
use YAML::Syck qw(LoadFile Dump);
printf "--- registration %s...\n",Dump($registration);
printf "registration.coinbase.public: %s (%s)\n",
$registration->{'coinbase'}{public},
&botname($registration->{'coinbase'}{public});
printf "keys.verification.public: %s (%s)\n",
$keys->{'verification'}{public},
&botname($keys->{'verification'}{public});
$UTXO->{$ECKeys::keys->{verification}{public}} = $config->{coinbase}{reward};
printf "--- UTXO %s...\n",Dump($UTXO);
my $tx = LoadFile($ENV{SITE}.'/templ/txcb01.yml');
my $txkw = &kwdigest($tx);
printf "txkw: %s\n",$txkw;
my $tx = &signTx($tx);
#printf "--- tx (%s) %s...\n",$txkw,Dump($tx);
my $txok = &isTxValid($tx);
printf "is %s valid: ? %s\n",$txkw,$txok;
exit $?;
1;

15
t/test.t

@ -0,0 +1,15 @@
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use seed qw();
my $s0 = &seed::setseed(54321);
printf "s0:%s\n",$s0;
my $n0 = seed::rand64(); # n < 18446744073709551616
printf "n0:%s\n",$n0;
exit $?;
1;

17
t/txmeta.t

@ -0,0 +1,17 @@
#!/usr/bin/perl
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use toychain;
use TXPOOL qw(getTxMeta);
use YAML::Syck qw(Dump);
print "// testing getTxMeta\n";
my $txblock = getTxMeta();
printf "--- txblock %s...\n",Dump($txblock);
exit $?;
1;

28
t/txtime.t

@ -0,0 +1,28 @@
#
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use toychain qw(by_txtime $config);
use YAML::Syck qw(Dump);
my $tics = time;
my $meta = 'no meta data here';
printf "--- config %s...\n",Dump($config);
my $txs = [
{'coinbase' => [ $config->{coinbase}{reward}, 'in', $tics, $meta ] },
{ 'user1' => [ $config->{coinbase}{reward}, 'out', $tics+1, $meta ] },
{ 'user2' => [ $config->{coinbase}{reward}, 'out', $tics-1, $meta ] }
];
printf "--- txs %s...\n",Dump($txs);
my $sorted = [ sort by_txtime @{$txs} ];
printf "sorted: %s\n",join"\n",@{$sorted};
exit $?;
1;

19
t/unlinked.t

@ -0,0 +1,19 @@
#!/usr/bin/perl
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use seed;
use toychain qw(unlinkedBlock);
use YAML::Syck qw(Dump);
my $seed = &seed::setseed('beautiful toy chain');
my $bkcontent = { key1 => 'value1', key2 => 'value2' };
my $blk = &unlinkedBlock($bkcontent);
printf "--- # blk %s...\n",Dump($blk);
exit $?;
1;
Loading…
Cancel
Save