-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathstart_local_blockchain_afan_shard.sh
executable file
·126 lines (121 loc) · 3.64 KB
/
start_local_blockchain_afan_shard.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
#
# A script to start a local blockchain with a shard chain (parent chain, afan child chain).
#
printf "\n[[[[[ start_local_blockchain_afan_shard.sh ]]]]]\n\n"
# PARENT CHAIN **
# parent tracker
printf "\nStarting parent tracker..\n"
PORT=8080 \
P2P_PORT=5000 \
CONSOLE_LOG=false \
node ./tracker-server/index.js &
printf "\nDone\n\n"
sleep 5
# parent node 0
printf "\nStarting parent node 0..\n"
UNSAFE_PRIVATE_KEY=b22c95ffc4a5c096f7d7d0487ba963ce6ac945bdc91c79b64ce209de289bec96 \
PORT=8081 \
P2P_PORT=5001 \
CONSOLE_LOG=true \
LOG_BANDAGE_INFO=true \
ENABLE_REST_FUNCTION_CALL=true \
ENABLE_TX_SIG_VERIF_WORKAROUND=true \
ENABLE_GAS_FEE_WORKAROUND=true \
ENABLE_EXPRESS_RATE_LIMIT=false \
node ./client/index.js &
printf "\nDone\n\n"
sleep 5
# parent node 1
printf "\nStarting parent node 1..\n"
UNSAFE_PRIVATE_KEY=921cc48e48c876fc6ed1eb02a76ad520e8d16a91487f9c7e03441da8e35a0947 \
PORT=8082 \
P2P_PORT=5002 \
CONSOLE_LOG=true \
LOG_BANDAGE_INFO=true \
ENABLE_REST_FUNCTION_CALL=true \
ENABLE_TX_SIG_VERIF_WORKAROUND=true \
ENABLE_GAS_FEE_WORKAROUND=true \
ENABLE_EXPRESS_RATE_LIMIT=false \
node ./client/index.js &
printf "\nDone\n\n"
sleep 5
# parent node 2
printf "\nStarting parent node 2..\n"
UNSAFE_PRIVATE_KEY=41e6e5718188ce9afd25e4b386482ac2c5272c49a622d8d217887bce21dce560 \
PORT=8083 \
P2P_PORT=5003 \
CONSOLE_LOG=true \
LOG_BANDAGE_INFO=true \
ENABLE_REST_FUNCTION_CALL=true \
ENABLE_TX_SIG_VERIF_WORKAROUND=true \
ENABLE_GAS_FEE_WORKAROUND=true \
ENABLE_EXPRESS_RATE_LIMIT=false \
node ./client/index.js &
printf "\nDone\n\n"
sleep 15
# AFAN CHILD CHAIN **
# afan child chain tracker
printf "\nStarting afan child chain tracker..\n"
BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard \
PORT=9000 \
P2P_PORT=6000 \
CONSOLE_LOG=false \
node ./tracker-server/index.js &
printf "\nDone\n\n"
sleep 5
# afan child chain node 0
printf "\nStarting afan child chain node 0..\n"
BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard \
PORT=9001 \
P2P_PORT=6001 \
UNSAFE_PRIVATE_KEY=d8f77aa2afe2580a858a8cc97b6056e10f888c6fd07ebb58755d8422b03da816 \
CONSOLE_LOG=true \
LOG_BANDAGE_INFO=true \
ENABLE_REST_FUNCTION_CALL=true \
ENABLE_TX_SIG_VERIF_WORKAROUND=true \
ENABLE_GAS_FEE_WORKAROUND=true \
ENABLE_EXPRESS_RATE_LIMIT=false \
node ./client/index.js &
printf "\nDone\n\n"
sleep 5
while :
do
nodeState=$(curl -m 20 -X GET -H "Content-Type: application/json" "http://localhost:9001/node_status" | node_modules/node-jq/bin/jq -r '.result.state')
printf "\nnodeState = ${nodeState}\n"
if [[ "$nodeState" = "SERVING" ]]; then
printf "\nShard node 0 is now serving!\n"
break
fi
sleep 20
done
# afan child chain node 1
printf "\nStarting afan child chain node 1..\n"
BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard \
PORT=9002 \
P2P_PORT=6002 \
UNSAFE_PRIVATE_KEY=a3409e22bc14a3d0e73697df25617b3f2eaae9b5eade77615a32abc0ad5ee0df \
CONSOLE_LOG=true \
LOG_BANDAGE_INFO=true \
ENABLE_REST_FUNCTION_CALL=true \
ENABLE_TX_SIG_VERIF_WORKAROUND=true \
ENABLE_GAS_FEE_WORKAROUND=true \
ENABLE_EXPRESS_RATE_LIMIT=false \
node ./client/index.js &
printf "\nDone\n\n"
sleep 5
# afan child chain node 2
printf "\nStarting afan child chain node 2..\n"
BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard \
PORT=9003 \
P2P_PORT=6003 \
UNSAFE_PRIVATE_KEY=c4611582dbb5319f08ba0907af6430a79e02b87b112aa4039d43e8765384f568 \
CONSOLE_LOG=true \
LOG_BANDAGE_INFO=true \
ENABLE_REST_FUNCTION_CALL=true \
ENABLE_TX_SIG_VERIF_WORKAROUND=true \
ENABLE_GAS_FEE_WORKAROUND=true \
ENABLE_EXPRESS_RATE_LIMIT=false \
node ./client/index.js &
printf "\nDone\n\n"
sleep 15