2024-07-02 06:14:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
MINER_KEY=""
|
|
|
|
MINE_CONTRACT=""
|
|
|
|
BLOCKCHAIN_RPC=""
|
|
|
|
FLOW_CONTRACT=""
|
|
|
|
BLOCK_NUMBER=0
|
|
|
|
PUBLIC_IP=$(curl -s https://ipinfo.io/ip)
|
|
|
|
|
|
|
|
FILE=run/config.toml
|
|
|
|
|
|
|
|
# enable sync
|
|
|
|
sed -in-place='' 's/# \[sync\]/\[sync\]/g' $FILE
|
|
|
|
# enable auto_sync
|
|
|
|
sed -in-place='' 's/# auto_sync_enabled = false/auto_sync_enabled = true/g' $FILE
|
|
|
|
# reduce timeout for finding peers
|
2024-07-03 00:22:02 +00:00
|
|
|
sed -in-place='' 's/# find_peer_timeout = .*/find_peer_timeout = "10s"/g' $FILE
|
2024-07-02 06:14:17 +00:00
|
|
|
# set public ip
|
2024-07-03 00:22:02 +00:00
|
|
|
sed -in-place='' "s/# network_enr_address = .*/network_enr_address = \"$PUBLIC_IP\"/g" $FILE
|
2024-07-02 06:14:17 +00:00
|
|
|
# set miner key
|
|
|
|
sed -in-place='' "s/miner_key = \"\"/miner_key = \"$MINER_KEY\"/g" $FILE
|
|
|
|
# set miner contract address
|
2024-07-03 00:22:02 +00:00
|
|
|
sed -in-place='' "s/mine_contract_address = .*/mine_contract_address = \"$MINE_CONTRACT\"/g" $FILE
|
2024-07-02 06:14:17 +00:00
|
|
|
# set blockchain rpc endpoint
|
2024-07-03 00:22:02 +00:00
|
|
|
sed -in-place='' "s|blockchain_rpc_endpoint = .*|blockchain_rpc_endpoint = \"$BLOCKCHAIN_RPC\"|g" $FILE
|
2024-07-02 06:14:17 +00:00
|
|
|
# set flow contract address
|
2024-07-03 00:22:02 +00:00
|
|
|
sed -in-place='' "s/log_contract_address = .*/log_contract_address = \"$FLOW_CONTRACT\"/g" $FILE
|
2024-07-02 06:14:17 +00:00
|
|
|
# set contract deployed block number
|
2024-07-03 00:22:02 +00:00
|
|
|
sed -in-place='' "s/log_sync_start_block_number = .*/log_sync_start_block_number = $BLOCK_NUMBER/g" $FILE
|
2024-07-02 07:36:34 +00:00
|
|
|
# update the boot node ids
|
2024-07-03 00:22:02 +00:00
|
|
|
sed -in-place='' 's|network_boot_nodes = .*|network_boot_nodes = ["/ip4/54.219.26.22/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJxQWu3i1FL1aFYeh9wiQTNu4pDCgps","/ip4/52.52.127.117/udp/1234/p2p/16Uiu2HAkzRjxK2gorngB1Xq84qDrT4hSVznYDHj6BkbaE4SGx9oS","/ip4/18.167.69.68/udp/1234/p2p/16Uiu2HAm2k6ua2mGgvZ8rTMV8GhpW71aVzkQWy7D37TTDuLCpgmX"]|g' $FILE
|