FABRKNT
Inside Revm — Reading the EVM Engine
Inside Revm
Lesson 1 of 17·CONTENT7 min15 XP

Treat this page as a workbench, not a blog post. The goal is to extract a reusable mental model from the source and carry it into the rest of the Fabrknt stack.

Course
Inside Revm — Reading the EVM Engine
Lesson role
CONTENT
Sequence
1 / 17

Lesson 0 — Welcome to Inside Revm

Question

Inside Revm = one of three Intermediate courses (Revm / Reth / Alloy). Revm is the execution engine every Rust EVM stack runs (Reth / Foundry / Hyperliquid / Tempo / Berachain). Same opcode loop / gas accounting / state-read discipline.

Principle (minimum model)

  • 3 Intermediate courses; recommended order: Alloy → Revm → Reth. Revm depends on Alloy types; Reth depends on Revm execution.
  • 3 topic chains. add Opcode (buildup → walkthrough → quiz → drill) / Custom Opcodes (build the instruction table; ship your own opcode) / Database trait (revm's state-providing abstraction).
  • Plus 3 bonus lessons. Revm Testing (state tests / EOF tests / execution-spec compliance), Parallel Execution (block-stm), JIT/AOT via revmc (the next-generation execution).
  • Read along. Open bluealloy/revm in another tab; verify every claim against source.
  • Prerequisites. Inside Alloy or intermediate Rust + light EVM primitives.

Worked example + steps

Welcome to Inside Revm — how this course works

Revm is the execution engine inside every Rust EVM client: Reth, Hyperliquid's HyperEVM, Berachain's bera-reth, Tempo. When a chain says "we run Revm," it means: the opcode loop, the gas accounting, the way state gets read — that's the same code, no matter whose fork you're looking at. Read it once and you can read all of them.

This is one of three independent Intermediate-tier courses on RethLab:

  • Inside Revm (you are here) — Inside the EVM engine
  • Inside Reth — Inside Reth: Staged Sync, ExEx, the Reth SDK
  • Inside Alloy — Inside Alloy: Provider, Network, Signer

Revm goes first because its types (Address, U256, B256, the Database trait) underpin most of what Reth and Alloy do. The three courses are independent — pick the one that matches what you're building.

📋 First time at the Intermediate tier? Read "How Intermediate courses work" at the end of Bridge to Intermediate before starting. It explains the editorial style (Predict prompts, Quiz gates, the build-up → walkthrough → quiz → drill chain shape) and pacing — applies to all three Intermediate courses, so you only read it once.

What this course teaches

You'll read the bluealloy/revm source line by line: the add opcode and the macro stack around it, custom opcodes and the instruction dispatch table, the Database trait that supplies state to the EVM. Three topic chains, each with build-up + walkthrough + quiz + drill.

By the end, you'll have read every line of revm's hot path and be able to explain what each piece does in your own words.

Prerequisites

EVM internals (covered in Bridge to Intermediate — go back if shaky):

  • Bytecode and the dispatch loop (opcodes as bytes, PC, instruction table)
  • Stack / memory / calldata / storage — what each is and how they differ
  • Cold vs warm gas (EIP-2929)
  • Call frames: CALL / DELEGATECALL / STATICCALL semantics
  • Block structure (header / body / receipts), reorgs as a normal phenomenon

Intermediate Rust (also Bridge to Intermediate; there's a Rust: lifetimes, Box, Arc, dyn Trait lesson inside Inside Reth for self-checking):

  • Generics with trait bounds, ?Sized, dyn Trait vs impl Trait
  • Arc<T>, Mutex<T>, RwLock<T> — when to use each
  • unsafe blocks and unwrap_unchecked()
  • macro_rules! syntax ($x:ident, $($x),*, fragment specifiers)

Setup — do this once

Before lesson 1, have these ready in another window:

  1. bluealloy/revm clonedgit clone https://github.com/bluealloy/revm
  2. A working cargo toolchainrustc --version should print something modern
  3. cargo-expandcargo install cargo-expand (you'll want it for the procedural macros lesson in Expert)
  4. A second monitor or split terminal — you'll be cross-referencing source while you read

The "Find in repo" prompts only work if you actually have the repos open. Close that loop before starting.

You're ready

Scroll back to the course detail and start with Building add step by step: signature and body.

After Inside Revm: head to Inside Reth for the Reth-specific sync pipeline + ExEx + SDK, or Inside Alloy when it's available.

Summary (3 lines)

  • Inside Revm = execution-engine deep dive; one of three Intermediate courses (Alloy → Revm → Reth recommended).
  • Three topic chains: add Opcode / Custom Opcodes / Database trait. Plus Testing + Parallel + JIT bonus lessons.
  • Verify against bluealloy/revm source. Prerequisites: Alloy or intermediate Rust.