An Ethereum Virtual Machine written in Zig, built around a register-passing tailcall dispatch engine.
Status: v0.1.1 (Beta). Passes 100% of official Ethereum Execution Spec Tests (66,652 / 66,652, Frontier through Osaka, fusions on and off), 116,384 / 116,384 Zig↔Lean 4 differential fuzz vectors, 55 #audit_proof-audited Zean direct Zig 0.17.1 AIR → Lean 4.35.0 theorems (24 real Zig kernels), 78 / 78 SMT proofs, and 19 / 19 LLVM IR proofs.
Instead of a bytecode while + switch loop, Guillotine analyzes contract bytecode once into a flat schedule of 8-byte untagged dispatch items (Dispatch.Item). Basic blocks batch static gas and stack bounds checks up front, jump targets resolve through an O(1) dense bitmap table, and common opcode sequences (PUSH+ADD, ISZERO+PUSH+JUMPI, DUP+MSTORE, inline multi-limb PUSH9–PUSH32) fuse into single handlers.
Each opcode handler is a preserve_none tailcall (@call(.always_tail, ...), native in stock Zig 0.17.1) that keeps the hot interpreter state — frame pointer, schedule cursor, stack pointer, and remaining gas — live in callee registers with zero prologue/epilogue spills. Execution state uses O(1) undo-log database snapshots and pooled per-depth stack and memory buffers so nested calls avoid allocation churn.
- Full mainnet hardfork coverage: Frontier through Prague/Pectra and Osaka/Fusaka (EIP-7702, EIP-7623, EIP-4844, EIP-2537 BLS12-381, EIP-2935, EIP-7951 P256VERIFY, EIP-7610, Osaka CLZ & ModExp).
- Base & OP Stack L2 execution: Bedrock through Jovian (
src/layer2/) running on fork-configured GuillotineEvminstances, including EIP-2930 access lists, EIP-7702 authorization lists on Isthmus/Jovian, L1 data fees, operator fees, and deposit transactions. - Fast native precompiles: Pure-Zig GLV + batch-Safegcd secp256k1
ECRECOVER(28.9 µs), hardware-acceleratedSHA256(1.25 µs), CIOS-squaringMODEXP, BN254 multi-Miller loop, all 7 EIP-2537 BLS12-381 ops directly onblst(4.04 µs), KZG 4844 viac-kzg-4844, and SIMD calldata token counting. - Dual Lean
4.35.0formal verification (Zean + Lean 4) + SMT + LLVM IR: Direct Zig0.17.1AIR → Lean 4 proofs via Zean (verify/zean/,verify/lean/GuillotineZean/, 24 real functions / 55#audit_proof-audited theorems), hand-authored Lean 4 models & executable spec (verify/lean/GuillotineVerify/,GuillotineSpec/), 116,384-vector Zig↔Lean differential fuzzer, 78 fail-closed SMT theorems (verify/smt/), andReleaseFastLLVM IR equivalence & poison/UB checking (verify/llvm/). - Four supported surfaces: Native Zig package (
dep.module("evm")), C ABI (libguillotine_ffi+sdks/c/include/guillotine.h), EVMC v12 (zig build evmc), and TypeScript SDK (@tevm/guillotine, Node.js ≥ 20 Node-API + Bun ≥ 1.1 FFI,341 / 341tests). - Three-Tier Adaptive Execution & Deterministic Block-STM: Tier 0 zero-allocation cold baseline interpreter with backward-jump OSR (
src/frame/baseline_interpreter.zig), Tier 1 single-passpreserve_nonefused dispatch (src/preprocessor/dispatch.zig), Tier 2 zero-LLVM native AArch64 + x86_64 JIT (src/jit/), and opt-in deterministic Block-STM parallel block execution (src/block/). Seedocs/performance/THREE-TIER-EXECUTION.md.
See evm2 stable and nightly on Linux for paired warm and cold results across all 25 microbenchmarks and the 100-block replay.
Reproducible, in-process comparison (zero CLI startup overhead, 0-tolerance gas + byte-for-byte output differential gate across all 25 workloads and 12 engine configs; 21 fixtures verbatim from alloy-rs/evm2 + 4 hot loops) on Apple M3 Max (macOS arm64, Zig 0.17.1 preserve_none + fusions, Rust 1.100.0, Apple Clang 17.0.0, Go 1.26.0):
| Warm Interpreter | Lang | Overall vs revm |
Overall vs evm2 |
Classic (7) vs revm |
Mainnet DeFi (9) vs revm |
snailtracer |
burntpix |
uniswap_v3_pool |
fibonacci |
|---|---|---|---|---|---|---|---|---|---|
| Guillotine | Zig | 1.78× | 1.61× | 2.18× | 1.92× | 31.53 ms | 17.53 ms | 8.17 µs | 12.21 µs |
| Guillotine (no fusion) | Zig | 1.64× | 1.47× | 1.89× | 1.70× | 35.87 ms | 20.66 ms | 9.54 µs | 15.67 µs |
| evm2 | Rust | 1.11× | 1.00× | 1.08× | 1.00× | 64.03 ms | 53.09 ms | 16.67 µs | 51.00 µs |
| revm | Rust | 1.00× | 0.90× | 1.00× | 1.00× | 81.23 ms | 67.21 ms | 19.77 µs | 56.83 µs |
| gevm | Go | 0.98× | 0.88× | 0.94× | 1.02× | 91.31 ms | 76.29 ms | 23.27 µs | 60.17 µs |
| evmone (Baseline) | C++ | 0.77× | 0.69× | 0.95× | 0.45× | 69.98 ms | 63.18 ms | 33.46 µs | 55.46 µs |
| ethrex (LEVM) | Rust | 0.76× | 0.68× | 0.80× | 0.69× | 81.05 ms | 67.62 ms | 21.79 µs | 61.42 µs |
| evmone (Advanced) | C++ | 0.50× | 0.45× | 0.79× | 0.18× | 99.48 ms | 79.04 ms | 92.88 µs | 53.33 µs |
| geth | Go | 0.33× | 0.30× | 0.39× | 0.17× | 137.53 ms | 119.38 ms | 69.58 µs | 86.31 µs |
Tier 2 Native JIT (guillotine-jit, zero LLVM, 20 / 20 contracts compiled natively): uniswap_v3_pool 4.29 µs (848 µs compile vs evm2-jit 5.75 µs / 3.09 s and revmc 5.63 µs / 1.43 s), curve_stableswap 23.13 µs (103 µs compile vs 23.96 µs / 333 ms), burntpix 8.39 ms (886 µs compile vs revmc 8.61 ms / 3.61 s), snailtracer 20.43 ms (348 µs compile vs evm2-jit 19.94 ms / 1.81 s — 5,200× faster compile).
Full warm, cold first-run (0.85× vs revm, #1 cold on snailtracer/burntpix/erc20_transfer/hash_10k/loop_memory/loop_storage), Tier 2 JIT, and differential audit tables: bench/compare/RESULTS.md · bench/compare/report.html · bench/compare/README.md.
Measured with zig build bench -- --iterations 100 --warmup 10 in ReleaseFast on Apple M3 Max (macOS arm64, Zig 0.17.1, preserve_none tailcall + fusions):
| Workload | Fork | Median | Throughput | Notes |
|---|---|---|---|---|
contract/snailtracer |
Prague | 20.92 ms |
11.28 GGas/s |
Full raytracer workload |
contract/Factorial |
Osaka | 0.73 µs |
27.63 GGas/s |
Tight arithmetic loop |
contract/Fibonacci |
Osaka | 0.79 µs |
25.61 GGas/s |
Stack + control flow |
contract/Uniswap-like-swap |
Osaka | 1.04 µs |
22.29 GGas/s |
Storage + arithmetic mix |
contract/BubbleSort |
Osaka | 2.42 µs |
11.98 GGas/s |
Memory-heavy loop |
precompile/SHA256-1KiB |
Osaka | 1.25 µs |
49.49 GGas/s |
Hardware ARMv8 SHA2 / x86 SHA-NI |
precompile/MODEXP-256 |
Osaka | 1.54 µs |
16.02 GGas/s |
CIOS-squaring + windowed Montgomery |
precompile/BN254-mul |
Osaka | 6.13 µs |
4.47 GGas/s |
GLV scalar multiplication |
precompile/ECRECOVER |
Osaka | 28.92 µs |
874.92 MGas/s |
Pure-Zig secp256k1 GLV + batch Safegcd |
Offline replay of 100 contiguous Ethereum mainnet blocks against cached pre-state (Osaka / BPO2, 29,560 transactions, 2,973,053,521 gas, 23,932 true pre-start accounts, 64,755 storage slots, 5,030 unique contracts, pinned in bench/blocks/manifest.json) on Apple M3 Max (node bench/blocks/run-all.mjs --iterations 5 --warmup 1), executing EIP-4788/2935/7002/7251 system calls, legacy/2930/1559/4844/7702 transactions, and EIP-4895 withdrawals:
| Engine & Mode | Cold (100 blocks) | Warm median (100 blocks) | Warm ms/block | Throughput | Tx rate | vs revm |
Receipt parity |
|---|---|---|---|---|---|---|---|
| Guillotine (1T, #1 single-threaded) | 1,806.16 ms |
1,242.49 ms |
12.42 ms |
2,392.8 MGas/s |
23,791 tx/s |
1.33× |
29,560 / 29,560 (100.00%) |
evm2 (1T) |
1,330.30 ms |
1,331.19 ms |
13.31 ms |
2,233.4 MGas/s |
22,206 tx/s |
1.25× |
29,560 / 29,560 (100.00%) |
revm (1T) |
1,677.20 ms |
1,657.64 ms |
16.58 ms |
1,793.6 MGas/s |
17,833 tx/s |
1.00× |
29,560 / 29,560 (100.00%) |
gevm (1T) |
1,847.92 ms |
1,842.00 ms |
18.42 ms |
1,614.0 MGas/s |
16,048 tx/s |
0.90× |
29,560 / 29,560 (100.00%) |
ethrex (1T) |
1,993.08 ms |
1,974.24 ms |
19.74 ms |
1,505.9 MGas/s |
14,973 tx/s |
0.84× |
29,560 / 29,560 (100.00%) |
geth (1T) |
2,446.92 ms |
2,365.67 ms |
23.66 ms |
1,256.8 MGas/s |
12,495 tx/s |
0.70× |
29,560 / 29,560 (100.00%) |
Guillotine Block-STM (--threads 4, opt-in) |
966.64 ms |
728.50 ms |
7.29 ms |
4,081.1 MGas/s |
40,577 tx/s |
2.28× |
29,560 / 29,560 (bit-exact vs 1T) |
Guillotine Block-STM (--threads 8, opt-in) |
931.46 ms |
664.82 ms |
6.65 ms |
4,471.9 MGas/s |
44,463 tx/s |
2.49× |
29,560 / 29,560 (bit-exact vs 1T) |
Reproduce locally:
$ zig build bench # in-repo ReleaseFast suite
$ rustup toolchain install 1.100.1 nightly-2026-11-28 --profile minimal --no-self-update
$ ./bench/compare/build-all.sh && node bench/compare/run.mjs # 25-workload cross-EVM suite
$ ETHEREUM_RPC_URL=https://... node bench/blocks/fetch.mjs --start 26498000 --count 100
$ node bench/build-evm2.mjs blocks
$ node bench/blocks/run-all.mjs --iterations 5 --warmup 1 # single-threaded 100-block replay
$ zig build bench-blocks -- --threads 8 --iterations 5 --warmup 1 # opt-in deterministic Block-STM replay| Layer | Result | Command |
|---|---|---|
Official EEST state tests ([email protected], fusions ON) |
66,652 / 66,652 (100.00%) |
zig build state-tests -Doptimize=ReleaseSafe |
Official EEST state tests ([email protected], fusions OFF) |
66,652 / 66,652 (100.00%) |
zig build state-tests -Doptimize=ReleaseSafe -Devm-enable-fusion=false |
Zean direct Zig 0.17.1 AIR → Lean 4.35.0 proofs |
24 captured kernels / 55 #audit_proof theorems (0 sorry) |
zig build verify-zean |
Hand-authored Lean 4.35.0 proofs & differential fuzzer |
5 proof modules + 116,384 / 116,384 (0 mismatches) |
zig build verify-lean && FUZZ_ITERS=2000 zig build test-lean-diff -Doptimize=ReleaseSafe |
| SMT bitvector proofs (Bitwuzla + Z3) | 78 / 78 theorems proved (unsat) |
zig build verify-smt |
| Full formal verification suite (LLVM IR + SMT + Lean + Zean) | 19 / 19 IR pairs, 78 SMT, 5 Lean & 6 Zean modules |
zig build verify (verify-ir, verify-smt, verify-lean, verify-zean) |
| Core Zig suites (unit, opcodes, fusions, precompiles, L2, fuzz, JIT) | 5,324 / 5,324 passing (L2 160, JIT 177 AArch64+x86_64) |
zig build test |
| Multi-threaded havoc fuzz campaign | 0 open crashes (.fuzz-crashes/) |
zig build fuzz-campaign -Doptimize=ReleaseSafe -- --seconds=60 --threads=8 |
| C SDK & Rust workspace E2E | 100% passing | make -f sdks/c/Makefile -o build-core test && cargo test --locked |
TypeScript SDK (@tevm/guillotine, Node-API & Bun FFI) |
341 / 341 tests on both backends |
cd sdks/typescript && bun test && bun run test:fuzz |
16,907 Amsterdam EEST cases are skipped because Amsterdam is not yet finalized/implemented. Fetch the pinned fixtures first with ./scripts/fetch-eest-fixtures.sh. Full methodology and CI coverage are documented in Testing and verification and Benchmarks and native JIT.
Add Guillotine to your build.zig.zon:
$ zig fetch --save=guillotine https://github.com/evmts/guillotine/archive/refs/tags/v0.1.1.tar.gzWire the evm module in your build.zig:
const guillotine = b.dependency("guillotine", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("evm", guillotine.module("evm"));
exe.root_module.addImport("voltaire", guillotine.module("voltaire"));Execute bytecode:
const std = @import("std");
const evm = @import("evm");
const voltaire = @import("voltaire");
pub fn main() !void {
var gpa = std.heap.DebugAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
var db = evm.Database.init(allocator);
defer db.deinit();
var vm = try evm.MainnetEvm.init(
allocator,
&db,
.{
.chain_id = 1,
.number = 1,
.timestamp = 1700000000,
.difficulty = 0,
.gas_limit = 30_000_000,
.coinbase = voltaire.ZERO_ADDRESS,
.base_fee = 0,
.prev_randao = @splat(0),
},
.{ .gas_limit = 1_000_000, .coinbase = voltaire.ZERO_ADDRESS, .chain_id = 1 },
0,
voltaire.ZERO_ADDRESS,
);
defer vm.deinit();
const target = voltaire.Address.fromU256(0xc0);
// PUSH1 2, PUSH1 3, ADD, PUSH1 0, MSTORE, PUSH1 32, PUSH1 0, RETURN
const code = [_]u8{ 0x60, 0x02, 0x60, 0x03, 0x01, 0x60, 0x00, 0x52, 0x60, 0x20, 0x60, 0x00, 0xf3 };
const code_hash = try db.set_code(&code);
var acct = evm.Account.zero();
acct.code_hash = code_hash;
try db.set_account(target.bytes, acct);
var res = vm.call(.{ .call = .{
.caller = voltaire.Address.fromU256(0xa1),
.to = target,
.value = 0,
.input = &.{},
.gas = 100_000,
} });
defer res.deinit(allocator);
}import { Address, Bytes, GuillotineEvm, U256 } from '@tevm/guillotine'
using evm = await GuillotineEvm.create()
const alice = Address.fromHex('0x00000000000000000000000000000000000000a1')
const contract = Address.fromHex('0x00000000000000000000000000000000000000c0')
// PUSH1 2, PUSH1 3, ADD, PUSH1 0, MSTORE, PUSH1 32, PUSH1 0, RETURN
await evm.setCode(contract, Bytes.fromHex('0x600260030160005260206000f3'))
const result = await evm.call({
caller: alice,
to: contract,
value: U256.zero(),
input: Bytes.empty(),
gas: 100_000n,
})
console.log(result.success, U256.fromBytes(result.output.toBytes()).toBigInt()) // true 5nBuild the shared library with zig build shared -Doptimize=ReleaseFast -Dstrip=true (or grab a prebuilt binary from Releases), include sdks/c/include/guillotine.h, and link -lguillotine_ffi:
#include <string.h>
#include "guillotine.h"
int main(void) {
guillotine_init();
BlockInfoFFI block = {
.number = 1, .timestamp = 1700000000,
.gas_limit = 30000000, .chain_id = 1, .base_fee = 1,
};
EvmHandle *evm = guillotine_evm_create(&block);
uint8_t addr[20] = {0};
addr[19] = 0xc0;
uint8_t code[] = {0x60, 0x02, 0x60, 0x03, 0x01, 0x60, 0x00, 0x52, 0x60, 0x20, 0x60, 0x00, 0xf3};
guillotine_set_code(evm, addr, code, sizeof(code));
CallParams params = {0};
memcpy(params.to, addr, 20);
params.gas = 100000;
params.call_type = GUILLOTINE_CALL;
EvmResult *res = guillotine_call(evm, ¶ms);
guillotine_free_result(res);
guillotine_evm_destroy(evm);
guillotine_cleanup();
return 0;
}Rather than maintaining stale wrapper packages for every language, Guillotine ships a stable C ABI plus a guide and agent skill for generating native bindings (Python, Go, Rust, Swift, Kotlin):
- Guide: docs/building-custom-sdks.md
- Agent skill: .agents/skills/guillotine-sdk-builder/SKILL.md
Prerequisites:
- Zig
0.17.1(stock toolchain;preserve_nonetailcalls are built in, no compiler fork needed) - Rust stable (builds the BN254/BLS12-381 static crypto wrappers automatically via
build.zig) - Bun (optional, for
sdks/typescript) - Lean
4.35.0, Zean (okcontract/zean), and Bitwuzla / Z3 (optional, forverify-zean,verify-lean,verify-ir, andverify-smt)
Common commands (run from repository root):
$ zig build # build libraries and tools
$ zig build test # unit, opcode, integration, L2, precompile, fusion, modexp, fuzz
$ zig build shared -Doptimize=ReleaseFast -Dstrip=true
$ zig build state-tests -Doptimize=ReleaseFast
$ zig build bench
$ zig build fuzz-campaign -Doptimize=ReleaseSafe -- --seconds=30Incremental subsystem builds and benchmarks are also wired as Smithers targets (PACKAGE.ts, smthrs test //bench:report).
- Site: guillotine.tevm.sh
- Architecture & internals: docs/dev/ARCHITECTURE.md
- Changelog: CHANGELOG.md
- Contributor rules & engineering standards: AGENTS.md
