diff --git a/PerlWebSocketEchoServer.pl b/PerlWebSocketEchoServer.pl deleted file mode 100644 index e09ce92..0000000 --- a/PerlWebSocketEchoServer.pl +++ /dev/null @@ -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; diff --git a/_data/timelog.yml b/_data/timelog.yml index d6025fc..c6757a8 100644 --- a/_data/timelog.yml +++ b/_data/timelog.yml @@ -13,3 +13,4 @@ 1624219990488746675: stop toptal -- /drg/toychain 1624361700774728980: start toptal pow -- /drg/toychain 1624395286300684038: stop toptal -- /drg/toychain +1625058641379617339: start toptal WS -- /drg/toychain diff --git a/bin/update b/bin/update new file mode 100755 index 0000000..4a1dfb2 --- /dev/null +++ b/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 $ + + diff --git a/config.yml b/config.yml index 4b0f997..b4be93b 100644 --- a/config.yml +++ b/config.yml @@ -1,7 +1,8 @@ --- # toychain's config -version: 1.01 +version: 1.06 chain: toychain apiver: '0.0' +ipfsgw: 8390 port: 8089 # p2p network = api+1 diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..9fa8a3a --- /dev/null +++ b/install.sh @@ -0,0 +1,6 @@ +# + +set -e +cat modules.deps | while read m; do + cpan install $m +done diff --git a/lib b/lib index 84342cb..2fca6d5 160000 --- a/lib +++ b/lib @@ -1 +1 @@ -Subproject commit 84342cbab0833093c04a298d60429ad9556da3a1 +Subproject commit 2fca6d50421029bb1ab7e9f6171b0e6606bcb567 diff --git a/secrets/keys.yml b/secrets/keys.yml index 7047ffe..2a08cc0 100644 Binary files a/secrets/keys.yml and b/secrets/keys.yml differ diff --git a/t/cashash.t b/t/cashash.t index 072416d..0d3cf74 100644 --- a/t/cashash.t +++ b/t/cashash.t @@ -18,7 +18,7 @@ my ($addr,$pow) = cashash('SHA256','~',$salt,$type,5); printf "addr16: f%s\n",unpack'H*',$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; diff --git a/t/eckeys.t b/t/eckeys.t new file mode 100644 index 0000000..5eef2cc --- /dev/null +++ b/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; + diff --git a/testapi.pl b/testapi.pl new file mode 100644 index 0000000..8280e64 --- /dev/null +++ b/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 $ + + + diff --git a/testing.pl b/testing.pl index 376bd55..16c065f 100644 --- a/testing.pl +++ b/testing.pl @@ -27,10 +27,10 @@ printf "salt: %s\n",$salt; my $headhash = $toychain::HEADs[0]->{bkaddr}; printf "genesis: %s\n",$headhash; + print "// testing getTxMeta\n"; my $txblock = getTxMeta(); - print "// testing blockCreation\n"; # createBlock(seed,payload,txblock,comment) 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); createDot($toychain::chain); - displayChain($toychain::chain); +saveChain($toychain::chain); diff --git a/tx.yml b/tx.yml index fa8c73e..a51b9bb 100644 --- a/tx.yml +++ b/tx.yml @@ -7,6 +7,7 @@ payload: "This is an example of transaction" outputs: - pub3: 60 - pubfee: 10 -sig: +signatures: - pub1: sig1 - pub2: sig2 + - pubfee: sig3