Skip to content

Migrating from the JS engine

TEVM replaced its legacy JavaScript (EthereumJS) execution engine with ZEVM (Voltaire primitives/state + Guillotine Mini bytecode execution), running natively via Node-API in Node.js (>= 22.12) and via WebAssembly (@evmts/zevm/browser) in browsers and workers.

This guide maps every changed option, action signature, and removed internal package to its current replacement.

Legacy JS engine Native ZEVM / WASM engine Notes
miningConfig: { type: 'manual' } mining: { auto: false } Automining is true by default.
miningConfig: { type: 'auto' } mining: { auto: true } (default) Omit mining for automining.
miningConfig: { type: 'interval', blockTime: 5 } mining: { auto: false, interval: 5 } interval is whole seconds (0 disables the timer).
fork: { transport: http(url)({}), blockTag: 20_000_000n } fork: { url, blockNumber: 20_000_000 } blockNumber is an unsigned safe integer number. Local chain starts at height 0.
client.tevmMine({ blockCount: 2 }) client.tevmMine({ blocks: 2 }) Matches viem’s client.mine({ blocks: 2 }).
(no cleanup required) await client.tevmClose() Required to free native/WASM handles and stop interval threads.
Legacy JS engine Native ZEVM / WASM engine Notes
const { state } = await client.tevmDumpState() const blob = await client.tevmDumpState() Returns an opaque ZEVM hex string (0x...), not a JS account map.
await client.tevmLoadState({ state }) await client.tevmLoadState(blob) Takes the hex string directly. Incompatible with v1 JS dumps.
tevmCall({ createTrace: true, onStep }) client.transport.tevm.request({ method: 'debug_traceCall', ... }) Native Guillotine Mini opcode trace (structLogs, capped at 100,000 steps).
tevmCall({ stateOverrideSet }) tevmCall({ stateOverride }) Uses standard eth_call wire override shape.
tevmSetAccount({ state: { ... } }) tevmSetAccount({ storage: { ... } }) Dispatches per-field native setters; wrap in snapshot()/revert() for atomicity.
tevmDeal({ account, amount }) tevmDeal({ address, amount }) Sets native ETH balance via anvil_setBalance.
callHandler(node)(params) tevmCall(client, params) Standalone actions live in tevm and tevm/actions and accept any RpcClient.
createTevmNode().extend(requestEip1193()) createZevmEngine() / createTevmNode() request() and rpc() are built directly into the engine; decorators were removed.
new BrowserProvider(client) TevmProvider.createMemoryProvider() (@tevm/ethers) new BrowserProvider(client, undefined, { cacheTimeout: -1 }) also works.

In-browser execution works again via @evmts/zevm/browser (zevm.wasm):

  • Calling createMemoryClient() or createZevmEngine() outside Node.js automatically loads the compiled WASM reactor when @evmts/zevm is installed.
  • You can also pass explicit wasm bytes / WebAssembly.Module, construct a backend with createWasmBackend(), inject any custom ZevmBackend, or connect a browser to @tevm/server over HTTP/WebSocket. See Browsers & WebAssembly.

The following EthereumJS-era internal packages and escape hatches have been removed:

  • Removed internal packages: @tevm/vm, @tevm/evm, @tevm/state, @tevm/blockchain, @tevm/block, @tevm/tx, @tevm/txpool, @tevm/receipt-manager, @tevm/rlp, @tevm/trie, @tevm/address, @tevm/decorators, @tevm/precompiles, @tevm/procedures, @tevm/sync-storage-persister.
  • Removed JS escape hatches: node.getVm(), node.getTxPool(), node.getReceiptsManager(), vm.stateManager, vm.evm.events.on('step', ...), JavaScript customPrecompiles, and profiler: true.

Use standard JSON-RPC methods (txpool_content, debug_traceCall, anvil_setCode, anvil_setStorageAt, eth_getBlockReceipts) and ZevmEngine.events (request, response, block, consoleLog, error, close) instead.

migration-example.ts
// Before (legacy EthereumJS engine)
// const oldClient = createMemoryClient({
// miningConfig: { type: 'manual' },
// fork: { transport: http(url)({}), blockTag: 20_000_000n },
// })
// await oldClient.tevmMine({ blockCount: 1 })
// After (native ZEVM / WASM engine)
import { createMemoryClient } from 'tevm'
import { mainnet } from 'tevm/common'
const client = createMemoryClient({
chainId: mainnet.id,
common: mainnet,
mining: { auto: false },
fork: {
url: process.env.ETH_RPC_URL ?? 'https://ethereum-rpc.publicnode.com',
blockNumber: 20_000_000,
},
})
try {
await client.tevmReady()
await client.tevmMine({ blocks: 1 })
} finally {
await client.tevmClose()
}