Skip to content
kaan
uz
dogan

Docker Compose Execution and Consensus Client Setting for Ethereum Merge (PoS)

Ethereum, Merge, Proof of Stake, PoS, Docker1 min read

Docker Compose Execution and Consensus Client Setting for Ethereum Merge (PoS)

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"
2
3services:
4 execution:
5 image: ethereum/client-go:v1.10.20
6 container_name: geth-sepolia
7 # --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.vhosts
9 # 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. TTD
11 command: |
12 --syncmode full --snapshot=false --sepolia --http --http.api engine,personal,eth,net,web3
13 --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.0
16 ports: # Set the port you want to access the execution client RPC on your host. Here 8546
17 - "8546:8545"
18 volumes: # You might have to mkdir ~/.ethereum
19 - type: bind
20 source: ~/.ethereum
21 target: /root/.ethereum
22 networks:
23 - geth
24 stop_grace_period: 3m # long grace period to avoid unclean shutdown
25 restart: always
26
27 consensus:
28 image: chainsafe/lodestar:v0.38.1
29 container_name: lodestar-sepolia
30 # Shares the same root folder with geth. Can easily share the jwtsecret
31 # execution.urls i.e. engine API, authrpc... The connection to the execution client
32 # eth1.providerUrls for the execution JSON-RPC
33 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/jwtsecret
36 ports:
37 - "9596:9596"
38 volumes:
39 - type: bind
40 source: ~/.ethereum
41 target: /root/.ethereum
42 networks:
43 - geth
44 stop_grace_period: 3m
45 restart: always
46
47networks:
48 geth:
49
50volumes:
51 sepolia: