2023-07-20 15:31:29 +03:00
UNLOCK_ACCOUNTS = ""
2023-11-21 10:31:52 +01:00
UNLOCK_ARGS = ""
2023-07-20 15:31:29 +03:00
if [ -n " $UNLOCK_START_INDEX " ] ; then
INDEX = 0
END_INDEX = $(( $UNLOCK_START_INDEX + $UNLOCK_NUMBER ))
while read p; do
if [ " $INDEX " -ge " $UNLOCK_START_INDEX " ] ; then
if [ " $INDEX " -lt " $END_INDEX " ] ; then
cat passwordsource >> passwordfile
UNLOCK_ACCOUNTS = $( echo $UNLOCK_ACCOUNTS $( echo $p | cut -d ',' -f 1) , )
fi
fi
INDEX = $(( $INDEX + 1 ))
done <accounts.csv
UNLOCK_ARGS = "--unlock " $UNLOCK_ACCOUNTS " --password passwordfile"
fi
echo "Starting geth..."
2023-11-15 14:45:07 +01:00
PUBLIC_IP_ARGS = ""
2023-11-21 10:31:52 +01:00
if [ [ -n " ${ NAT_PUBLIC_IP_AUTO } " ] ] ; then
# Run for 60 seconds if fail
WAIT = 60
SECONDS = 0
SLEEP = 5
2023-11-21 12:02:27 +01:00
while ( ( $SECONDS < $WAIT ) ) ; do
2023-11-21 10:31:52 +01:00
PUBLIC_IP_ARGS = --nat= extip:$( curl -s -f -m 5 " ${ NAT_PUBLIC_IP_AUTO } " )
# Check if exit code is 0 and returned value is not empty
[ [ $? -eq 0 && -n " ${ PUBLIC_IP_ARGS } " ] ] && { echo " Public: Set extip: ${ PUBLIC_IP_ARGS } " ; break; } || { echo " Can't get Public IP - Retry in $SLEEP seconds / $(( WAIT - SECONDS)) " ; }
# Sleep and check again
sleep $SLEEP
done
2023-11-15 14:45:07 +01:00
fi
2023-07-20 15:31:29 +03:00
if [ -n " $ENABLE_MINER " ] ; then
MINER_ARGS = "--mine --miner.etherbase 0x10420A3dE36231E12eb601F45b4004311372dcEa"
else
rm -Rf /root/.ethereum/geth
fi
echo " UNLOCK_ARGS: $UNLOCK_ARGS "
echo " MINER_ARGS: $MINER_ARGS "
echo " GETH_ARGS: $GETH_ARGS "
2023-11-15 14:45:07 +01:00
echo " PUBLIC_IP_ARGS: $PUBLIC_IP_ARGS "
2023-07-20 15:31:29 +03:00
geth init genesis.json
2023-11-15 14:45:07 +01:00
geth --networkid 789988 --http --http.addr 0.0.0.0 --allow-insecure-unlock --http.vhosts '*' $UNLOCK_ARGS $MINER_ARGS $PUBLIC_IP_ARGS $GETH_ARGS
2023-07-20 15:31:29 +03:00
exit 0