Skip to content

JSON-RPC

Every call in TEVM — through MemoryClient, ZevmEngine, TevmProvider, @tevm/server, or @tevm/mcp — is routed through ZEVM’s JSON-RPC 2.0 dispatcher.

Query rpc_modules on any engine to inspect active modules:

{
"eth": "1.0",
"net": "1.0",
"web3": "1.0",
"rpc": "1.0",
"txpool": "1.0",
"debug": "1.0",
"engine": "1.0",
"zevm": "1.0"
}

Development cheatcodes are also registered under anvil_* and evm_*.

Surface Input Output Use when
engine.request({ method, params }) / client.request(...) EIP-1193 object (no jsonrpc or id) Parsed result; throws NativeRpcError on error Application code, viem, scripts
engine.rpc(jsonString) Raw JSON-RPC 2.0 string (single, batch array, or notification) Exact serialized JSON response string, or null for notifications HTTP/WS/IPC servers, conformance tests

Standard Ethereum (eth_*, net_*, web3_*, rpc_*)

Section titled “Standard Ethereum (eth_*, net_*, web3_*, rpc_*)”
  • Chain & fees: eth_chainId, eth_accounts, eth_blockNumber, eth_gasPrice, eth_maxPriorityFeePerGas, eth_feeHistory, eth_blobBaseFee, net_version, web3_clientVersion, rpc_modules
  • State reads: eth_getBalance, eth_getCode, eth_getStorageAt, eth_getTransactionCount, eth_getProof
  • Simulation & gas: eth_call (with stateOverride), eth_estimateGas, eth_createAccessList
  • Transactions & receipts: eth_sendTransaction, eth_sendRawTransaction, eth_signTransaction, eth_getTransactionByHash, eth_getTransactionReceipt, eth_getBlockReceipts
  • Blocks & filters: eth_getBlockByNumber, eth_getBlockByHash, eth_getLogs, eth_newFilter, eth_newBlockFilter, eth_newPendingTransactionFilter, eth_getFilterChanges, eth_getFilterLogs, eth_uninstallFilter
  • Subscriptions (over @tevm/server WS/IPC): eth_subscribe (newHeads, logs, newPendingTransactions, syncing), eth_unsubscribe

Development controls (anvil_*, evm_*, zevm_*, tevm_*)

Section titled “Development controls (anvil_*, evm_*, zevm_*, tevm_*)”
  • Accounts & storage: zevm_getAccount, anvil_setBalance, anvil_setNonce, anvil_setCode, anvil_setStorageAt, anvil_impersonateAccount, anvil_stopImpersonatingAccount, anvil_autoImpersonateAccount
  • Mining & timestamps: anvil_mine, evm_mine, anvil_getAutomine, evm_setAutomine, evm_setIntervalMining, evm_setNextBlockTimestamp, evm_increaseTime
  • Snapshots & state blobs: evm_snapshot, evm_revert, anvil_dumpState, anvil_loadState, anvil_reset
  • Solidity console logs: tevm_drainConsoleLogs (drained automatically when consoleLog is enabled)
  • debug_traceCall — native Guillotine Mini opcode tracer ({ disableStack, enableMemory, enableReturnData, disableStorage: true }, max 100,000 steps, reports truncated).
  • txpool_status, txpool_content, txpool_contentFrom, txpool_inspect.

For exhaustive parameter-by-parameter semantics, see the ZEVM JSON-RPC reference.

Native JSON-RPC enforces strict Ethereum JSON-RPC wire encoding:

  • Quantities (block numbers, balances, nonces, gas, chain ID) must be lowercase unpadded 0x-prefixed hex strings ('0x0', '0x7a69', '0x2a'). Never pass decimal strings or bigint values directly to engine.request().
  • Data (addresses, hashes, bytecode, storage values) must be 0x-prefixed hex strings.
  • Missing lookups (eth_getTransactionByHash, eth_getTransactionReceipt for unknown or unmined hashes) return null.

High-level helpers (MemoryClient, @tevm/actions) convert bigint values to canonical hex quantities automatically.

Code Meaning Common cause
3 Execution reverted Contract reverted; error.data holds raw revert bytes ('0x...').
-32700 Parse error Malformed JSON passed to rpc() or HTTP/WS server.
-32600 Invalid request Missing required JSON-RPC 2.0 fields or empty batch [].
-32601 Method not found Unregistered JSON-RPC method name.
-32602 Invalid params Wrong parameter count/type, non-hex quantity, or invalid fork URL.
-32603 Internal error Engine unavailable (503 on HTTP) or unexpected backend failure.
-32000 Execution / admission error Gas limit above Osaka cap (16,777,216), insufficient funds, or nonce mismatch.