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:
- Three-tier adaptive execution & online Ski-Rental JIT. Cold contracts run with zero schedule
allocation in a
preserve_nonetail-call Tier 0 interpreter, hot basic blocks compile incrementally into a fused Tier 1 dispatch schedule, and opt-in Tier 2 compiles hot contracts directly to AArch64 or x86_64 machine code in microseconds (zero LLVM dependency) using self-calibrating Ski-Rental admission and optional async background workers. See Three-tier adaptive execution and How the native JIT works. - 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, aPUSHbefore a staticJUMP) collapse into a single synthetic handler. See Synthetic opcodes. - Multi-chain EVMs, Layer 2, Post-Quantum & Block-STM. Opt-in multi-core
Block-STM execution (
evm.block, C ABI v4,@tevm/guillotine) delivers bit-exact serial consensus parity;layer2ships Base mainnet tip (Bedrock through Azul/Beryl/Cobalt/Denim stateful native precompiles & 200 msBaseTime), OP Stack (Bedrock–Jovian), and experimental Arbitrum Nitro;chainsprovides a comptime multi-chain framework with 7EvmProfilesand Polygon PoS (137/80002); andBOGOTAimplements EIP-8141 Frame Transactions plus opt-in PQ precompiles. See Parallel block execution, Layer 2 chains, Multi-chain EVMs, and Post-quantum & Hegotá. - CI-enforced memory safety & differential tracing. Every production Zig allocation/free
(
724scopes) and all30Rust FFI exports are machine-checked in CI (MEMORY.md), and every handler can be validated in lock-step againstMinimalEvm, a plain switch-loop reference interpreter in the same repository. See Memory safety and audit and Tracing and debugging.
Two EVMs, one repository
Performance EVM (src/) | MinimalEvm (src/tracer/) | |
|---|---|---|
| Execution model | Dispatch schedule + tail calls | Sequential switch over bytecode |
| Optimised for | Throughput | Readability and correctness |
| Role | The product | Reference oracle for differential tests |
| Size | Whole src/ tree | minimal_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, dual Lean 4 formal verification (Zean direct Zig 0.17.1 AIR → Lean 4.35.0 proofs alongside hand-authored Lean 4 proofs & executable spec, plus SMT and LLVM IR), 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.