|
| 1 | +# ethrex-replay |
| 2 | + |
| 3 | +A tool for executing and proving Ethereum blocks, transactions, and L2 batches — inspired by [starknet-replay](https://github.com/lambdaclass/starknet-replay). |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +> **Note:** All commands must be run from the `ethrex/cmd/ethrex_replay` directory. |
| 8 | +
|
| 9 | +### Dependencies |
| 10 | + |
| 11 | +#### [RISC0](https://dev.risczero.com/api/zkvm/install) |
| 12 | + |
| 13 | +```sh |
| 14 | +curl -L https://risczero.com/install | bash |
| 15 | +rzup install cargo-risczero 1.2.0 |
| 16 | +``` |
| 17 | + |
| 18 | +#### [SP1](https://docs.succinct.xyz/docs/sp1/introduction) |
| 19 | + |
| 20 | +```sh |
| 21 | +curl -L https://sp1up.succinct.xyz | bash |
| 22 | +sp1up --version 5.0.0 |
| 23 | +``` |
| 24 | + |
| 25 | +### Environment Variables |
| 26 | + |
| 27 | +Before running any command, set the following environment variables depending on the operation: |
| 28 | + |
| 29 | +```sh |
| 30 | +export RPC_URL=<RPC_URL> |
| 31 | +export BLOCK_NUMBER=<BLOCK_NUMBER> |
| 32 | +export BATCH_NUMBER=<BATCH_NUMBER> |
| 33 | +export TX_HASH=<TRANSACTION_HASH> |
| 34 | +export START_BLOCK=<START_BLOCK> |
| 35 | +export END_BLOCK=<END_BLOCK> |
| 36 | +export NETWORK=<mainnet|cancun|holesky|hoodi|sepolia|chainId> |
| 37 | +export L2=true |
| 38 | +``` |
| 39 | + |
| 40 | +#### Variable Descriptions |
| 41 | + |
| 42 | +- `RPC_URL`: Ethereum JSON-RPC endpoint used to fetch on-chain data. |
| 43 | +- `BLOCK_NUMBER`: Block number to replay. If unset, the latest block will be used. |
| 44 | +- `BATCH_NUMBER`: L2 batch number to execute or prove. |
| 45 | +- `TX_HASH`: Hash of the transaction to replay. |
| 46 | +- `START_BLOCK` / `END_BLOCK`: Defines the block range to analyze and plot. |
| 47 | +- `NETWORK`: Logical network name or chain ID. Defaults to `mainnet`. |
| 48 | +- `L2`: Set to `true` to run transactions in L2 mode. |
| 49 | + |
| 50 | +> You only need to set the variables required by the command you're running. |
| 51 | +
|
| 52 | +--- |
| 53 | + |
| 54 | +## Running Examples |
| 55 | + |
| 56 | +### Execute a single block (no proving) |
| 57 | + |
| 58 | +Required: `RPC_URL`. |
| 59 | +Optionally: `BLOCK_NUMBER`, `NETWORK` |
| 60 | + |
| 61 | +```sh |
| 62 | +make sp1 # SP1 (CPU) |
| 63 | +make sp1-gpu # SP1 (GPU) |
| 64 | +make risc0 # RISC0 (CPU) |
| 65 | +make risc0-gpu # RISC0 (GPU) |
| 66 | +``` |
| 67 | + |
| 68 | +### Prove a single block |
| 69 | + |
| 70 | +Required: `RPC_URL`. |
| 71 | +Optionally: `BLOCK_NUMBER`, `NETWORK`. |
| 72 | + |
| 73 | +```sh |
| 74 | +make prove-sp1 |
| 75 | +make prove-sp1-gpu |
| 76 | +make prove-risc0 |
| 77 | +make prove-risc0-gpu |
| 78 | +``` |
| 79 | + |
| 80 | +### Execute an L2 batch (no proving) |
| 81 | + |
| 82 | +Required: `RPC_URL`, `BATCH_NUMBER`, `NETWORK`. |
| 83 | + |
| 84 | +```sh |
| 85 | +make batch-sp1 |
| 86 | +make batch-sp1-gpu |
| 87 | +make batch-risc0 |
| 88 | +make batch-risc0-gpu |
| 89 | +``` |
| 90 | + |
| 91 | +### Prove an L2 batch |
| 92 | + |
| 93 | +Required: `RPC_URL`, `BATCH_NUMBER`, `NETWORK`. |
| 94 | + |
| 95 | +```sh |
| 96 | +make prove-batch-sp1 |
| 97 | +make prove-batch-sp1-gpu |
| 98 | +make prove-batch-risc0 |
| 99 | +make prove-batch-risc0-gpu |
| 100 | +``` |
| 101 | + |
| 102 | +### Execute a transaction |
| 103 | + |
| 104 | +Required: `RPC_URL`, `TX_HASH`, `NETWORK`. |
| 105 | +Optionally: `L2=true` (if the transaction is L2-specific) |
| 106 | + |
| 107 | +```sh |
| 108 | +make transaction |
| 109 | +``` |
| 110 | + |
| 111 | +### Plot block composition |
| 112 | + |
| 113 | +Required: `RPC_URL`, `START_BLOCK`, `END_BLOCK`. |
| 114 | +Optionally: `NETWORK` |
| 115 | + |
| 116 | +```sh |
| 117 | +make plot |
| 118 | +``` |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## Check All Available Commands |
| 123 | + |
| 124 | +Run: |
| 125 | + |
| 126 | +```sh |
| 127 | +make help |
| 128 | +``` |
0 commit comments