Skip to content

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.

@tevm/node contains no static Node.js built-in imports. At initialization time, createZevmEngine() resolves its backend in this order:

  1. Explicit backend: If you pass backend: { rpc, close }, TEVM uses it directly and never touches @evmts/zevm. During ready(), TEVM checks eth_chainId against chainId (if supplied) and fails initialization if they differ.
  2. Explicit wasm: If you pass wasm: true or wasm: ArrayBuffer | ArrayBufferView | WebAssembly.Module, TEVM instantiates @evmts/zevm/browser’s compiled zevm.wasm reactor in any runtime (including Node.js, Bun, Deno, browsers, and edge workers).
  3. Automatic Node.js native addon: When neither backend nor wasm is set inside Node.js (>= 22.12), TEVM loads @evmts/zevm dynamically through process.getBuiltinModule('node:module') and spawns a native Zig NodeRuntime.
  4. Automatic browser/worker WASM: When neither backend nor wasm is set outside Node.js, TEVM loads @evmts/zevm/browser automatically unless wasm: false is passed.
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

When created without fork:

  • Chain ID: common.id if common is provided, otherwise 31337. Passing both chainId and common with mismatched IDs throws synchronously.
  • Starting block height: 0n.
  • Prefunded accounts: 10 standard Foundry/Hardhat accounts exported as PREFUNDED_ACCOUNTS from tevm / @tevm/utils, each seeded with 10,000 ETH.
  • Automining: Enabled (mining: { auto: true }).

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 with NativeRpcError (code === -32000), independently of the block gas limit. Non-validating eth_call simulations retain their simulation gas bound.
    • ModExp (0x05) limits (EIP-7883): Each declared operand (base, exponent, modulus) is capped at 1,024 bytes, and EIP-7883 pricing starts at a minimum of 500 gas. Calls with oversized operands or insufficient forwarded gas fail.
  • Earlier pending block timestamps: Pending blocks with timestamps before Osaka activation retain Prague behavior.

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:

Terminal window
mise exec -- node scripts/factory/build-native.mjs