Lesson 9 — Revm — the execution engine
Question
Revm = the Rust EVM execution engine. Reth, Foundry, Hyperliquid, Tempo, Berachain — anywhere in the Rust ecosystem you need to execute EVM, you find Revm. Why Revm, and what does it provide as a library?
Principle (minimum model)
- Revm is a library. Not a chain, not a node — just an EVM execution engine. Reth adds state + consensus; Foundry adds a test harness.
- Modular design. Interpreter / instruction table / Database trait / Inspector are all independent and swappable. Hyperliquid adds custom precompiles; MEV bots observe via Inspector.
- Database trait. The abstraction over state. HashMap (testing) / JSON-RPC (mainnet fork) / MDBX (production) all conform to the same trait.
- Adopted by Foundry / Reth / OP-Reth / zkVMs / MEV bots. Anywhere Rust meets EVM, Revm is the shared substrate.
- Inside Revm course (Intermediate). Walks add / instruction table / Database trait line by line. This lesson is the entry point.
Worked example + steps
Revm — the execution engine
You've seen Alloy (the outer RPC layer) and now know the EVM is a stack machine. The next character is Revm — the engine that actually runs opcodes.
Where Revm fits
+----------------+
| Reth | ← Full node (sync, storage, consensus)
+----------------+
| Revm | ← Execution engine (this layer)
+----------------+
| Database / DB | ← State (Trie, KV)
+----------------+
Revm's actual top-level API
Revm exports these high-level types (crates/revm/src/lib.rs):
| Type | Role |
|---|---|
MainnetEvm | the prebuilt Ethereum mainnet EVM |
ExecuteEvm, ExecuteCommitEvm | run a transaction (commit = also write state changes back) |
SystemCallEvm | system-level calls (e.g., post-Cancun BEACONROOT) |
InspectEvm, InspectCommitEvm | tracing variants — same execution, with hooks |
Context | the execution environment (block, tx, cfg) |
Journal, JournalEntry | state-change tracking (used for revert) |
Database, DatabaseRef, DatabaseCommit | the storage interfaces (covered in Intermediate) |
Inspector | trait you implement to hook into execution |
The key insight: Revm is modular by design. ExecuteEvm, InspectEvm, ExecuteCommitEvm aren't different EVMs — they're the same engine composed with different layers. You pick what you need.
What Revm provides
- Opcode interpretation (the Interpreter)
- State access trait (
Database) - Gas accounting and exception handling
- Logs and tracing via Inspectors
Why Revm became the standard
| Adopter | Use |
|---|---|
| Foundry | Solidity test runner, mainnet fork simulation |
| Reth | The execution engine of the full node |
| OP-Reth, Tempo | L2s and App-chains |
| zkEVMs (Risc0, etc.) | Provable EVM execution |
| MEV / simulation | Anywhere you need to re-execute fast |
The combination of "library-first design," "Rust embeddability," and "easy customization" is what locked in adoption.
Next
You now know enough to start reading Revm code. The next lesson introduces Foundry — the Rust EVM toolchain you'll actually use day-to-day. Then the Intermediate tier opens the interpreter folder.
📺 Further watching
xRuDWTWuxKA | Dragan Rakita — Revm Endgame (Devcon SEA 2024)
Summary (3 lines)
- Revm = Rust EVM execution engine (library). Adopted by Reth / Foundry / Hyperliquid / Tempo / Berachain as a shared substrate.
- Modular: interpreter + instruction table + Database + Inspector are independent. Database trait abstracts HashMap / JSON-RPC / MDBX behind one type.
- Inside Revm Intermediate course deep-dives the internals. Next: Foundry toolchain.