A readable EVM,
written in Zig
One Evm type, one call() entry point, hardforks from Frontier through Osaka, EIP-3155 tracing, a flat C ABI, and a WASI Preview 1 WebAssembly reactor with linked crypto precompiles.
zig build test-trace && zig build wasm && zig build test-wasm
const std = @import("std");
const guillotine = @import("guillotine_mini");
const voltaire = @import("voltaire");
pub fn main() !void {
const Evm = guillotine.Evm(.{});
var vm: Evm = undefined;
try vm.init(std.heap.page_allocator, null, .CANCUN, null, voltaire.ZERO_ADDRESS, 0, null);
defer vm.deinit();
// PUSH1 0x2a PUSH1 0x00 MSTORE PUSH1 0x20 PUSH1 0x00 RETURN
const target = voltaire.Address.fromU256(0x42);
try vm.code.put(target, &.{ 0x60, 0x2a, 0x60, 0x00, 0x52, 0x60, 0x20, 0x60, 0x00, 0xF3 });
const result = vm.call(.{ .call = .{
.caller = voltaire.ZERO_ADDRESS,
.to = target,
.value = 0,
.input = &.{},
.gas = 100_000,
} });
// result.success == true, result.gas_left == 99_982 (18 gas used), output == 32-byte word 0x2a
}Why Guillotine Mini exists
Production EVMs optimize for block throughput: bytecode is fused into superinstructions, gas is hoisted across basic blocks, and the correspondence to the specification disappears. That is the right trade for a mainnet node and the wrong trade when you need to verify what the Ethereum specification actually requires.
Guillotine Mini takes the opposite side:
- Spec-first. The Python
execution-specsare the authority. Gas is charged in the same order, in the same place. - Small enough to read in an afternoon. State orchestration lives in
src/evm.zig; the bytecode loop lives insrc/frame.zig; external state crosses an 11-pointer vtable insrc/host.zig. - Three delivery surfaces. Use it as a Zig module, link
libguillotine_mini.aover C FFI, or instantiateguillotine_mini.wasm(a WASI Preview 1 reactor with BN254, BLS12-381, SHA256, and KZG compiled in). - Zero hidden ownership. Transaction-scoped allocations live in an arena owned by
Evmand are released together indeinit().
Choose your path
Getting Started
Wire up Zig 0.15.2 + Voltaire, execute your first bytecode, and account for every unit of gas.
Hands-On Tutorials
Visual walkthroughs for contract calls, snapshots, custom hosts, and WebAssembly — complete with puzzles and traces.
WebAssembly (WASI)
Run the EVM and linked crypto precompiles from Node 22+ with zero npm dependencies.
C ABI & Async FFI
Embed libguillotine_mini.a from C, Rust, Go, or Python — including yield/resume external state injection.
EIP-3155 Tracing
Capture bounded opcode traces, export JSON, and diff step-by-step against Python execution-specs.
API Reference
Exact signatures, defaults, error sets, and build targets transcribed directly from src/*.zig.
What it is not
Guillotine Mini is an execution engine, not a full node. Block headers, transaction signatures, the mempool, JSON-RPC, and devp2p live one layer up in Guillotine. Public APIs are pre-1.0 and may shift between revisions.
Current status
- Native Zig (
0.15.2):zig build,zig build native, andzig build test-tracepass cleanly. Core EVM unit tests pass; the 5TrieTestsfixture tests (client/trie/fixtures.zig) inzig build unitrequire the optionalethereum-testssubmodule. - WebAssembly (
wasm32-wasi):zig build wasmbuildszig-out/bin/guillotine_mini.wasm(WASI Preview 1 reactor with linked Rust crypto), andzig build test-wasmverifies execution, reverts, logs, SHA256, BN254 pairing, and BLS12-381 precompiles on Node 22+. - Hardforks: Frontier through Osaka, including EIP-1153 transient storage, EIP-4844 blobs, EIP-6780
SELFDESTRUCT, EIP-7702 set-code delegation, BLS12-381 (0x0B–0x11), OsakaCLZ(0x1E), andP256VERIFY(0x0100).