testnet.template 3.7 KB
Newer Older
1 2
#!/bin/bash

3
# set up a wallet just for holding the key used during blockchain ignition
4 5 6 7 8 9 10 11 12 13 14 15

bioshost=$BIOS_HOSTNAME
if [ -z "$bioshost" ]; then
   bioshost=localhost
fi

biosport=$BIOS_HTTP_PORT
if [ -z "$biosport" ]; then
    biosport=9776
fi

wddir=eosio-ignition-wd
P
Phil Mesnier 已提交
16 17
wdaddr=localhost:8899
wdurl=http://$wdaddr
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
# Manual deployers, add a line below this block that looks like:
#    bioshost=$BIOS_HOSTNAME
#    biosport=$BIOS_HTTP_PORT
#    cnt_dir=$CONTRACT_DIR
#    sys=$SYS_CONTRACT
# where $BIOS_HOSTNAME is replaced by the hostname portion of the http-server-address configured
# for the nodeos instance running to bios producer
# ------ DO NOT ALTER THE NEXT LINE -------
###INSERT envars

logfile=$wddir/bootlog.txt

if [ -e $wddir ]; then
    rm -rf $wddir
fi
mkdir $wddir

step=1
echo Initializing ignition sequence  at $(date) | tee $logfile

P
Phil Mesnier 已提交
38
echo "http-server-address = $wdaddr" > $wddir/config.ini
39

40
programs/keosd/keosd --config-dir $wddir --data-dir $wddir 2> $wddir/wdlog.txt &
41
echo $$ > ignition_wallet.pid
42
echo keosd log in $wddir/wdlog.txt >> $logfile
43 44 45 46
sleep 1

ecmd () {
    echo ===== Start: $step ============ >> $logfile
P
Phil Mesnier 已提交
47
    echo executing: cleos --wallet-url $wdurl --url http://$bioshost:$biosport $* | tee -a $logfile
48
    echo ----------------------- >> $logfile
P
Phil Mesnier 已提交
49
    programs/cleos/cleos  --wallet-url $wdurl --url http://$bioshost:$biosport $* >> $logfile 2>&1
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
    echo ==== End: $step ============== >> $logfile
    step=$(($step + 1))
}

wcmd () {
    ecmd wallet $*
}

cacmd () {
    ecmd create account eosio $*
}

sleep 2
ecmd get info


wcmd create -n ignition
# Manual deployers, add a line below this block that looks like:
68 69 70 71 72
#    wcmd import -n ignition $PRODKEY[0]
#    wcmd import -n ignition $PRODKEY[1]
#    ...
#    wcmd import -n ignition $PRODKEY[20]

73 74
# where $BIOSKEY is replaced by the private key for the bios node
# ------ DO NOT ALTER THE NEXT LINE -------
75
###INSERT prodkeys
76 77

# Manual deployers, add a series of lines below this block that looks like:
78 79
#    cacmd $PRODNAME[0] $OWNERKEY[0] $ACTIVEKEY[0]
#    cacmd $PRODNAME[1] $OWNERKEY[1] $ACTiVEKEY[1]
80 81 82 83 84 85 86 87
#    ...
#    cacmd $PRODNAME[20] $OWNERKEY[20] $ACTIVEKEY[20]
# where $PRODNAME is the producer account name and $OWNERKEY and $ACTIVEKEY are both the producer's
# public key
# ------ DO NOT ALTER THE NEXT LINE -------
###INSERT cacmd


88
ecmd set contract eosio contracts/eosio.bios contracts/eosio.bios/eosio.bios.wast contracts/eosio.bios/eosio.bios.abi
89 90 91

#the setprods.json argument cannot pass through the function call due to embedded quotes
echo ===== Start: $step ============ >> $logfile
P
Phil Mesnier 已提交
92
echo executing: cleos  --wallet-url $wdurl --url http://$bioshost:$biosport push action eosio setprods setprods.json -p eosio@active | tee -a $logfile
93
echo ----------------------- >> $logfile
P
Phil Mesnier 已提交
94
programs/cleos/cleos  --wallet-url $wdurl --url http://$bioshost:$biosport push action eosio setprods setprods.json -p eosio@active >> $logfile 2>&1
95 96 97
echo ==== End: $step ============== >> $logfile
step=$(($step + 1))

98
ecmd set contract eosio contracts/eosio.system contracts/eosio.system/eosio.system.wast contracts/eosio.system/eosio.system.abi
99 100

echo ===== Start: $step ============ >> $logfile
P
Phil Mesnier 已提交
101
echo executing: cleos  --wallet-url $wdurl --url http://$bioshost:$biosport push action eosio issue '{"to":"eosio","quantity":"1000000000.0000 EOS","memo":"init"}' -p eosio@active | tee -a $logfile
102
echo ----------------------- >> $logfile
P
Phil Mesnier 已提交
103
programs/cleos/cleos  --wallet-url $wdurl --url http://$bioshost:$biosport push action eosio issue '{"to":"eosio","quantity":"1000000000.0000 EOS","memo":"init"}' -p eosio@active >> $logfile 2>&1
104 105 106
echo ==== End: $step ============== >> $logfile
step=$(($step + 1))

107
for a in {a..u}; do ecmd transfer eosio init$a 1000000.0000 "\"fund_producer_init$a\""; done
108

109
pkill -15 keosd