Skip to content

CLI

The TEVM CLI (tevm / @tevm/cli) exposes local and forked ZEVM sessions, a JSON-RPC server, contract calls, and state cheatcodes directly from your terminal. Reach for it when a shell command or script is faster than writing a TypeScript file.

Run via npx (bundled inside tevm) or install @tevm/cli globally:

Terminal window
npx tevm --version
npx tevm session dev --local --json

Example JSON output:

{
"ok": true,
"command": "session",
"result": {
"version": 1,
"name": "dev"
},
"session": "dev"
}

A named session persists local state between CLI invocations so you can chain deployments, balance mutations, and reads across commands.

Flag Environment variable Effect
--json, --no-json TEVM_JSON Emit stable { ok, command, result, session } JSON or human-readable output.
--session <name> TEVM_SESSION Load and persist a named local or forked state file.
--run, -r TEVM_RUN Execute immediately without opening the interactive parameter editor.
--rpc <url> TEVM_RPC Fork or query the given upstream JSON-RPC URL.
Command Description
tevm session <name> Create or inspect a persistent local or forked session (--local, --rpc <url>).
tevm serve Start a local HTTP/WebSocket JSON-RPC server backed by ZEVM.
tevm mine Mine one or more blocks (--blocks, --interval).
tevm dump-state Export the current session’s serialized ZEVM state blob.
tevm load-state Hydrate a session from a serialized ZEVM state blob.
Command Description
tevm call Simulate or submit a low-level call (--to, --from, --data, --value, --code).
tevm contract Call an ABI-encoded contract function with typed arguments.
tevm read-contract Execute a read-only (view / pure) contract call.
tevm deploy Deploy creation bytecode (with optional ABI and constructor arguments).
tevm multicall Batch multiple read-only contract calls in one request.
tevm compile Compile Solidity source files into ABI and bytecode.
tevm action send-raw-transaction Broadcast a signed RLP-encoded transaction (eth_sendRawTransaction).
tevm action simulate-calls Simulate a sequence of calls against current state.
tevm action create-access-list Generate an EIP-2930 access list (eth_createAccessList).
Command Description
tevm get-account Read balance, nonce, bytecode, and storage for an address.
tevm set-account Mutate balance, nonce, deployed bytecode, or storage slots on an address.
tevm set-code Inject runtime bytecode directly at an address (anvil_setCode).
tevm set-nonce Override an account’s nonce (anvil_setNonce).
tevm set-storage-at Write a 32-byte value to a contract storage slot (anvil_setStorageAt).
Command Description
tevm get-chain-id Query eth_chainId.
tevm get-block-number Query the latest block height (eth_blockNumber).
tevm get-block Fetch a block by number, hash, or tag.
tevm get-transaction Fetch a transaction by hash.
tevm action get-balance Query an account’s ETH balance (eth_getBalance).
tevm get-bytecode Query deployed runtime bytecode at an address (eth_getCode).
tevm get-storage-at Read a storage slot at an address (eth_getStorageAt).
tevm get-gas-price Query current gas price (eth_gasPrice).
tevm estimate-gas Estimate gas required for a call or transaction (eth_estimateGas).
tevm estimate-fees-per-gas Estimate EIP-1559 maxFeePerGas and maxPriorityFeePerGas.
tevm create-block-filter Create a new block filter (eth_newBlockFilter).
tevm create-event-filter Create a log filter (eth_newFilter).
tevm create-contract-event-filter Create a typed contract event filter.
tevm get-ens-address Resolve an ENS name to an address.
tevm get-ens-name Reverse-resolve an address to an ENS name.
tevm get-ens-text Read an ENS text record.
Terminal window
# Create a session, fund an address, mine a block, and read the balance as JSON
npx tevm session ci-demo --local --json
npx tevm set-account --session ci-demo --run --json \
--address 0x1111111111111111111111111111111111111111 \
--balance 1000000000000000000
npx tevm mine --session ci-demo --run --json --blocks 1
npx tevm get-account --session ci-demo --run --json \
--address 0x1111111111111111111111111111111111111111

For standalone CLI development and release notes, see cli.tevm.sh.