Migrating a long-running Ethereum private testnet from Proof of Work (PoW) to Proof of Stake (PoS) using The Merge upgrade is a significant but achievable task. Since you're running Geth v1.11.6, which predates the actual Ethereum mainnet Merge (which happened in September 2022), your node doesn’t natively support PoS consensus.
To achieve this, you’ll need to:
✅ Goals:
Upgrade your network and client(s) to support The Merge .
Define a fork block (Merge activation block) where PoS takes over.
Set up a Beacon Chain node (for PoS).
Transition your execution layer (Geth) to coordinate with the beacon chain.
🧰 Tools You'll Need
Geth (latest version supporting The Merge)
Beacon Chain Client : e.g., Lighthouse , Nimbus , Teku , etc.
A custom genesis.json file for your network
Validator keys (for bootstrapping PoS)
🔁 Step-by-Step Guide to Migrate Your Private Network to PoS via The Merge
🔹 Step 1: Upgrade Geth
You are currently on v1.11.6 , which does not support The Merge . You must upgrade to at least v1.12.0 , or preferably the latest stable release.
bash Copy code
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum
git checkout master
make geth
Now verify:
bash Copy code
./build/bin/geth version
# Should be >= v1.12.0
🔹 Step 2: Update Genesis File for The Merge
You will need to update your existing genesis.json file to include the terminal total difficulty (TTD) and the Merge fork block number .
Example additions to genesis.json:
json Copy code
"config": {
...
"terminalTotalDifficulty": 1000000000,
"terminalTotalDifficultyPassed": true,
"mergeForkBlock": 12345678
}
⚠️ Important:
mergeForkBlock: This is the block number where the network switches to PoS.
terminalTotalDifficulty: Must be higher than your current chain's total difficulty at that block. Set it to something high like 1000000000.
If you're unsure about the TTD value, set "terminalTotalDifficultyPassed": true so Geth assumes TTD has already been passed.
Then initialize your chain again:
bash Copy code
./build/bin/geth --datadir ./chaindata init genesis.json
🔹 Step 3: Run Execution Layer (Geth)
Start your Geth node with the following flags:
bash Copy code
./build/bin/geth \
--datadir ./chaindata \
--networkid YOUR_NETWORK_ID \
--http \
--http.addr 0.0.0.0 \
--http.port 8545 \
--http.api "eth,net,web3,personal,debug" \
--http.corsdomain "*" \
--nodiscover \
--maxpeers 10 \
--http.vhosts "*" \
--syncmode full \
--gcmode archive \
--allow-insecure-unlock
This starts the execution layer node ready for coordination with a beacon chain.
🔹 Step 4: Choose & Set Up a Beacon Chain Client
You’ll need to run a consensus client (e.g., Lighthouse, Teku, Nimbus) as the beacon chain node .
Here’s an example using Lighthouse :
bash Copy code
lighthouse \
--testnet-dir ./custom_testnet \
bn \
--datadir ./beacondata \
--execution-endpoint http://localhost:8551 \
--execution-jwt-secret ./jwtsecret \
--port 9000 \
--http-port 5052 \
--discovery-port 9000 \
--http \
--network none \
--chain-id 1337 \
--min-genesis-active-validator-count 1 \
--min-genesis-time <UNIX_TIMESTAMP>
Note: You must create a custom testnet config directory (--testnet-dir) containing files like:
deposit_contract.deployed.json
genesis.ssz
config.yaml
boot_enr.yaml (optional)
You can generate these using tools like lcli or manually.
🔹 Step 5: Generate Validator Keys
To activate PoS, you need validator keys . Use interop tools or deposit generators.
Example using Lighthouse:
bash Copy code
lighthouse \
--testnet-dir ./custom_testnet \
interop \
gen-deposit-data \
--validatormax 1 \
--dep-chain-id 1337 \
--dep-network-name "PrivatePoA"
Import validator keys into your beacon node.
🔹 Step 6: Coordinate Between Execution and Consensus Layers
Ensure both Geth and the beacon node communicate via:
Engine API : Geth exposes this on port 8551 by default.
JWT Secret : Create a JWT secret file:
bash Copy code
openssl rand -hex 32 > jwtsecret
Pass this same file to both Geth and the beacon node.
🔹 Step 7: Monitor the Transition
Once the chain reaches the mergeForkBlock, Geth will stop producing PoW blocks and wait for the beacon chain to produce blocks.
Check logs:
Geth should show: Switching to proof-of-stake mode
Beacon node should start proposing blocks
📝 Summary Checklist
Task Status ✅ Upgrade Geth to v1.12+ ✔️ ✅ Modify genesis.json with TTD and Merge fork block ✔️ ✅ Initialize chain with updated genesis ✔️ ✅ Run Geth with Engine API enabled ✔️ ✅ Generate validator keys and setup beacon node ✔️ ✅ Configure JWT shared secret between layers ✔️ ✅ Monitor transition to PoS ✔️
🧪 Testing Tips
Start with a small private net (e.g., 1 validator).
Use dev-friendly tools like lcli, ethereum-genesis-generator, or custom scripts.
Consider using Docker if managing multiple clients.
📚 Resources
💬 Need Help?
If you'd like help generating a custom genesis file or setting up validator keys, feel free to share your current genesis or desired parameters — I can assist further.
Would you like a sample genesis file configured for The Merge?