Prerequisites
- monad version
0.12.3or later - Credentials and configuration to read from your chosen archive source (AWS, R2, MongoDB, MinIO,
etc.). These are the same credentials used by
monad-archiver; see Running an Archive Server for details.
Setup
1. Prepare the block database directory
Choose a directory to store EVM-format historical blocks. This guide refers to it asblock-db.
2. Initialize triedb
Create an emptytriedb:
3. Start the block writer
Run insidetmux or create a systemd service to download blocks continuously:
monad-archiver, for example
"aws mainnet-deu-009-0" or "mongodb ...".
The block writer will:
- Download all blocks from the source
- Transform them into EVM format
- Brotli-compress the data
- Write blocks into subdirectories of the form
block-db/XM/<block_number>, whereX = block_number / 1_000_000(one million blocks per directory)
latest file in the block-db directory. If the
process stops, on the next startup it reads latest and compares it against the latest block
available from the --block-data-source, then continues from that point.
4. Configure the replay service
Whilemonad-block-writer is running, add the following systemd override for monad-execution
in a separate terminal:
Ensure
$CHAIN is defined in your environment. Valid options:ethereum_mainnetmonad_devnetmonad_testnetmonad_mainnet
--block-db-timeout sets the number of seconds the replay service will wait for new blocks
to appear in the block database. If the timeout is reached without new blocks, the replay service
will crash and be restarted by systemd. If this happens, verify that the block writer from step 3
is still running and writing blocks to disk. Set to 0 to disable retries.
5. Reload and start
Running RPC on a replay host
If you want to runmonad-rpc on this host, you must remove the --ipc-path flag from the
monad-rpc systemd configuration.
