Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

@tevm/node

Subpath: tevm/node (also re-exported from tevm).

Provides the serialized Node-API bridge over @evmts/zevm's native NodeRuntime.

Exports

SymbolKindDescription
createZevmEngineFunctionCreates an isolated native ZEVM engine ({ events, ready, request, rpc, close }).
createTevmNodeFunctionAlias for createZevmEngine.
NativeRpcErrorClassError subclass carrying native JSON-RPC code: number and optional data?: JsonValue.
ZevmEngine / TevmNodeTypeEngine instance interface.
ZevmEngineOptions / TevmNodeOptionsType{ chainId?: number; mining?: { auto?: boolean; interval?: number }; fork?: { url: string; blockNumber?: number } }.
EngineRequestType{ method: string; params?: JsonValue[] }.
JsonValueTypeStrict JSON-serializable wire value union.

Example

import { createZevmEngine, NativeRpcError } from 'tevm/node'
 
const engine = createZevmEngine({ mining: { auto: false } })
try {
  await engine.ready()
  console.log(await engine.request({ method: 'eth_chainId' })) // '0x7a69'
} catch (error) {
  if (error instanceof NativeRpcError) {
    console.error(error.code, error.message, error.data)
  }
} finally {
  await engine.close()
}

See also: Engine API guide · Runtime model & ZEVM