Browse Source

add init script

master
Mindy C. Serl 4 years ago
committed by Brooke L. Rediker
parent
commit
57a0a7e588
  1. 112
      bin/toychain
  2. 9
      config.yml
  3. 2
      genesis.yml
  4. BIN
      secrets/keys.yml

112
bin/toychain

@ -0,0 +1,112 @@
#!/bin/sh
pgm="${0##*/}"
what="${1:-usage}"
# vim: syntax=sh
#
echo "--- # $pgm"
if [ "x$what" = 'xusage' ]; then
cat <<EOT
# welcome to toychain a simple educational blockchain
available commands:
$pgm init \$name # to initialize \$name node
$pgm config \$name # to change configuration to this \$name node
$pgm start \$name # to start a local \$name node
$pgm stop \$name # to stop a \$name node
$pgm restart \$name # to restart a \$name node
$pgm sync \$name # to synchronize a \$name node
$pgm update \$tag # to synchronize a \$tag node
$pgm test \$tc # to run the \$tc test case
$pgm debug \$cmd # to running \$cmd in debug mode
EOT
fi
main() {
case $what in
init) tcinitialize $2;;
config) tcconfigure $@;;
start) tcstart $2;;
stop) tcstop $2;;
stop) tcstop $2;;
update) tcupdate $@;;
test) tctest $@;;
debug) tcdebug $@;;
support) echo "do you need help with $pgm ?\n- call our support line at https://www.drit.ml\n-- Dr I·T";;
log) tclog;;
*) tcrun $@;;
esac
}
tcinitialize() {
echo "$pgm: initializing ..."
echo "---"
}
tcconfigure() {
echo "$pgm: configure ..."
echo "---"
}
tcstart() {
echo "$pgm: starting daemon ..."
echo "---"
}
tcstop() {
echo "$pgm: stopping daemon ..."
echo "---"
}
tcsync() {
echo "$pgm: synchronizing daemon ..."
echo "---"
}
tcupdate() {
shift;
tag=$2
echo "$pgm: updating daemon with tag $tag..."
git pull origin master # 1> transcript.log 2>&1
git checkout $tag # 1> transcript.log 2>&1
echo "---"
}
tclog() {
echo "$pgm: transcript log"
tail -f transctip.log
echo "---"
}
tctest() {
tc="$2"
echo "$pgm: running $1 $tc"
echo "---"
}
tcrun() {
cmd="$@"
echo "$pgm: running $cmd"
$cmd
echo "..."
}
tcdebug() {
shift;
cmd="$@"
echo "$pgm: running $cmd in debug mode..."
echo "---"
}
main $@;
exit $?;
true; # $Source: /my/shell/scripts/toychain.sh $

9
config.yml

@ -1,6 +1,9 @@
--- # toychain's config --- # toychain's config
version: 1.01 version: 1.01
chain: toychain chain: toychain
apiver: '0.0'
port: 8089
# p2p network = api+1 # p2p network = api+1
apis: apis:
- 127.0.0.1:8091 - 127.0.0.1:8091
@ -11,5 +14,9 @@ apis:
# block parameters : # block parameters :
bkver: 0 bkver: 0
difficulty: 5
bkreward: 100 bkreward: 100
# Proof of Work option
difficulty: 5
maxdiff: 7
# CAstore options
trackmode: 1

2
genesis.yml

@ -6,7 +6,7 @@ data:
comment: "This is the genesis block" comment: "This is the genesis block"
meta: meta:
seed: 0xb3560762 seed: 0xb3560762
salt: 442360558864191384 # used in address computation
salt: ~ # used in address computation
txroot: ~ txroot: ~
audit: audit:
peerid: QmcfHufAK9ErQ9ZKJF7YX68KntYYBJngkGDoVKcZEJyRve peerid: QmcfHufAK9ErQ9ZKJF7YX68KntYYBJngkGDoVKcZEJyRve

BIN
secrets/keys.yml

Loading…
Cancel
Save