Use case · FFI

Embedding the EVM in your stack

Sometimes you need EVM execution inside your own application — a simulator, a testing harness, a fee estimator, an indexer, or a custom runtime — without adopting a full Ethereum client. Zig EVM is built for exactly that.

One core, four languages

Zig EVM exports a stable C ABI from src/ffi.zig. On top of it sit ready-made bindings so you can embed the same execution core wherever you work:

Example: Python

from zigevm import EVM

evm = EVM()
evm.execute(bytecode)   # runs with accurate gas metering

Why embed Zig EVM specifically

The core is small and readable — each opcode is its own file — so it is easy to audit and extend. Gas metering matches Ethereum, and the same binary powers the playground, so what you embed behaves like what you test. See the features for the full API surface, or how it works for the execution model.

FAQ

How does Zig EVM expose itself to other languages?

It exports a stable C ABI from src/ffi.zig. Every binding — Python, Rust, JavaScript and C — calls through that ABI, so behaviour is identical across languages.

Do I need to know Zig to embed it?

No. Use the Python (ctypes), Rust, JavaScript (N-API) or C binding for your project. You create an EVM instance, load bytecode and execute — no Zig required unless you want to modify the core.