# Testnet guide: extract MEV with Prysm post-merge This documents the necessary steps to run [Prysm](https://github.com/prysmaticlabs/prysm) beacon client and validator client for MEV extraction. It's important to keep in mind that these are prototypes so expect [breakages and bugs](https://github.com/prysmaticlabs/prysm/issues?q=is%3Aissue+is%3Aopen+label%3ABuilder). The instructions will likely change later and we'll update them along the way. With that said, we are months away from the merge, and **now** is a crucial time to begin testing MEV as an end-to-end product from validator to beacon node to mev-boost to relayer and to a builder. ## Optional readings on the why what and how https://writings.flashbots.net/writings/beginners-guide-mevboost/ https://writings.flashbots.net/writings/why-run-mevboost/ [lightclient - Extracting MEV After the Merge](https://www.youtube.com/watch?v=ci7pLez8eDk) [Bulder API spec](https://github.com/ethereum/builder-specs/tree/main/apis/builder) ## Prysm images To build from source. Please use latest [develop](https://github.com/prysmaticlabs/prysm/tree/develop) branch To use dockers. Here are the docker images: Beacon client: gcr.io/prysmaticlabs/prysm/beacon-chain:v2.1.4-rc.2 Validator client: gcr.io/prysmaticlabs/prysm/validator:v2.1.4-rc.2 ## Instructions on how to run testnets [Installation guide](https://docs.prylabs.network/docs/install/install-with-script/) [Fee recipient guide](https://docs.prylabs.network/docs/execution-node/fee-recipient/) There are two ways to set up your fee recipient. One way is `--suggested-fee-recipient` with `--enable-builder`. This means every validator will use that fee recipient. Another way is through a config file. This enables customization. Example: ``` { "proposer_config": { "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a": { "fee_recipient": "0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3", "builder": { "enabled": true, "gas_limit": 30000000 } }, "default_config": { "fee_recipient": "0x6e35733c5af9B61374A128e6F85f553aF09ff89A", "builder": { "enabled": true, "gas_limit": 30000000 } } } ``` ## ⚠️ Additional flags For your testnet beacon client, you will want to point them to the existing relays. Flashbots has kindly provided us with these relays for testing. Kiln: https://builder-relay-kiln.flashbots.net Ropsten: https://builder-relay-ropsten.flashbots.net Sepolia: https://builder-relay-sepolia.flashbots.net On your testnet beacon client. Add the `--http-mev-relay` flag Example for Sepolia: `--http-mev-relay=https://builder-relay-sepolia.flashbots.net --sepolia` On your testnet validator . Add the `--enable-builder` flag Example for Sepolia: `--suggested-fee-recipient=0xD9A5179F091d85051d3C982785Efd1455CEc8699 --sepolia --enable-builder` ## Running your own mev-boost The `above section` utilizes direct connection to relay. This is not intended for production. In production, beacon node should connect the `mev-boost`. Visit [mev-boost](https://github.com/flashbots/mev-boost) on further details on how to connect those twos. ## Validations Now you have set up your beacon client and validators. You launched them and they are working. How do you know that MEV extraction is working as intended? On validator client. We want to see the following log. It should occur during start-up and every epoch ``` Submitted builder validator registration settings for custom builders ``` Examples: ```json= {"backend":null,"duration":9487420858,"message":"gRPC request finished.","method":"/ethereum.eth.v1alpha1.BeaconNodeValidator/SubmitValidatorRegistration","severity":"DEBUG"} {"message":"Submitted builder validator registration settings for custom builders","prefix":"validator","severity":"INFO"} ``` On beacon client. We want to see the following logs when your validator proposes a block. ``` Retrieved header from builder Retrieved full payload from builder ``` Examples: ```json {"blockHash":"0x24fed5a50492d0592bdc974943931cd53ba713c35ec749baeb2dd75d10a0fb33","feeRecipient":"0xd9a5179f091d85051d3c982785efd1455cec8699","gasUsed":0,"message":"Retrieved header from builder","prefix":"rpc/validator","severity":"INFO","slot":875293} {"beaconStateRoot":"0xb91ad0e06759435225b9369de656282c43ef5e0b8a15f6cb7dec93431575412c","message":"Computed state root","prefix":"rpc/validator","severity":"DEBUG"} {"blockHash":"0x24fed5a50492d0592bdc974943931cd53ba713c35ec749baeb2dd75d10a0fb33","feeRecipient":"0xd9a5179f091d85051d3c982785efd1455cec8699","gasUsed":0,"message":"Retrieved full payload from builder","prefix":"rpc/validator","severity":"INFO","slot":875293,"txs":0} {"blockRoot":"69124129eafae6d5b01aa43c8b7934e8d8ad79b0fbbdd0378f5808520c2d2642","message":"Broadcasting block","prefix":"rpc/validator","severity":"DEBUG"} ``` Congrats! With those logs, you have successfully tested MEV extraction with Prysm prototype. This is not the final product, we have many enhacements on the pipeline. We'll give periodic updates along the way. If you run into any issues or have any questions. Please ping me @terencechain on TG or terence#0083 on Discord. With issues and questions. Please open issues in respected repos: Prysm issue: https://github.com/prysmaticlabs/prysm/issues MEV-boost issue https://github.com/flashbots/mev-boost/issues Builder issue: https://github.com/ethereum/builder-specs/issues