Tevm CLI Quickstart
The Tevm CLI offers a powerful command-line interface to interact with Ethereum networks, local development environments, and smart contracts directly from your terminal. This guide will help you get started with the most important CLI commands.
Installation
Install the Tevm CLI globally:
npm install -g tevm
Or use it directly with npx:
npx tevm <command>
Core Commands
Tevm CLI provides several key commands to help with Ethereum development workflows:
1. Project Creation
Create a new Ethereum project with the interactive CLI:
tevm create my-project
This launches an interactive wizard that guides you through configuring:
- Project name and location
- Framework selection (React, Vue, Vanilla, etc.)
- Use case (UI, API, testing)
- Package manager preference
- Other project settings
For non-interactive mode, specify options directly:
tevm create my-project --template react --skip-prompts
2. Running a Local Ethereum Server
Start a full-featured Ethereum JSON-RPC server with Tevm features:
tevm serve
This launches a server on localhost:8545
with an interactive terminal UI for managing your node.
Options include:
# Launch on a custom port
tevm serve --port 8546
# Fork from a mainnet or testnet
tevm serve --fork https://mainnet.infura.io/v3/YOUR_KEY
# Set custom chain ID
tevm serve --chainId 1337
# Advanced logging
tevm serve --verbose --loggingLevel debug
The interactive server interface provides tabs for:
- Viewing server status
- Executing RPC calls
- Managing accounts
- Viewing transaction logs
3. Smart Contract Interaction
Execute calls against contracts with full type safety:
tevm call --to 0x123... --data 0xabcdef...
This command opens an interactive editor for constructing your call parameters, then executes the call against the target contract.
For direct execution without the interactive editor:
tevm call --to 0x123... --data 0xabcdef... --run
The call
command supports a wide range of options for customizing your EVM execution:
# Specify gas limit, price, and value
tevm call --to 0x123... --gas 1000000 --gasPrice 1000000000 --value 1000000000000000000
# Connect to a remote node instead of local
tevm call --to 0x123... --rpc https://mainnet.infura.io/v3/YOUR_KEY
# Create a trace of the execution
tevm call --to 0x123... --createTrace
4. TypeScript Generation from Solidity
Generate TypeScript types and interfaces from Solidity contracts:
tevm generate contract
This command scans for all Solidity files in your project and generates corresponding TypeScript files with full type definitions, without requiring a bundler plugin.
# Generate types for specific files or patterns
tevm generate contract "ERC20Token"
# Specify input and output directories
tevm generate contract --include "contracts/**/*.sol" --output "types/"
# Force overwrite existing files
tevm generate contract --force
Additional Useful Commands
Tevm CLI includes many specialized commands for specific Ethereum operations:
Account & State Management
# Get account details
tevm getAccount --address 0x123...
# Set account state
tevm setAccount --address 0x123... --balance 1000000000000000000
# Set contract code
tevm setCode --address 0x123... --code 0x...
# Dump full state for backup/debugging
tevm dumpState --output state.json
Mining & Block Control
# Mine new blocks
tevm mine --blocks 1
# Load state from a file
tevm loadState --input state.json
Contract Testing
# Deploy a contract
tevm deploy --code 0x...
# Read from a contract
tevm readContract --address 0x123... --abi [...] --function "balanceOf" --args "[\"0x456...\"]"
Interactive Mode
Most Tevm CLI commands support an interactive mode that launches your default editor (configurable via environment variables) with a template for the command parameters. This is especially useful for complex operations where you need to carefully construct parameters.
Disable interactive mode with the --run
flag to execute commands directly.
Environment Variables
The Tevm CLI supports configuration via environment variables:
# Set default RPC endpoint
export TEVM_RPC=http://localhost:8545
# Set default "from" address for transactions
export TEVM_FROM=0x123...
# Configure default editor for interactive mode
export EDITOR=code
Next Steps
Now that you're familiar with the Tevm CLI basics, you can:
- Learn about the Tevm Node API
- Explore the Tevm bundler for importing Solidity directly
- Check out the full CLI reference
- [Run the
tevm --help
command for a complete list of available commands and options]
The Tevm CLI makes Ethereum development and testing more efficient by providing a unified interface for common operations directly from your terminal. Combined with Tevm's powerful EVM implementation, you can build, test, and deploy Ethereum applications with confidence.