Browse Source

added an INSTALL .md file and misc...

master
Josie D. Madaffari 3 years ago
committed by Brooke L. Rediker
parent
commit
f9d6e7bb94
  1. 15
      INSTALL.md
  2. 18
      bin/apirun.pl
  3. 0
      bin/setidentity.pl
  4. 1
      bin/toychain
  5. 12
      curltest.sh
  6. 7
      init.sh
  7. 2
      lib
  8. 3
      nodes/cloneit.sh
  9. 11
      post.sh
  10. 23
      t/genesis.t

15
INSTALL.md

@ -0,0 +1,15 @@
# INSTALLATION
```sh
git_url="git@git.toptal.com:screening/Michel-Combes"
git clone --recursive $git_url toychain
cd toychain
gpg --decrypt local.key.asc | git-crypt unlock -
. rc.sh
# install perl modules from modules.deps
sh install.sh
# initialize config and keys
sh init.sh
bin/toychain start
```

18
bin/apirun.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 $

0
setidentity.pl → bin/setidentity.pl

1
bin/toychain

@ -63,6 +63,7 @@ tcconfigure() {
tcstart() {
echo "$pgm: starting daemon ..."
perl -S apirun.pl
echo "---"
}

12
curltest.sh

@ -0,0 +1,12 @@
#
#curl http://127.0.0.1:8089/api/0.0/version
#curl http://127.0.0.1:8089/api/0.0/audit
curl http://127.0.0.1:8089/api/0.0/getheight
echo ''
curl http://127.0.0.1:8089/api/0.0/getchain
echo ''
curl -s http://127.0.0.1:8089/api/0.0/getblock?n=30
echo ''
curl -s http://127.0.0.1:8089/api/0.0/gettx?txaddr=Z123
echo ''

7
init.sh

@ -1,20 +1,23 @@
#
i="$1"
i="$1:-1"
top=$(git rev-parse --show-toplevel)
export SITE=$top
export PATH=$top/bin:$PATH
port=$(expr 8089 + 2 \* $i )
echo "node$i: port=$port"
sed -e "s/port: .*/port: $port/" config0.yml > config$i.yml
rm config.yml
ln -s config$i.yml config.yml
gpg --decrypt local.key.asc | git-crypt unlock -
cp -p secrets/keys0.yml secrets/keys.yml
echo "your name ?"
read name
perl setidentity.pl "$name"
perl -S setidentity.pl "$name (node$i)"

2
lib

@ -1 +1 @@
Subproject commit d4c8a3dee208e00b768607978228d1b01979988c
Subproject commit dd522659e0e9a66aef4c6b22105847df427f2dea

3
nodes/cloneit.sh

@ -8,7 +8,8 @@ echo create node$i
#git clone --recursive git@git.toptal.com:screening/Michel-Combes node$i
port=$(expr 8089 + 2 \* $i )
echo "node$i: port=$port"
sed -e "s/port: .*/port: $port/" $node$i/config0.yml > $node$i/config$i.yml
rm node$i/config.yml
sed -e "s/port: .*/port: $port/" node$i/config0.yml > node$i/config.yml
cd node$i
gpg --decrypt local.key.asc | git-crypt unlock -

11
post.sh

@ -0,0 +1,11 @@
#
url="$1"
file="$2"
sed -e 's/$/%0a/g' $file > $file.post
curl -s -X POST "$url" --data @$file.post
exit $?;
true;

23
t/genesis.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($headhash,'blocks');
#printf "--- blk %s...\n",Dump($blk);
&displayBlock($blk);
exit $?;
1;
Loading…
Cancel
Save