Set up Goerli node
This is a step-by-step guide to setting up a full node on the Goƫrli testnet to act as the Layer 1 (L1).
Requirements¶
Before starting the setup, you will need at least 500 GB of free disk space to allocate a full Goerli node.
Next, make sure you have the following commands installed:
- wget
- jq
- docker
sudo apt update -y
sudo apt install -y wget jq docker.io
sudo usermod -aG docker $USER
newgrp docker && newgrp $USER
Additionally, you will need an L1 Goerli address to proceed with the setup that will act as the suggested fee recipient. Make sure you have this address provisioned.
Preparation¶
-
Create a directory for your Goerli node:
mkdir -p ~/goerli-node/docker-volumes/{geth,prysm}
-
Create a
docker-compose.yml
file and open it for editing:cd ~/goerli-node/ vim docker-compose.yml
-
Copy and paste the following content into the
docker-compose.yml
file:services: geth: image: "ethereum/client-go:stable" container_name: goerli-execution command: | --goerli --http --http.vhosts=* --http.rpcprefix=/ --http.corsdomain=* --http.addr 0.0.0.0 --http.api eth,net,engine,admin --config=/app/config.toml volumes: - "./docker-volumes/geth:/root/.ethereum" - "./config.toml:/app/config.toml" ports: - "0.0.0.0:${L1_RPC_PORT}:8545" - "0.0.0.0:30303:30303/udp" prysm: image: "gcr.io/prysmaticlabs/prysm/beacon-chain:stable" container_name: goerli-consensus command: | --prater --datadir=/data --jwt-secret=/geth/goerli/geth/jwtsecret --rpc-host=0.0.0.0 --grpc-gateway-host=0.0.0.0 --monitoring-host=0.0.0.0 --execution-endpoint=/geth/goerli/geth.ipc --accept-terms-of-use --suggested-fee-recipient=${L1_SUGGESTED_FEE_RECIPIENT_ADDR} --checkpoint-sync-url=${L1_CHECKPOINT_URL} volumes: - "./docker-volumes/prysm:/data" - "./docker-volumes/geth:/geth" ports: - "0.0.0.0:3500:3500" - "0.0.0.0:4000:4000" - "0.0.0.0:12000:12000/udp" - "0.0.0.0:13000:13000" depends_on: - geth
-
Save and Close the
docker-compose.yml
file. -
Create an
.env
file and open it for editing:cd ~/goerli-node/ vim .env
-
Set the following environment variables in the
.env
file:L1_RPC_PORT=8845 L1_SUGGESTED_FEE_RECIPIENT_ADDR=0x # Put your Goerli account address L1_CHECKPOINT_URL=https://goerli.checkpoint-sync.ethpandaops.io
-
Save and Close the
.env
file. -
Add geth config.toml file with following values to increase RPC timeouts
cd ~/goerli-node/ vim config.toml
[Node.HTTPTimeouts] ReadTimeout = 600000000000 ReadHeaderTimeout = 600000000000 WriteTimeout = 600000000000 IdleTimeout = 1200000000000
Deploy¶
-
Start the compose services:
cd ~/goerli-node/ docker compose --env-file /root/goerli-node/.env -f /root/goerli-node/docker-compose.yml up -d
-
Check the logs of the prysm service to monitor the synchronization progress:
docker compose --env-file /root/goerli-node/.env -f /root/goerli-node/docker-compose.yml logs -f prysm --tail 20
Info
Wait for the initial sync to complete. You will see log messages similar to the following indicating the progress:
#goerli-consensus | time="2023-06-19 09:39:44" level=info msg="Synced up to slot 5888296" prefix=initial-sync
-
Check the logs of the geth service to monitor the initial download and sync progress:
docker compose --env-file /root/goerli-node/.env -f /root/goerli-node/docker-compose.yml logs -f geth --tail 20
This process may take a couple of hours. Look for log messages similar to the following indicating the progress:
#goerli-execution | INFO [06-19|09:43:24.954] Syncing beacon headers downloaded=25600 left=9,177,918 eta=1h5m31.860s
#goerli-execution | INFO [06-19|10:09:19.488] Syncing: state download in progress synced=0.30% state=331.34MiB [email protected] slots=1,112,[email protected] [email protected] >
Validation¶
Once both service logs show the sync completion and new blocks are being updated, you can verify the correctness of the RPC by making a call. For example, to get the current block number, use the following command:
printf "%d\n" $(curl -s -X POST --header "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' http://localhost:8845 | jq -r .result)
If everything is correctly set up, you should see the current block number returned.
Congratulations! You have successfully set up your own full node on the Goerli testnet. You can now use this node to perform transactions and interact with the Goerli network.