2021-01-21 01:33:02 -08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
wait_simd() {
|
|
|
|
timeout 30 sh -c 'until nc -z $0 $1; do sleep 1; done' localhost 9090
|
|
|
|
}
|
|
|
|
# this script is used to recreate the data dir
|
|
|
|
echo clearing /root/.simapp
|
|
|
|
rm -rf /root/.simapp
|
|
|
|
echo initting new chain
|
|
|
|
# init config files
|
|
|
|
simd init simd --chain-id testing
|
|
|
|
|
|
|
|
# create accounts
|
|
|
|
simd keys add fd --keyring-backend=test
|
|
|
|
|
|
|
|
addr=$(simd keys show fd -a --keyring-backend=test)
|
2021-02-01 05:17:44 -08:00
|
|
|
val_addr=$(simd keys show fd --keyring-backend=test --bech val -a)
|
2021-01-21 01:33:02 -08:00
|
|
|
|
|
|
|
# give the accounts some money
|
|
|
|
simd add-genesis-account "$addr" 1000000000000stake --keyring-backend=test
|
|
|
|
|
|
|
|
# save configs for the daemon
|
2021-02-01 05:17:44 -08:00
|
|
|
simd gentx fd 10000000stake --chain-id testing --keyring-backend=test
|
2021-01-21 01:33:02 -08:00
|
|
|
|
|
|
|
# input genTx to the genesis file
|
|
|
|
simd collect-gentxs
|
|
|
|
# verify genesis file is fine
|
|
|
|
simd validate-genesis
|
|
|
|
echo changing network settings
|
|
|
|
sed -i 's/127.0.0.1/0.0.0.0/g' /root/.simapp/config/config.toml
|
|
|
|
|
|
|
|
# start simd
|
|
|
|
echo starting simd...
|
2021-11-30 01:22:56 -08:00
|
|
|
simd start --pruning=nothing --mode validator &
|
2021-01-21 01:33:02 -08:00
|
|
|
pid=$!
|
|
|
|
echo simd started with PID $pid
|
|
|
|
|
|
|
|
echo awaiting for simd to be ready
|
|
|
|
wait_simd
|
|
|
|
echo simd is ready
|
|
|
|
sleep 10
|
|
|
|
|
|
|
|
|
|
|
|
# send transaction to deterministic address
|
|
|
|
echo sending transaction with addr $addr
|
2021-03-11 07:01:29 -08:00
|
|
|
simd tx bank send "$addr" cosmos19g9cm8ymzchq2qkcdv3zgqtwayj9asv3hjv5u5 100stake --yes --keyring-backend=test --broadcast-mode=block --chain-id=testing
|
2021-01-21 01:33:02 -08:00
|
|
|
|
|
|
|
sleep 10
|
|
|
|
|
|
|
|
echo stopping simd...
|
|
|
|
kill -9 $pid
|
|
|
|
|
|
|
|
echo zipping data dir and saving to /tmp/data.tar.gz
|
|
|
|
|
|
|
|
tar -czvf /tmp/data.tar.gz /root/.simapp
|
|
|
|
|
2021-02-01 05:17:44 -08:00
|
|
|
echo new address for bootstrap.json "$addr" "$val_addr"
|