diff --git a/fantom/Dockerfile-fullnode b/fantom/Dockerfile-fullnode index aecc58d2..4f76ad34 100644 --- a/fantom/Dockerfile-fullnode +++ b/fantom/Dockerfile-fullnode @@ -2,7 +2,7 @@ FROM golang:1.19-alpine as builder # Install packages we need -RUN apk add --no-cache make gcc musl-dev linux-headers git openssl +RUN apk add --no-cache make gcc musl-dev linux-headers git openssl xxd # Make a folder to work in RUN mkdir /fantom diff --git a/fantom/scripts/entrypoint-fullnode.sh b/fantom/scripts/entrypoint-fullnode.sh index 3c443c2c..2d387dd6 100644 --- a/fantom/scripts/entrypoint-fullnode.sh +++ b/fantom/scripts/entrypoint-fullnode.sh @@ -16,7 +16,14 @@ fi # uncomment the next line and do docker-compose build in case you have to try to fix the db after unclean shutdown etc. # opera --db.preset pbl-1 --datadir=$FANTOM_HOME db heal --experimental -[ -f /config/nodekey ] || openssl rand -hex 32 > /config/nodekey +# Generate nodekey only if it doesn't exist +if [ ! -f /config/nodekey ]; then + echo "Generating new Geth node key..." + openssl rand 32 | xxd -p -c 32 | tr -d '\n' > /config/nodekey + echo "Node key generated: $(cat /config/nodekey)" +else + echo "Node key already exists, skipping generation." +fi opera \ --genesis=$FANTOM_HOME/mainnet-171200-no-history.g \