# Prysm Merge Interop M2 :panda_face: ## 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](https://docs.prylabs.network/docs/install/install-with-bazel/). 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](https://github.com/ethereum/execution-apis/blob/main/src/engine/interop/specification.md). For prototyping, we currently are maintaining our own fork which implements the go bindings on top of consensus API. Please checkout the following branch then run the following commands below: https://github.com/terencechain/go-ethereum/tree/merge-interop-spec The genesis.json for the below can be found here: https://notes.ethereum.org/@9AeMAlpyQYaAAyuj47BzRw/rkwW3ceVY ```bash= make ./build/bin/geth --catalyst --datadir "/tmp/taunus" init genesis.json ./build/bin/geth --catalyst --http --ws -http.api "engine,eth,net" --datadir "/tmp/taunus" ``` To explore more on execution engine APIs, check out the following [test vectors](https://notes.ethereum.org/@9AeMAlpyQYaAAyuj47BzRw/rkwW3ceVY) written by Marius van der Wijden. ## Before running Prysm, define merge config file To satisfy [M2](https://hackmd.io/_9XZIkDBTlqGJejVnOSOJg?view#Milestones) milestone, we choose to simulate 2 network upgrades. From *Phase0* to *Altair* then to *Merge*. We also utilize [terminal-block-hash override feature](https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/client-settings.md) for transitioning to the Merge. Please save the following yml to `/tmp/merge.yml` file, it will be pointed by the beacon node later. ```yml ALTAIR_FORK_EPOCH: 1 MERGE_FORK_EPOCH: 2 TERMINAL_BLOCK_HASH: 0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a ``` ## 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 ``` 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 ``` 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): ![](https://i.imgur.com/9oYOJv9.jpg) A video recording of what it looks like after 4 epochs: https://drive.google.com/file/d/1RMV03ATYY63teBNloR7vI2OfvbbiAUHV/view?usp=sharing ## 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: * Consensus specs: https://github.com/ethereum/consensus-specs/tree/v1.1.0/specs/merge * Engine API spec: https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.2/src/engine/interop/specification.md