I've been trying to set up out geth client for the upcoming Merge on the Ropsten and Sepolia networks. There are many tutorials on the web that explain how to set it up on a server or a local machine. However things change slightly when docker comes into play, especially networking. Since forgetting the option
--authrpc.addr 0.0.0.0 costed me a near whole day of debugging, I wanted to share my final config.
Lesson learned: If you want cross-container communication you need to listen on all interfaces, not just on localhost, which is the default
The docker compose setup has both execution and consensus clients in the same file and I find it convenient. As the Execution Layer client I have go-ethereum (geth), and as the Consensus Layer client I have Lodestar. Here's the config:
1version: "3.8"23services:4 execution:5 image: ethereum/client-go:v1.10.206 container_name: geth-sepolia7 # --http.addr and --authrpc.addr 0.0.0.0 to listen on all interfaces and not just localhost. Localhost wouldn't work with containers as they have differt ip's.8 # add container name "geth-sepolia" to accepted --http.vhosts and --authrpc.vhosts9 # geth v1.10.20 already has terminaltotaldifficulty (TTD) built-in but leaving for networks that need explicit stating.10 # geth will open the authrpc and create a jwt if it detects merge i.e. TTD11 command: |12 --syncmode full --snapshot=false --sepolia --http --http.api engine,personal,eth,net,web313 --http.addr 0.0.0.0 --http.corsdomain '*' --http.vhosts "localhost,geth-sepolia"14 --override.terminaltotaldifficulty 17000000000000000 --authrpc.vhosts "localhost,geth-sepolia"15 --authrpc.jwtsecret /root/.ethereum/sepolia/geth/jwtsecret --authrpc.addr 0.0.0.016 ports: # Set the port you want to access the execution client RPC on your host. Here 854617 - "8546:8545"18 volumes: # You might have to mkdir ~/.ethereum19 - type: bind20 source: ~/.ethereum21 target: /root/.ethereum22 networks:23 - geth24 stop_grace_period: 3m # long grace period to avoid unclean shutdown25 restart: always2627 consensus:28 image: chainsafe/lodestar:v0.38.129 container_name: lodestar-sepolia30 # Shares the same root folder with geth. Can easily share the jwtsecret31 # execution.urls i.e. engine API, authrpc... The connection to the execution client32 # eth1.providerUrls for the execution JSON-RPC33 command: |34 beacon --network sepolia --rootDir /root/.ethereum --terminal-total-difficulty-override "17000000000000000"35 --execution.urls http://geth-sepolia:8551 --eth1.providerUrls http://geth-sepolia:8545 --jwt-secret /root/.ethereum/sepolia/geth/jwtsecret36 ports:37 - "9596:9596"38 volumes:39 - type: bind40 source: ~/.ethereum41 target: /root/.ethereum42 networks:43 - geth44 stop_grace_period: 3m45 restart: always4647networks:48 geth:4950volumes:51 sepolia: