[go: up one dir, main page]

Skip to content
TEVM logoTEVM logo

Ethereum embedded in TypeScript

Run an isolated ZEVM node inside Node.js (Node-API) or the browser (WebAssembly) — with viem clients, lazy mainnet forking, HTTP/WebSocket/IPC servers, opcode tracing, and direct Solidity imports.
Terminal window
pnpm add tevm viem
quickstart.ts
import { createMemoryClient, parseAbi } from 'tevm'
// Zero-config: native Node-API in Node.js (>= 22.12), compiled ZEVM WASM in browsers
const client = createMemoryClient()
try {
const deployed = await client.tevmDeploy({
bytecode: '0x600a600c600039600a6000f3602a60005260206000f3',
})
const result = await client.tevmContract({
address: deployed.createdAddress!,
abi: parseAbi(['function answer() view returns (uint256)']),
functionName: 'answer',
})
console.log(result.data) // 42n
} finally {
await client.tevmClose()
}

Native & WASM execution

Runs ZEVM, Voltaire, and Guillotine Mini via Node-API in Node.js or WebAssembly in browsers and workers. Each client owns isolated chain state with no background daemon. Read the architecture

Viem & ethers v6 native

Includes viem public, wallet, and Anvil test actions out of the box, plus TevmProvider for ethers v6 and tree-shakeable transports. Start with Viem

Lazy mainnet forking

Fork any EVM JSON-RPC endpoint at a pinned block number. Missing accounts, code, and storage load on cache miss; local writes stay in your process. Fork a chain

HTTP, WebSocket & IPC servers

Expose any local client over HTTP POST/batch, WebSocket eth_subscribe, Unix IPC sockets, Express middleware, or Next.js API routes. Run a server

Direct Solidity imports

Import .sol files as typed TypeScript modules in Vite, Rollup, esbuild, Webpack, Rspack, and Bun, with NatSpec hover via @tevm/ts-plugin. Set up the bundler

Opcode tracing, console.log & MCP

Capture native debug_traceCall opcode traces, stream Solidity console.log messages, and give AI coding agents isolated EVM sessions via @tevm/mcp. Explore tracing & MCP