-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-testnet-reth-miner-node.sh
More file actions
51 lines (42 loc) · 1.44 KB
/
start-testnet-reth-miner-node.sh
File metadata and controls
51 lines (42 loc) · 1.44 KB
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
#!/bin/sh
ETH_DATA_DIR=.scalerized/eth
JWT_PATH=testing/files/jwt.hex
ETH_GENESIS_PATH=testing/files/eth-genesis.json
retries=3
delay=3
enode_url=""
get_enode() {
for ((i = 1; i <= retries; i++)); do
response=$(curl -s -X POST --data '{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":1}' \
-H "Content-Type: application/json" "http://$BOOTNODE_IP:$BOOTNODE_RPC_PORT")
echo "Response from http://$BOOTNODE_IP:$BOOTNODE_RPC_PORT"
echo "$response"
enode=$(echo "$response" | jq -r '.result.enode')
if [[ -n "$enode" ]]; then
echo "Found enode: $enode"
enode_url=$(echo "$enode" | sed -E "s/@[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/@${BOOTNODE_IP}/")
return 0
fi
echo "No valid response, attempt $i of $retries. Retrying in $delay seconds..."
sleep $delay
done
echo "Failed to get a valid response from http://$BOOTNODE_IP:$BOOTNODE_RPC_PORT after $retries attempts."
return 1
}
if ! get_enode; then
echo "Error: Unable to retrieve enode URL from the bootnode."
exit 1
fi
echo "Using enode: $enode_url"
mkdir -p $ETH_DATA_DIR
reth init --datadir $ETH_DATA_DIR --chain $ETH_GENESIS_PATH && \
reth node \
--chain $ETH_GENESIS_PATH \
--http \
--http.addr '0.0.0.0' \
--discovery.port 30303 \
--http.api admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots \
--authrpc.addr '0.0.0.0' \
--authrpc.jwtsecret $JWT_PATH \
--datadir $ETH_DATA_DIR \
--trusted-peers $enode_url \