Browse Source

libraries update

master
Bridget R. Perrington 3 years ago
committed by Brooke L. Rediker
parent
commit
de39a7a3cb
  1. 1
      _data/timelog.yml
  2. 2
      lib
  3. 16
      notes.md
  4. 24
      t/encode.t
  5. 50
      testing.pl

1
_data/timelog.yml

@ -10,3 +10,4 @@
1624075325993120885: start toptal chaining -- /drg/toychain
1624117500619195903: stop toptal -- /drg/toychain
1624171149798092491: start toptal -- /drg/toychain
1624219990488746675: stop toptal -- /drg/toychain

2
lib

@ -1 +1 @@
Subproject commit c73ee3d50c2842d0beb4d7e8ae20554da32660d4
Subproject commit eaa1d8258b1c171c4e90fc62f4019301e6b2f4f5

16
notes.md

@ -16,3 +16,19 @@
minimally sized blocks :
- segreated signature, timestamp, audit etc.
- block: {address, previous, pow}
## observation ...
- revokable block if sign w/ a DH on txo and ECDSA on txi
- txroot (merkle root can be global)
- PoW is to slow down chainupdate to avois spam
- consensus is on the longest length
- /!\ maximal work is hackable
- sort of tx sequence can be done on node side
- block chain can store tx out of order (FIFO style)

24
t/encode.t

@ -0,0 +1,24 @@
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use encode qw(encode_basen decode_basen);
my $msg = 'no work yet !';
my $nonce = unpack 'Q',&decode_basen($msg,29);
printf "nonce: %s\n",$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: 0x%x\n",$nonce;
printf "monce29: %s\n",&encode_basen(pack('Q',$nonce),29);
$msg = &encode_basen("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",29);
printf "msg: %s\n",$msg;
my $m29 = &decode_basen($msg.$msg,29);
printf "m29: %s (%dc)\n",join('_',unpack('Q*',$m29)),length($m29);
printf "m16: %s\n",unpack('H*',$m29);
exit $?;
1;

50
testing.pl

@ -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;
Loading…
Cancel
Save