owned this note changed 3 years ago
Published Linked with GitHub

Prysm Merge Interop M3
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Requirement

You will need Bazel version 3.7.0 to build Prysm from source. You can find full information on how to build Prysm from source here. Once you have Bazel 3.7.0 installed, you can check with the following to verify prysm beacon node and validator can build:

git clone -b merge-oct https://github.com/prysmaticlabs/prysm.git && cd prysm
bazel build //beacon-chain:beacon-chain
bazel build //validator:validator

Run Geth

Prysm currently uses go bindings on top of newly defined exeuction engine APIs. For prototyping, we currently are maintaining our own fork which implements the go bindings on top of consensus API.
Please checkout the following branch:
https://github.com/terencechain/go-ethereum/tree/merge-interop-spec

To satisfy M3 milestone, we need the execution client to build up the PoW chain so the instructions will be different than M2 before. Refer genesis.json and sk.json in the following link:
https://notes.ethereum.org/_UH57VUPRrC-re3ubtmo2w

Then run the following commands:

make ./build/bin/geth --catalyst --http --ws -http.api "engine" --datadir "~/ethereum/taunus" init genesis.json ./build/bin/geth --catalyst --http --ws -http.api "engine" --datadir "~/ethereum/taunus" account import sk.json ./build/bin/geth --catalyst --http --ws -http.api "engine,eth,net" --datadir "~/ethereum/taunus" --allow-insecure-unlock --unlock "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" --password "" --nodiscover console

In the geth console start the miner:

miner.start()

Before running Prysm, define merge config file

To satisfy M3 milestone, we choose to simulate 2 network upgrades. From Phase0 to Altair then to Merge. We also utilize terminal total difficulty override feature to be specified in the beacon node CLI. For transitioning to the Merge, please save the following yml to /tmp/merge.yml file, it will be pointed by the beacon node later.

ALTAIR_FORK_EPOCH: 1
MERGE_FORK_EPOCH: 2

Run Prysm

To kick off an interop chain, we first need to generate a Phase0 genesis state. In this example, we generate a genesis state with 256 validators

bazel run //tools/genesis-state-gen -- --num-validators=256 --output-ssz=/tmp/genesis.ssz --mainnet-config

Then we start beacon node using the interop genesis state and interop mode
(Note: we set --terminal-total-difficulty-override 10 at the end)

bazel run //beacon-chain -- --datadir /tmp/chaindata --force-clear-db --interop-genesis-state /tmp/genesis.ssz --interop-eth1data-votes --min-sync-peers=0 --http-web3provider=http://localhost:8545 --deposit-contract 0x8A04d14125D0FDCDc742F4A05C051De07232EDa4  --bootstrap-node= --chain-config-file=/tmp/merge.yaml --terminal-total-difficulty-override 10

Finally we start validator client with 256 keys using interop mode

bazel run //validator -- --beacon-rpc-provider localhost:4000 --interop-num-validators=256 --interop-start-index=0 --force-clear-db --chain-config-file=/tmp/merge.yaml

Result

A screenshot of what it looks like from running beacon node (left), validator client (middle), and execution client (right):
(Note: Key logs are terminal difficulty reached(left) and Entered PoS Stage(right) )

Contribution

Want to contribute? Check out: https://github.com/prysmaticlabs/prysm/pull/9754

Have questions? Join our Discord: https://discord.gg/gwWGStWR

Spec readings? Check out:

Select a repo