Tevm CLI Reference
The Tevm CLI provides comprehensive tooling for Ethereum development, testing, and interaction. This reference documents all available commands, options, and usage patterns.
Command Structure
The CLI follows a command-based structure:
tevm <command> [subcommand] [options]
Commands are organized by functionality, with the most commonly used commands available at the top level and more specialized commands grouped into categories.
Core Commands
create
Source: cli/src/commands/create.tsx
Creates a new Ethereum project with smart contract support.
tevm create [name] [options]
--template
- Project template to use (react, vue, vanilla, etc.)--skip-prompts
- Skip interactive prompts and use default values
When run without options, launches an interactive wizard that guides you through project setup.
serve
Source: cli/src/commands/serve.tsx
Starts a local Ethereum JSON-RPC server with Tevm features.
tevm serve [options]
--port <number>
- Port to listen on (default: 8545)--host <string>
- Host to bind to (default: "localhost")--fork <url>
- URL of network to fork from--chainId <string>
- Chain ID to use (default: "900")--forkBlockNumber <string>
- Block number to fork from (default: "latest")--loggingLevel <string>
- Logging level (default: "info")--verbose
- Enable verbose logging of JSON-RPC requests
call
Source: cli/src/commands/call.tsx
Executes a raw EVM call against a contract or address.
tevm call [options]
--to <address>
- Contract address to call--from <address>
- Address to send the transaction from--data <string>
- Transaction data (hex encoded)--value <string>
- ETH value to send in wei--run
- Run directly without interactive parameter editing--rpc <url>
- RPC endpoint (default: "http://localhost:8545")--code <string>
- The encoded code to deploy (with constructor args)--deployedBytecode <string>
- Deployed bytecode to put in state before call--gas <string>
- Gas limit for the transaction--gasPrice <string>
- Gas price in wei--createTrace
- Return a complete trace with the call--createAccessList
- Return an access list of storage access--createTransaction <string>
- Whether to update state (on-success, always, never)--formatJson
- Format output as JSON
generate
Source: cli/src/commands/generate.tsx
Generates TypeScript types from Solidity contracts.
tevm generate contract [name] [options]
--force
- Overwrite existing files--dir <string>
- Working directory (default: current directory)--include <string>
- Glob pattern(s) for Solidity files (default: "src/**/*.sol")--output <string>
- Custom output directory for generated files--verbose
- Show verbose output
State Management Commands
getAccount
Source: cli/src/commands/getAccount.tsx
Retrieves account information, including balance, nonce, and code.
tevm getAccount [options]
--address <string>
- Account address to query--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
setAccount
Source: cli/src/commands/setAccount.tsx
Sets or updates account state.
tevm setAccount [options]
--address <string>
- Account address to modify--balance <string>
- New balance in wei--nonce <number>
- New nonce value--code <string>
- New contract code (hex encoded)--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
dumpState
Source: cli/src/commands/dumpState.tsx
Dumps the entire state for backup or debugging.
tevm dumpState [options]
--output <string>
- Output file path (default: stdout)--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
loadState
Source: cli/src/commands/loadState.tsx
Loads state from a previously dumped state file.
tevm loadState [options]
--input <string>
- Input file path--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
Contract Interaction Commands
deploy
Source: cli/src/commands/deploy.tsx
Deploys a contract to the network.
tevm deploy [options]
--code <string>
- Contract bytecode to deploy--from <address>
- Address to deploy from--value <string>
- ETH value to send with deployment--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
readContract
Source: cli/src/commands/readContract.tsx
Reads data from a deployed contract using its ABI.
tevm readContract [options]
--address <string>
- Contract address--abi <string>
- Contract ABI (as JSON string or file path)--function <string>
- Function name to call--args <string>
- Function arguments as JSON array--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
contract
Source: cli/src/commands/contract.tsx
Comprehensive contract operations including deployment, interaction, and event monitoring.
tevm contract [options]
--address <string>
- Contract address--abi <string>
- Contract ABI (as JSON string or file path)--bytecode <string>
- Contract bytecode for deployment--function <string>
- Function name to call--args <string>
- Function arguments as JSON array--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
Network Commands
mine
Source: cli/src/commands/mine.tsx
Mines new blocks on the local node.
tevm mine [options]
--blocks <number>
- Number of blocks to mine (default: 1)--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
getBlockNumber
Source: cli/src/commands/getBlockNumber.tsx
Gets the current block number.
tevm getBlockNumber [options]
--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
getBlock
Source: cli/src/commands/getBlock.tsx
Gets information about a specific block.
tevm getBlock [options]
--blockNumber <number>
- Block number to query--blockHash <string>
- Block hash to query--includeTransactions
- Include full transactions--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
getChainId
Source: cli/src/commands/getChainId.tsx
Gets the current chain ID.
tevm getChainId [options]
--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
Storage & Code Commands
getStorageAt
Source: cli/src/commands/getStorageAt.tsx
Gets the value from a storage slot at a contract address.
tevm getStorageAt [options]
--address <string>
- Contract address--slot <string>
- Storage slot (hex string)--blockTag <string>
- Block tag or number--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
setStorageAt
Source: cli/src/commands/setStorageAt.tsx
Sets the value for a storage slot at a contract address.
tevm setStorageAt [options]
--address <string>
- Contract address--slot <string>
- Storage slot (hex string)--value <string>
- New value (hex string)--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
getBytecode
Source: cli/src/commands/getBytecode.tsx
Gets the bytecode at a contract address.
tevm getBytecode [options]
--address <string>
- Contract address--blockTag <string>
- Block tag or number--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
setCode
Source: cli/src/commands/setCode.tsx
Sets the code at a contract address.
tevm setCode [options]
--address <string>
- Contract address--code <string>
- New contract code--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
Transaction Commands
getTransaction
Source: cli/src/commands/getTransaction.tsx
Gets transaction details by hash.
tevm getTransaction [options]
--hash <string>
- Transaction hash--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
estimateGas
Source: cli/src/commands/estimateGas.tsx
Estimates gas for a transaction.
tevm estimateGas [options]
--to <string>
- Target address--from <string>
- Sender address--data <string>
- Transaction data--value <string>
- Transaction value--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
getGasPrice
Source: cli/src/commands/getGasPrice.tsx
Gets the current gas price.
tevm getGasPrice [options]
--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
estimateFeesPerGas
Source: cli/src/commands/estimateFeesPerGas.tsx
Estimates EIP-1559 gas fees.
tevm estimateFeesPerGas [options]
--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
Advanced Commands
compile
Source: cli/src/commands/compile.tsx
Compiles Solidity contracts.
tevm compile [options]
--input <string>
- Input file or directory--output <string>
- Output directory--solc-version <string>
- Solidity compiler version--run
- Run directly without interactive parameter editing
multicall
Source: cli/src/commands/multicall.tsx
Executes multiple calls in a single transaction.
tevm multicall [options]
--calls <string>
- JSON array of call objects--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
createBlockFilter
Source: cli/src/commands/createBlockFilter.tsx
Creates a filter for new blocks.
tevm createBlockFilter [options]
--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
createEventFilter
Source: cli/src/commands/createEventFilter.tsx
Creates a filter for events.
tevm createEventFilter [options]
--address <string>
- Contract address--topics <string>
- Event topics as JSON array--fromBlock <string>
- Start block--toBlock <string>
- End block--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
createContractEventFilter
Source: cli/src/commands/createContractEventFilter.tsx
Creates a filter for contract events using ABI.
tevm createContractEventFilter [options]
--address <string>
- Contract address--abi <string>
- Contract ABI--event <string>
- Event name--args <string>
- Event arguments--fromBlock <string>
- Start block--toBlock <string>
- End block--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
Specialized Viem Action Commands
The Tevm CLI includes commands for all Viem client actions in the action
directory. These commands provide direct access to Viem's client actions with the familiar Tevm CLI interface:
tevm action createAccessList
tevm action getBalance
tevm action sendRawTransaction
tevm action simulateCalls
Source: cli/src/commands/action/
ENS Commands
getEnsAddress
Source: cli/src/commands/getEnsAddress.tsx
Resolves ENS name to address.
tevm getEnsAddress [options]
--name <string>
- ENS name--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
getEnsName
Source: cli/src/commands/getEnsName.tsx
Resolves address to ENS name.
tevm getEnsName [options]
--address <string>
- Ethereum address--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
getEnsText
Source: cli/src/commands/getEnsText.tsx
Gets ENS text record.
tevm getEnsText [options]
--name <string>
- ENS name--key <string>
- Text record key--rpc <url>
- RPC endpoint--run
- Run directly without interactive parameter editing
Environment Variables
The Tevm CLI supports configuration via environment variables for all commands. Environment variables take precedence over default values but are overridden by explicit command-line options.
Common environment variables include:
TEVM_RPC
- Default RPC endpointTEVM_FROM
- Default sender addressTEVM_TO
- Default target addressTEVM_GAS
- Default gas limitTEVM_GAS_PRICE
- Default gas priceTEVM_VALUE
- Default transaction valueTEVM_FORMAT_JSON
- Whether to format output as JSONTEVM_RUN
- Whether to run in non-interactive modeEDITOR
- Preferred editor for interactive mode
Environment variables follow the naming pattern TEVM_
followed by the option name in uppercase, with dashes converted to underscores.
Interactive Mode
Most Tevm CLI commands support an interactive mode that opens your default text editor with a template for the command parameters. This is especially useful for complex operations where you need to carefully construct parameters.
The interactive editor opens a temporary file with:
- JSON template for all command parameters
- Comments explaining each parameter
- Default values pre-filled
After you save and close the editor, the command executes with your customized parameters.
To skip interactive mode and execute commands directly, use the --run
flag.
Exit Codes
The Tevm CLI uses standard exit codes:
0
- Success1
- General error2
- Invalid usage3
- External error (e.g., network issues)4
- Internal error (unexpected conditions)
Command-Line Help
Every command supports the --help
flag to display usage information:
tevm --help
tevm <command> --help
This displays information about the command, available options, and examples.