-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tutorial on how to run the basic builder
- Loading branch information
1 parent
67bd97f
commit 87c3c5d
Showing
1 changed file
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,121 @@ | ||
# `mev-build-rs` | ||
|
||
how to run the builder | ||
This repository provides a basic builder which can submit blocks to [`mev-boost` relays](https://boost.flashbots.net) using the [Relay APIs](https://flashbots.github.io/relay-specs/). | ||
|
||
The builder is built as an extension to the [`reth`](https://github.com/paradigmxyz/reth) execution layer (EL) client and also requires a consensus layer (CL) client to run. | ||
|
||
The default builder simply uses `reth`'s local mempool when sourcing transactions. | ||
|
||
## Installation | ||
|
||
### Build from source | ||
|
||
The best way to run the builder right now is to build this project from source. | ||
|
||
#### Prerequisites | ||
|
||
Follow the steps [here under `Dependencies`](https://paradigmxyz.github.io/reth/installation/source.html#dependencies). | ||
|
||
#### Build `mev-rs` | ||
|
||
You can install the `mev-rs` binary, named `mev`, with the following steps: | ||
|
||
*Note*: the builder has been verified as of this commit `bf3d41f026e9728233dd3e1c40e75c49b9ae00b3`. No guarantees about other states of the repository currently. | ||
|
||
```sh | ||
git clone https://github.com/ralexstokes/mev-rs | ||
cd mev-rs | ||
cargo install --locked | ||
``` | ||
|
||
The `cargo install` command should place the `mev` binary under the default `.cargo/bin` folder which is also in your `PATH` following the suggested Rust installation process. | ||
|
||
## Run the builder | ||
|
||
Once installed, we are ready to run the builder. | ||
|
||
### Syncing nodes | ||
|
||
Before we can run the builder, we need to sync a CL and EL node pair on our target network. | ||
|
||
The remainder of this document will assume we are building for the `sepolia` network. | ||
|
||
*Note*: repository has only been tested on the **Sepolia** network and there is no guarantee the builder works on other networks. | ||
|
||
The builder requires a synced CL client like [Lighthouse](https://github.com/sigp/lighthouse/). | ||
You can find instructions on [how to sync a `lighthouse` node here](https://lighthouse-book.sigmaprime.io). | ||
|
||
*Note*: repository has only been tested with **Lighthouse** and there is no guarantee other CLs will work. | ||
|
||
Doing the initial/bulk sync from the `mev` builder should be possible, but has not been tested. | ||
|
||
The recommended approach will be to run `reth` (ideally built from source at the same commit pinned in this repo) for the target network alongside the CL until the pair has reached the head of the chain. | ||
|
||
Example commands utilizing [checkpoint sync following the Lighthouse book](https://lighthouse-book.sigmaprime.io/run_a_node.html) to do this: | ||
|
||
1. Make the JWT secret (refer to the Lighthouse guide for more info). | ||
|
||
2. [recommended] Obtain a checkpoint sync URL if you wish to use this sync mode. | ||
|
||
3. Run `reth`: | ||
```sh | ||
reth --chain sepolia \ | ||
node \ | ||
--http \ | ||
--authrpc.jwtsecret $JWT_SECRET_FILE_PATH | ||
```` | ||
|
||
4. Run `lighthouse`: | ||
```sh | ||
lighthouse --network sepolia \ | ||
bn \ | ||
--http \ | ||
--execution-endpoint http://localhost:8551 \ | ||
--execution-jwt $JWT_SECRET_FILE_PATH \ | ||
--disable-deposit-contract-sync \ | ||
--checkpoint-sync-url $CHECKPOINT_SYNC_PROVIDER | ||
``` | ||
|
||
The pair should start syncing. Once the pair of nodes is fully synced you can stop `reth` and run the `mev` builder in its place. | ||
|
||
### Run the builder on a synced chain | ||
|
||
To run the `mev` builder, first you should make the appropriate configuration. You can make a local copy of `example.config.toml` to get started. | ||
|
||
To configure the builder, you can edit the fields under the `[builder]` key of the TOML. | ||
|
||
Fields you should change: | ||
|
||
* `execution_mnemonic`: update to a seed phrase of an ethereum wallet you control. | ||
This wallet will be used to author payment transactions to the proposer and also is used as the source of funds for any subsidy value you wish to add to the block. | ||
You can select a particular index (following BIP-39) by terminating the seed phrase with a `:N` and integer index `N`. Otherwise the builder will just use the first index from the key tree. | ||
* `subsidy_gwei`: set this value to 0 if your execution layer address has no ETH in it; otherwise, the blocks will be invalid. | ||
* `jwt_secret_path`: ensure this value matches the one used previously when doing the initial sync. | ||
|
||
Once the configuration looks good, you can run the builder as follows alonside `lighthouse`. | ||
|
||
*Note*: `lighthouse` has some initial configuration to ensure the builder always receives head updates from the chain. | ||
|
||
1. Run `mev` with config file `config.toml`: | ||
```sh | ||
mev --network sepolia build config.toml | ||
``` | ||
|
||
2. Run `lighthouse`: | ||
```sh | ||
lighthouse --network sepolia \ | ||
bn \ | ||
--http \ | ||
--execution-endpoint http://localhost:8551 \ | ||
--execution-jwt $JWT_SECRET_FILE_PATH \ | ||
--disable-deposit-contract-sync \ | ||
--checkpoint-sync-url $CHECKPOINT_SYNC_PROVIDER | ||
--always-prepare-payload | ||
--suggested-fee-recipient $FEE_RECIPIENT | ||
``` | ||
|
||
### Additional notes | ||
|
||
* The `--suggested-fee-recipient` for `lighthouse` is ultimately not used, but currently required to run the node. Any valid address should do and it should not affect the builder. | ||
* If you are seeing slow or lagging operation, you can try to adjust the preparation lookahead with the `--prepare-payload-lookahead` option on `lighthouse`. | ||
* The builder has been tested on an AWS EC2 instance of `t3.xlarge` variety with a `512Gb` disk. |