forked from Arch-Network/arch-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
leader.sh
executable file
·32 lines (30 loc) · 1.74 KB
/
leader.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
#!/bin/bash
# Wait for bootnode initialization to complete
while [ ! -f /bootnode_data/init_complete ]; do
echo 'Waiting for bootnode initialization to complete...'
sleep 5
done
sleep 10
# If validator binary exists move it to bin
if [ -f ./validator ]; then
mv ./validator /usr/local/bin/validator
fi
# Set the bootnode peer ID
BOOTNODE_PEERID=$(cat /bootnode_data/peer_id)
MONITOR_PORT=8080
echo 'Contents of validator_whitelist:';
cat /bootnode_data/validator_whitelist;
WHITELIST=$(cat /bootnode_data/validator_whitelist | tr '\n' ',' | sed 's/,$//');
echo 'WHITELIST value:';
echo $WHITELIST;
# If bootnode exists move it to bin
if [ -f ./bootnode ]; then
mv ./bootnode /usr/local/bin/bootnode
fi
if [ -z $WHITELIST ]; then
echo 'Error: WHITELIST is empty';
exit 1;
fi;
echo "About to run this command: validator -d /arch_data/leader -n ${NETWORK_MODE:-localnet} -b "/ip4/172.30.0.250/tcp/${BOOTNODE_P2P_PORT}/p2p/$BOOTNODE_PEERID" --rpc-bind-port $RPC_BIND_PORT --p2p-bind-port $P2P_BIND_PORT --monitor-bind-ip 127.0.0.1 --monitor-bind-port $MONITOR_PORT --bitcoin-rpc-endpoint $BITCOIN_RPC_ENDPOINT --bitcoin-rpc-port $BITCOIN_RPC_PORT --bitcoin-rpc-username $BITCOIN_RPC_USERNAME --bitcoin-rpc-password $BITCOIN_RPC_PASSWORD"
# Run the leader node with the bootnode peer ID and Bitcoin RPC details
validator -d /arch_data/leader -n "${NETWORK_MODE:-localnet}" -b "/ip4/172.30.0.250/tcp/${BOOTNODE_P2P_PORT}/p2p/${BOOTNODE_PEERID}" --rpc-bind-port "${RPC_BIND_PORT}" --p2p-bind-port "${P2P_BIND_PORT}" --monitor-bind-ip 127.0.0.1 --monitor-bind-port "${MONITOR_PORT}" --bitcoin-rpc-endpoint "${BITCOIN_RPC_ENDPOINT}" --bitcoin-rpc-port "${BITCOIN_RPC_PORT}" --bitcoin-rpc-username "${BITCOIN_RPC_USERNAME}" --bitcoin-rpc-password "${BITCOIN_RPC_PASSWORD}"