-
Notifications
You must be signed in to change notification settings - Fork 3.7k
/
data.sh
59 lines (43 loc) · 1.45 KB
/
data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/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)
val_addr=$(simd keys show fd --keyring-backend=test --bech val -a)
# give the accounts some money
simd add-genesis-account "$addr" 1000000000000stake --keyring-backend=test
# save configs for the daemon
simd gentx fd 10000000stake --chain-id testing --keyring-backend=test
# 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...
simd start --pruning=nothing &
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
simd tx bank send "$addr" cosmos19g9cm8ymzchq2qkcdv3zgqtwayj9asv3hjv5u5 100stake --yes --keyring-backend=test --broadcast-mode=block --chain-id=testing
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
echo new address for bootstrap.json "$addr" "$val_addr"