
Ethereum Node for Viem
npm install tevm
An Ethereum Node built to run in Browser, Bun, Deno, and Node.js
// @noErrors
// Runs in browsers, Node.js, Deno, Bun and beyond. Zero native dependencies
import { createMemoryClient } from "tevm";
// Direct Solidity imports with the Tevm Bundler
import { ComplexSimulation } from "../contracts/ComplexSimulation.s.sol";
const client = createMemoryClient();
const {
data, error, logs, createdAddresses, executionGasUsed,
l1Fee, trace, accessList, txHash,
} = await client.tevmContract({
deployedBytecode: ComplexSimulation.deployedBytecode,
...ComplexSimulation.read.simulate(2n, "arg2"),
createTrace: true,
createAccessList: true,
createTransaction: true,
throwOnFail: false,
onStep: (step, next) => {
console.log(step.opcode);
next?.();
},
});- JavaScript-Native EVM — run Ethereum anywhere JavaScript runs.
- Up to 10× Faster Than Remote Calls — local execution, no network roundtrips; instant gas estimates.
- Import Solidity Files Directly — .sol files as ES modules with full TypeScript types.
- Fork Any Chain — instant local copies of Ethereum, Optimism, or any EVM chain. No Anvil/Hardhat required.
- EVM Execution Hooks — plug into execution at opcode level for debuggers, tracers, profilers.
- Works With Tools You Know — native viem integration; compatible with ethers.js, wagmi, any EIP-1193 library.
"If you're building a blockchain application on the web, I'm almost certain there is a use case for Tevm. It might change everything, and at worst it would most likely improve your devX."
polarzero @0xpolarzero
Turn Solidity into TypeScript
The Tevm Bundler imports Solidity contracts directly into your JS/TS. No ABI copying, no artifact management — just import .sol files with full type safety and auto-completion.
// @noErrors
// Import Solidity contracts directly
import { ERC20 } from '@openzeppelin/contracts/token/ERC20/ERC20.sol'
const tokenContract = ERC20.withAddress('0x123...')
// Type-safe contract methods
const balance = await client.readContract(
tokenContract.read.balanceOf('0x456...')
)
// Coming soon: import contracts from any chain
import { WETH } from 'caip10:eip155:1:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
// Coming soon: inline Solidity
import { sol } from 'tevm'
const { abi, bytecode } = sol`
pragma solidity ^0.8.19;
contract Counter {
uint256 private count = 0;
function increment() public {
count += 1;
}
function getCount() public view returns (uint256) {
return count;
}
}
`Here's our documentation as plain text for providing context to LLM systems
