-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocalnet.sh
executable file
·33 lines (28 loc) · 967 Bytes
/
localnet.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
#!/bin/bash
# number of validator nodes to create
v=${1:-4}
# number of double spending validator nodes
d=${2:-0}
# name of generated config files folder and docker network, allows to run separate tests on the same host
network=${3:-mytestnet}
# generate config files for nodes
mw tendermint testnet --config ./config-template.toml --v "$v" --o "./$network" --populate-persistent-peers
docker network create "$network"
# create docker instances for nodes, expose their client ports 26657, map TM_ROOT folder to the generated config,
# map bin folder so we can run mw installed on the host
for i in $(seq 0 $((v-1))); do
if ((i < d))
then doublespend="--doublespend"
else unset doublespend
fi
docker rm -f "node$i"
docker run -d \
-v "$GOPATH/bin":/root/bin \
-v "$PWD/$network/node$i":/root/.tendermint \
--name "node$i" \
-p "$((26657+i)):26657" \
--network "$network" \
alpine:3.7 \
/root/bin/mw node "$doublespend"
done
docker ps