Merge F2F Interop Event: EthereumJS Client

tags: EthereumJS Merge Interop

Introduction

See Client Milestone Tracker for a general overview.

If you get a connection going - amazing! Let us know or mark it in the milestone tracker hackmd and find Ryan or Holger to try out Mx+1 🙂!

If you have any issues or logs to report please send to Ryan (@ralxz on telegram)

EthereumJS Setup

Please ensure you have Node 12.x+ installed (16.x preferred, 12.x+ should work fine)

  1. git clone --depth 1 --branch merge-contd-2 https://github.com/ethereumjs/ethereumjs-monorepo.git
  2. cd ethereumjs-monorepo
  3. npm i
  4. cd packages/client

Ports

Our JSON-RPC API for both eth_ and engine_ are currently served on port 8545 (if you'd like to change ports: --rpcport or --port for devp2p port. we will separate engine_ onto a different port as a next task)

Endpoints

We don't currently have the entire eth_ JSON-RPC API implemented, but have some key ones including eth_getBlockByNumber with latest and earliest. eth_getLogs currently mocked as an empty response (as a hack for Merge interop).

M2

1-to-1 Interop (no transition)

EthereumJS <-> Lodestar (M2)

First start the EthereumJS client:

npm run client:start -- --gethGenesis=./test/testdata/geth_genesis_merge_interop_taunas.json --rpc --rpcEngine --rpcport=8545 --loglevel=debug
  • (the ./test/testdata/geth_genesis_merge_interop_taunas.json file exists in the branch you checked out)

Install Lodestar following the Amphora instructions and run with:

./lodestar dev --genesisValidators 32 --startValidators 0:31 \
  --api.rest.enabled --api.rest.host 0.0.0.0 \
  --sync.isSingleNode \
  --eth1.enabled --eth1.providerUrls http://localhost:8545/ \
  --logFile beacon.log --logLevelFile debug --logRotate --logMaxFiles 5 \
  --params.SECONDS_PER_SLOT 4 \
  --params.ALTAIR_FORK_EPOCH 0 \
  --params.MERGE_FORK_EPOCH 0 \
  --params.TERMINAL_TOTAL_DIFFICULTY 0 \
  --genesisEth1Hash=0x9287c1b0a22416cd3122d466ad7d79f80886e028a596e6bb9d525c3e4de37709 \
  --execution.urls http://localhost:8545/

M3

1-to-1 Interop (with transition)

EthereumJS <-> Lodestar (M3)

You can use the following key pair for running the EthereumJS client and start mining:

Address: 0xf6b913c5747c0ae128adc0e41f0adfd88aff7bc9 Private key: 0x17eb958eb18cb2ecbf8ad26b9f008db9baa3d6dbf80ad949cf261f327e58ea6c

Run the EthereumJS client with:

npm run client:start -- --gethGenesis=./test/testdata/geth_genesis_merge_interop_taunas_own_signer.json --rpc --rpcEngine --rpcport=8545 --loglevel=debug --mine --unlock=0xf6b913c5747c0ae128adc0e41f0adfd88aff7bc9

When prompted unlock the miner account with the private key from above.

Start the Lodestar client with:

./lodestar dev --genesisValidators 32 --startValidators 0:31 \
  --api.rest.enabled --api.rest.host 0.0.0.0 \
  --sync.isSingleNode \
  --eth1.enabled --eth1.providerUrls http://localhost:8545/ \
  --logFile beacon.log --logLevelFile debug --logRotate --logMaxFiles 5 \
  --params.SECONDS_PER_SLOT 4 \
  --params.ALTAIR_FORK_EPOCH 0 \
  --params.MERGE_FORK_EPOCH 1 \
  --params.TERMINAL_TOTAL_DIFFICULTY 66 \
  --execution.urls http://localhost:8545/

Hacknet v2

For running an Eth2 client EthereumJS client combination on Hacknet v2 you need to clone the repository (git clone https://github.com/karalabe/hacknet.git), directory is assumed to be on the same level as the ethereumjs-monorepo directory.

EthereumJS / Lodestar

Update to the latest state of the merge-contd-2 branch (see above) with git pull merge-contd-2 and reinstall and build with npm i from the root of the monorepo. Then start the EthereumJS client with:

rm -Rf [DATA_DIRECTORY] && DEBUG=devp2p:eth npm run client:start -- --gethGenesis=../../../hacknet/v2/genesis.json --rpc --rpcEngine --rpcport=8545 --loglevel=debug --bootnodes=35.178.114.73:30303

Follow installing and running Loadstar from these instructions.

For more reproduceable results you might run with deleting the data folder before:

rm -Rf amphora/v2/temp/ && amphora/v2/run.sh

Mergemock

(WIP, have not gotten working on local yet -ryan)

Follow the quick start instructions.

Update genesis.json and set terminalTotalDifficulty to 37179869184

Run client with:

npm run client:start -- --gethGenesis=../../../mergemock/genesis.json --rpc --rpcEngine --rpcport=8545 --loglevel=debug

Copy the enode:// from this logged line:

INFO [10-08|10:30:07] Listener up transport=rlpx url=enode://0da614598ab5996889fc6f28983a1169e3508e8e07f0c1102fa55f7d7c047678c98465721a414b97a158673f49456bb138d45376d373c9b5593eb028241df935@[::]:30303

and replace [::] with 0.0.0.0

Run mergemock with:

./mergemock consensus --engine="http://localhost:8545" --slot-time="5s" --ttd=37179869184 --node="enode://0da614598ab5996889fc6f28983a1169e3508e8e07f0c1102fa55f7d7c047678c98465721a414b97a158673f49456bb138d45376d373c9b5593eb028241df935@0.0.0.0:30303"
Select a repo