Browse Source

library update (2fca6d5) on Wed Jun 30 10:48:03 PM CEST 2021

master
Bert R. Jondrow 4 years ago
committed by Brooke L. Rediker
parent
commit
aec2210234
  1. 16
      PerlWebSocketEchoServer.pl
  2. 1
      _data/timelog.yml
  3. 20
      bin/update
  4. 3
      config.yml
  5. 6
      install.sh
  6. 2
      lib
  7. BIN
      secrets/keys.yml
  8. 2
      t/cashash.t
  9. 28
      t/eckeys.t
  10. 18
      testapi.pl
  11. 4
      testing.pl
  12. 3
      tx.yml

16
PerlWebSocketEchoServer.pl

@ -1,16 +0,0 @@
#!/usr/bin/perl
use Net::WebSocket::Server;
Net::WebSocket::Server->new(
listen => 8080,
on_connect => sub {
my ($serv, $conn) = @_;
$conn->on(
utf8 => sub {
my ($conn, $msg) = @_;
$conn->send_utf8($msg);
},
);
},
)->start;
1;

1
_data/timelog.yml

@ -13,3 +13,4 @@
1624219990488746675: stop toptal -- /drg/toychain 1624219990488746675: stop toptal -- /drg/toychain
1624361700774728980: start toptal pow -- /drg/toychain 1624361700774728980: start toptal pow -- /drg/toychain
1624395286300684038: stop toptal -- /drg/toychain 1624395286300684038: stop toptal -- /drg/toychain
1625058641379617339: start toptal WS -- /drg/toychain

20
bin/update

@ -0,0 +1,20 @@
#
echo "--- ${0##*/}"
pwd=$(pwd)
top=$(git rev-parse --show-toplevel)
git pull --recurse-submodules=yes --rebase
gitid=$(git rev-parse --short HEAD)
echo gitid: $gitid
#cd $top/lib
#git pull --ff-only
cd $pwd
echo ...
exit $?;
true; # $Source: /my/shell/script/update.sh $

3
config.yml

@ -1,7 +1,8 @@
--- # toychain's config --- # toychain's config
version: 1.01
version: 1.06
chain: toychain chain: toychain
apiver: '0.0' apiver: '0.0'
ipfsgw: 8390
port: 8089 port: 8089
# p2p network = api+1 # p2p network = api+1

6
install.sh

@ -0,0 +1,6 @@
#
set -e
cat modules.deps | while read m; do
cpan install $m
done

2
lib

@ -1 +1 @@
Subproject commit 84342cbab0833093c04a298d60429ad9556da3a1
Subproject commit 2fca6d50421029bb1ab7e9f6171b0e6606bcb567

BIN
secrets/keys.yml

2
t/cashash.t

@ -18,7 +18,7 @@ my ($addr,$pow) = cashash('SHA256','~',$salt,$type,5);
printf "addr16: f%s\n",unpack'H*',$addr; printf "addr16: f%s\n",unpack'H*',$addr;
printf "addr58: %s\n",encode_base58f($addr); printf "addr58: %s\n",encode_base58f($addr);
$addr = CASWrite(undef,$salt,$type,5);
$addr = CASWrite('CAStore',undef,$salt,$type,5);
printf "addr: %s\n",$addr; printf "addr: %s\n",$addr;

28
t/eckeys.t

@ -0,0 +1,28 @@
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use encode qw(mbase58);
use ECKeys qw($keys ecsign ecverif eckeygen saveKeys);
use YAML::Syck qw(Dump);
my $anon = eckeygen('anonymous' => 'This is an anonymous ECDSA key');
my $id = eckeygen('identity' => 'Doctor I·T (demo)');
my $miner = eckeygen('miner' => 'Toycoin Mining Rig Corp.');
my $miner = eckeygen('coinbase' => 'ToyChain Blockchain Bot');
&saveKeys();
printf "keys: %s\n",Dump($keys);
my $sig = &ecsign('coinbase',qq'["coinbase","50","This is a coinbase transaction of 50 coins"]');
printf "- 50 coinbase: %s\n",$sig;
my $sig = &ecsign('coinbase',qq'["coinbase","100","default coinbase"]');
printf "- default coinbase: %s\n",$sig;
$sig = &ecsign('identity',"this message is signed by $keys->{identity}{name}");
printf "sig: %s\n",$sig;
my $valid = &ecverif($keys->{identity}{public},$sig,"this message is signed by $keys->{identity}{name}");
exit $?;
1;

18
testapi.pl

@ -0,0 +1,18 @@
#!/usr/bin/perl -w
#
# Intent: testing the API server
#
use lib 'lib';
use toychain;
use API qw(apigw_run);
apigw_run();
exit $?;
1; # $Source: /my/perl/script/testapi.pl $

4
testing.pl

@ -27,10 +27,10 @@ printf "salt: %s\n",$salt;
my $headhash = $toychain::HEADs[0]->{bkaddr}; my $headhash = $toychain::HEADs[0]->{bkaddr};
printf "genesis: %s\n",$headhash; printf "genesis: %s\n",$headhash;
print "// testing getTxMeta\n"; print "// testing getTxMeta\n";
my $txblock = getTxMeta(); my $txblock = getTxMeta();
print "// testing blockCreation\n"; print "// testing blockCreation\n";
# createBlock(seed,payload,txblock,comment) # createBlock(seed,payload,txblock,comment)
my $block = &createBlock($seed,"This is the 2nd block payload",$txblock,'1st comment for new block'); my $block = &createBlock($seed,"This is the 2nd block payload",$txblock,'1st comment for new block');
@ -39,8 +39,8 @@ print "// testing insertBlock:\n";
my $chain = &insertBlock($toychain::HEADs[0],$block); my $chain = &insertBlock($toychain::HEADs[0],$block);
createDot($toychain::chain); createDot($toychain::chain);
displayChain($toychain::chain); displayChain($toychain::chain);
saveChain($toychain::chain);

3
tx.yml

@ -7,6 +7,7 @@ payload: "This is an example of transaction"
outputs: outputs:
- pub3: 60 - pub3: 60
- pubfee: 10 - pubfee: 10
sig:
signatures:
- pub1: sig1 - pub1: sig1
- pub2: sig2 - pub2: sig2
- pubfee: sig3
Loading…
Cancel
Save