Skip to content
LogoLogo
@tevm/ethers

Ethers.js, powered by a local EVM

@tevm/ethers plugs an in-memory Tevm node straight into ethers.js v6. Swap your JsonRpcProvider for a TevmProvider and every call executes locally — no network, no fork URL, no rate limits — with contracts that infer their types from the ABI.

pnpm add @tevm/ethers ethers tevm viem@2.46.0

Try the playground →

One provider, zero network

import { TevmProvider } from '@tevm/ethers'
 
const provider = await TevmProvider.createMemoryProvider({
	miningConfig: { type: 'auto' },
})
 
const chainId = await provider.send('eth_chainId', [])
const blockNumber = await provider.getBlockNumber()
 
console.log({ chainId, blockNumber })
The same ethers call, once through a remote RPC and once through TevmProvider's in-memory EVM.
JsonRpcProvider → remote RPC
serialize eth_call request
open HTTPS connection
round-trip to RPC endpoint
wait for remote EVM execution
decode JSON-RPC response
waiting…
TevmProvider → local Tevm node
serialize eth_call request
execute in local Tevm EVM
decode result
waiting…

Contracts that type themselves

Contract infers every method, argument, and return type from a const ABI — no code generation step, no any leaking through.

import { Contract } from '@tevm/ethers'
 
const abi = [
	{
		type: 'function',
		name: 'balanceOf',
		stateMutability: 'view',
		inputs: [{ name: 'account', type: 'address' }],
		outputs: [{ name: 'balance', type: 'uint256' }],
	},
] as const
 
const token = new Contract('0x0000000000000000000000000000000000000000', abi, provider)
const balance = await token.balanceOf('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')
//    ^? bigint — inferred from the ABI
you write
const balance = await token.balanceOf( "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" )
typescript infers
balance: bigint
// 420691337000000000000n — inferred from
// outputs: [{ type: "uint256" }]

Why it exists

In-memory execution

TevmProvider runs every JSON-RPC method against a local Tevm node, so tests and scripts never touch the network.

Real ethers

It extends ethers' own JsonRpcApiProvider — every provider API, signer, and utility you already know keeps working.

ABI-typed contracts

Contract and Interface infer methods and events from a const ABI at the type level — typesafe calls with zero codegen.

Tevm actions built in

provider.tevm exposes the full Tevm action API — mine blocks, set balances, impersonate accounts — from the same object.

The Tevm docs family