Runtime model & hardforks
TEVM runs on a single codebase across Node.js, browsers, Web Workers, Cloudflare Workers, Deno, and Bun by separating the zero-dependency TypeScript engine wrapper (@tevm/node) from the underlying JSON-RPC backend.
Backend selection by runtime
Section titled “Backend selection by runtime”@tevm/node contains no static Node.js built-in imports. At initialization time, createZevmEngine() resolves its backend in this order:
- Explicit
backend: If you passbackend: { rpc, close }, TEVM uses it directly and never touches@evmts/zevm. Duringready(), TEVM checkseth_chainIdagainstchainId(if supplied) and fails initialization if they differ. - Explicit
wasm: If you passwasm: trueorwasm: ArrayBuffer | ArrayBufferView | WebAssembly.Module, TEVM instantiates@evmts/zevm/browser’s compiledzevm.wasmreactor in any runtime (including Node.js, Bun, Deno, browsers, and edge workers). - Automatic Node.js native addon: When neither
backendnorwasmis set inside Node.js (>= 22.12), TEVM loads@evmts/zevmdynamically throughprocess.getBuiltinModule('node:module')and spawns a native ZigNodeRuntime. - Automatic browser/worker WASM: When neither
backendnorwasmis set outside Node.js, TEVM loads@evmts/zevm/browserautomatically unlesswasm: falseis passed.
Supported environments
Section titled “Supported environments”| Environment | Default backend | Requirements |
|---|---|---|
Node.js >= 22.12 (CI tests Node 24) |
Native Node-API (@evmts/zevm) |
Platform native binary installed (optional dependency) |
| Browsers (Vite, Rollup, Webpack, etc.) | WebAssembly (@evmts/zevm/browser) |
Bundler serving ./zevm.wasm or explicit wasm bytes |
| Web Workers / Cloudflare Workers | WebAssembly (@evmts/zevm/browser) |
Explicit wasm module/bytes or module-relative asset URL |
| Deno / Bun | Explicit wasm or backend |
Pass wasm bytes/module or custom ZevmBackend |
Default chain state
Section titled “Default chain state”When created without fork:
- Chain ID:
common.idifcommonis provided, otherwise31337. Passing bothchainIdandcommonwith mismatched IDs throws synchronously. - Starting block height:
0n. - Prefunded accounts: 10 standard Foundry/Hardhat accounts exported as
PREFUNDED_ACCOUNTSfromtevm/@tevm/utils, each seeded with 10,000 ETH. - Automining: Enabled (
mining: { auto: true }).
Mainnet hardfork rules (Osaka / Fusaka)
Section titled “Mainnet hardfork rules (Osaka / Fusaka)”When running with chainId: 1, pending transactions follow Ethereum’s mainnet hardfork schedule in the native ZEVM / Voltaire / Guillotine Mini engine:
- Osaka activation (
timestamp >= 1764798551):- Transaction gas limit cap: Any declared transaction gas limit above
16,777,216(2^24) is rejected during submission and signing withNativeRpcError(code === -32000), independently of the block gas limit. Non-validatingeth_callsimulations retain their simulation gas bound. - ModExp (
0x05) limits (EIP-7883): Each declared operand (base, exponent, modulus) is capped at1,024bytes, and EIP-7883 pricing starts at a minimum of500gas. Calls with oversized operands or insufficient forwarded gas fail.
- Transaction gas limit cap: Any declared transaction gas limit above
- Earlier pending block timestamps: Pending blocks with timestamps before Osaka activation retain Prague behavior.
Local monorepo builds from source
Section titled “Local monorepo builds from source”When developing inside the evmts/tevm monorepo with sibling Zig checkouts (~/tevm-monorepo, ~/zevm, ~/voltaire, ~/guillotine-mini), Node is pinned in .nvmrc, pnpm in package.json, and Zig/Foundry/Bun in mise.toml. Rebuild the native addon after Zig changes with:
mise exec -- node scripts/factory/build-native.mjs
