Skip to content
LogoLogo

Guillotine

Guillotine is an Ethereum Virtual Machine written in Zig. It exists to make EVM execution fast, configurable at compile time, and embeddable from other languages through a C ABI (src/evm_c_api.zig).

Why another EVM?

Most EVMs are one implementation with runtime configuration. Guillotine takes a different bet: the EVM is a generic type parameterised by a comptime config struct, so the machine you get is specialised to exactly the semantics you asked for, with the branches you don't need compiled away.

const Evm = @import("evm").Evm;
 
// The defaults: Osaka rules, gas metering, fusion, and precompiles.
const Mainnet = Evm(.{});
 
// A Berlin EVM with gas checks disabled, for a fuzzer that only cares about
// stack/memory semantics. The gas accounting code is not in the binary.
const eips = @import("evm").Eips;
const Fuzzing = Evm(.{
    .eips = eips{ .hardfork = .BERLIN },
    .disable_gas_checks = true,
});

That single design decision drives most of what is distinctive about the codebase:

  • Dispatch-based execution, not a switch loop. Bytecode is analysed once into a dispatch schedule of function pointers plus inline metadata, then executed by tail calls. There is no switch (opcode) on the hot path and no program counter in the frame. See Dispatch.
  • Gas batched per basic block. Analysis computes the static gas cost of a whole basic block, so the interpreter charges once per block instead of once per instruction.
  • Opcode fusion. Common adjacent sequences (PUSH1 n; MSTORE, ISZERO; PUSH; JUMPI, a PUSH before a static JUMP) collapse into a single synthetic handler. See Synthetic opcodes.
  • A differential tracer built in. Every handler can be validated in lock-step against MinimalEvm, a plain, readable, switch-loop reference interpreter that lives in the same repository. See Tracing and debugging.

Two EVMs, one repository

Performance EVM (src/)MinimalEvm (src/tracer/)
Execution modelDispatch schedule + tail callsSequential switch over bytecode
Optimised forThroughputReadability and correctness
RoleThe productReference oracle for differential tests
SizeWhole src/ treeminimal_evm.zig, minimal_frame.zig, minimal_host.zig

They are not competitors. MinimalEvm is the thing that lets you trust the fast one: the tracer steps both machines forward together and asserts they agree on stack, memory, gas, and storage after every instruction. The standalone readable reference EVM is a separate repository, evmts/guillotine-mini.

Where to go next

Install the toolchain

Installation lists the prerequisites: stock Zig 0.17.1 (no compiler fork), a Rust toolchain for the vendored crypto wrappers, and a C compiler.

Run your first execution

Getting started walks through deploying runtime bytecode into an in-memory database and calling it, with a complete program you can copy verbatim.

Understand the machine

Architecture and Dispatch explain the execution model, which you will need if you plan to read or modify handlers.

Verify and benchmark

Testing and verification covers the EEST state tests, formal verification (SMT, LLVM IR, Lean 4), multi-layer fuzzing, and E2E SDK suites. Benchmarks and native JIT documents both the in-repo runner and the apples-to-apples cross-EVM suite.

Consume it from another language

Language bindings covers the FFI surface and the state of each SDK, honestly labelled.

Relationship to the rest of the stack

Guillotine is the execution engine at the bottom of the Tevm stack. If you are trying to work out whether you want this repository, Tevm, ZEVM, Voltaire, or guillotine-mini, read The stack first. It is a two-minute page that will save you an afternoon.