-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathrun-standalone-local.sh
executable file
·108 lines (97 loc) · 3 KB
/
run-standalone-local.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
set -e
# ensure we kill all child processes when we exit
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
#define default ports
ports=(30333 30305 30308 30311 30313)
#check to see process is not orphaned or already running
for port in ${ports[@]}; do
if [[ $(lsof -i -P -n | grep LISTEN | grep :$port) ]]; then
echo "Port $port has a running process. Exiting"
exit -1
fi
done
CLEAN=${CLEAN:-false}
ARCHIVE=${ARCHIVE:-false}
# Parse arguments for the script
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-c|--clean)
CLEAN=true
shift # past argument
;;
--archive)
ARCHIVE=true
shift # past argument
;;
*) # unknown option
shift # past argument
;;
esac
done
pushd .
# Check if we should clean the tmp directory
if [ "$CLEAN" = true ]; then
echo "Cleaning tmp directory"
rm -rf ./tmp
fi
mkdir -p ./tmp
# The following line ensure we run from the project root
PROJECT_ROOT=$(git rev-parse --show-toplevel)
cd "$PROJECT_ROOT"
TARGET="${CARGO_TARGET_DIR:-./target}"
BINARY="$TARGET"/release/tangle
if [ ! -f "$BINARY" ]; then
echo "Binary does not exist at \`$BINARY\`. Exiting"
exit 1
fi
echo "*** Start Tangle Testnet ***"
# Alice
$BINARY -d ./tmp/alice --dev --validator -lerror --alice \
--rpc-cors all --rpc-methods=unsafe --rpc-external \
--port ${ports[0]} \
--rpc-port 9944 \
--rpc-max-request-size 3000 \
--rpc-max-response-size 3000 \
--ethapi trace,debug \
--auto-insert-keys \
--node-key 0000000000000000000000000000000000000000000000000000000000000001 \
$([ "$ARCHIVE" = true ] && echo "--pruning=archive") &
# Sleep for a while to allow the node to start
sleep 3
# Bob
$BINARY -d ./tmp/bob --dev --validator -lerror --bob \
--rpc-cors all --rpc-methods=unsafe --rpc-external \
--port ${ports[1]} \
--rpc-port 9945 \
--ethapi trace,debug \
--auto-insert-keys \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp &
# Charlie
$BINARY -d ./tmp/charlie --dev --validator -lerror --charlie \
--rpc-cors all --rpc-methods=unsafe --rpc-external \
--port ${ports[2]} \
--rpc-port 9946 \
--ethapi trace,debug \
--auto-insert-keys \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp &
# Dave
$BINARY -d ./tmp/dave --dev --validator -lerror --dave \
--rpc-cors all --rpc-methods=unsafe --rpc-external \
--port ${ports[3]} \
--rpc-port 9947 \
--ethapi trace,debug \
--auto-insert-keys \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp &
# Eve
$BINARY -d ./tmp/eve --dev --validator -linfo --eve \
--rpc-cors all --rpc-methods=unsafe --rpc-external \
--port ${ports[4]} \
--rpc-port 9948 \
--ethapi trace,debug \
--auto-insert-keys \
-levm=debug \
-lgadget=trace \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp
popd