Skip to content

What is Tevm Node?

Universal JavaScript Compatibility

Tevm's key innovation is bringing the Ethereum execution environment to every JavaScript runtime:

Node.js
For local development, testing, and CI/CD pipelines
Browser
For advanced dApps with offline capability and real-time simulation
Any JS Runtime
Works in Deno, Bun, Edge Functions, or any modern JavaScript environment

Core Features

Network Forking

Create a local sandbox with the state of any EVM-compatible network:

import { createMemoryClient, http } from 'tevm'
import { optimism } from 'tevm/chains'
 
// Fork from Optimism mainnet
const client = createMemoryClient({
  fork: {
    transport: http('https://mainnet.optimism.io'),
    common: optimism
  }
})
 
// Access any contract or account state from the forked network
const balance = await client.getBalance({ 
  address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' // vitalik.eth
})

Tevm's forking implementation uses:

  • Lazy-loading - Only loads the state you actually access
  • Efficient caching - Keeps accessed state in memory for fast subsequent access
  • Latest EVM version - Supports the most recent Ethereum upgrades

Transaction Pool Management

Complete control over transaction submission and processing:

// Submit a transaction to the mempool
const hash = await client.sendTransaction({
  account: '0x...',
  to: '0x...',
  value: 1000000000000000000n // 1 ETH
})
 
// View pending transactions
const pool = await client.getTxPool()
const pendingTxs = pool.getContent()
 
// Mine blocks to process transactions
await client.mine({ blocks: 1 })

Tevm gives you full control over:

  • Transaction priority - Based on gas price, nonce, etc.
  • Validation rules - Customize how transactions are validated
  • Processing timing - Mine exactly when you want

Flexible Mining Control

Choose your block production model based on your needs:

// Manual mining (default)
await client.sendTransaction({ ... })
await client.mine({ blocks: 1 }) // Explicitly mine when ready
 
// Auto-mining
client.setMining({ mode: 'auto' }) // Mine on each transaction
 
// Interval mining
client.setMining({ 
  mode: 'interval',
  interval: 5000 // Mine every 5 seconds
})

Advanced Extensibility

Customize every aspect of the EVM environment:

import { createTevmNode } from 'tevm'
 
// Create a custom node with specialized components
const node = await createTevmNode({
  evm: {
    // Customize EVM execution
    enableRuntimeTransform: true,
    allowUnlimitedContractSize: true
  },
  precompiles: [
    // Add custom precompiles
    {
      address: '0x0000000000000000000000000000000000000123',
      execute: async (input, gas) => {
        // Custom logic
        return { executionGasUsed: 0n, returnValue: '0x123' }
      }
    }
  ]
})

Integration With Popular Libraries

Tevm works with the libraries you already know and love:

viem
import { createMemoryClient, http } from 'tevm'
 
const client = createMemoryClient()
 
// Use standard viem actions
const balance = await client.getBalance({ address: '0x...' })
const blockNumber = await client.getBlockNumber()
 
// Plus Tevm-specific actions
await client.tevmMine({ blocks: 1 })
await client.tevmSetAccount({ 
  address: '0x...',
  balance: 100000000000000000n // 0.1 ETH
})

How Tevm Compares

FeatureTevmAnvilHardhatGanache
LanguageJavaScriptRustJavaScript/SolidityJavaScript
Browser Compatible
Zero Dependencies
Mainnet Forking
EVM Event HooksPartial
Custom Precompiles
viem IntegrationNativeBasicBasicBasic
ethers IntegrationNativeBasicBasicBasic
DebuggingAdvancedBasicAdvancedBasic
TypeScript SupportFullLimitedFullLimited
Serverless Compatible

Why Choose Tevm?

🚀 Enhanced Performance

Execute transactions locally with near-zero latency for gas estimation, transaction simulation, and debugging.

💻 Browser Compatibility

Enable sophisticated dApp features like offline capabilities, optimistic UI updates, and real-time simulations.

🔍 Debug Superpowers

Step through EVM execution opcode by opcode to understand exactly what's happening in your smart contracts.

🛠️ Familiar Developer Experience

Works seamlessly with the libraries you already know - viem, ethers, or any EIP-1193 compatible tool.

Library Compatibility

LibrarySupport LevelNotes
viemFirst-classNative integration with all viem features
ethers.jsFullBoth v5 and v6 via EIP-1193 provider
web3.jsFullVia EIP-1193 provider
wagmiFullWorks as a wagmi connector
thirdwebFullCompatible with thirdweb's SDK
Any EIP-1193 libraryFullStandard provider interface

Next Steps

Why JavaScript for Ethereum?
Understand the unique advantages of running Ethereum in JavaScript environments
Architecture Overview
Dive into Tevm's technical design and component structure
Create a Tevm Node
Get started building with Tevm in your own applications