For the majority of cases, setup is as simple as running ./local_node.sh from the cosmos/evm repository.
The remainder of this page gets is for those who require specific testing or development environments, and requires a deeper understanding of the setup process.
Currently there are some key network initialization steps that differ from standard Cosmos-SDK chains. See the Appendix section below for specifics.
# Initialize the node with your custom monikerevmd init <your-node-name> --chain-id <your-chain-id># REQUIRED: Set chain ID in client config BEFORE running gentx commands# This is a temporary workarond that prevents runtime panics in genesis transaction creationevmd config set client chain-id <your-chain-id>evmd config set client keyring-backend test
Example:
Copy
Ask AI
evmd init mynode --chain-id local-1evmd config set client chain-id local-1evmd config set client keyring-backend test
Enable JSON-RPC (Required for Ethereum Compatibility)
Manual Configuration Required: JSON-RPC is disabled by default and must be manually enabled in ~/.evmd/config/app.toml. There is no CLI command to configure these settings.
Edit ~/.evmd/config/app.toml:
JSON-RPC Configuration
Copy
Ask AI
# EVM Configuration (required for app-side mempool)[evm]# Minimum priority fee for mempool (in wei)min-tip = 0# EIP-155 chain ID (separate from Cosmos chain ID) evm-chain-id = 262144# Maximum gas for eth transactions in check tx modemax-tx-gas-wanted = 0[json-rpc]# Enable the JSON-RPC server (disabled by default)enable = true# Enable transaction indexer for eth_getLogs supportenable-indexer = true# Enable common namespaces (including txpool for app-side mempool)api = "eth,net,web3,txpool,debug"# Gas and performance capsgas-cap = 25000000 # Gas cap for eth_call/estimateGasfilter-cap = 200 # Maximum concurrent filterslogs-cap = 10000 # Max results from eth_getLogsblock-range-cap = 10000 # Max block range for eth_getLogs
# Start the nodeevmd start# Optional: Start with specific log levelevmd start --log_level debug# Optional: Start in backgroundevmd start > ~/.evmd/node.log 2>&1 &
Test Your Setup: Once your local node is running, try out the interactive JSON-RPC API Reference to explore all available methods.
(*note: some methods are disabled by default — see the RPC methods page and the node configuration for complete details.)
# Initialize with config fileevmd init mychain --config /path/to/config# Or start with configuration overrideevmd start --config /path/to/config
Environment Variables:
Copy
Ask AI
# Set via environmentexport EVMD_CHAIN_ID="custom-evm-1"export EVMD_EVM_CHAIN_ID="1234"export EVMD_DENOM="ucustom"# Initialize using environment variablesevmd init mychain
For high-performance local development and testing environments:
Advanced EVM Mempool Settings
Copy
Ask AI
# In app.toml - Advanced EVM Mempool Settings[evm]# EVM execution tracer for debugging complex transactionstracer = "json" # Options: "", "json", "struct", "access_list", "markdown"# Maximum gas for transactions in CheckTx mode (DoS protection)max-tx-gas-wanted = 40000000 # Set based on your block gas limit# Enable SHA3 preimage recording for debugging toolscache-preimage = true# EIP-155 replay protection chain ID (must match your network)evm-chain-id = 1337
Advanced JSON-RPC Configuration
Copy
Ask AI
# In app.toml - JSON-RPC Advanced Configuration[json-rpc]enable = trueenable-indexer = true# API namespaces (enable debug/personal for development)api = "eth,net,web3,txpool,debug,personal"# Resource limits for development environmentsgas-cap = 100000000 # Higher than default for complex testingtxfee-cap = 10 # 10 ETH maximum transaction feefilter-cap = 500 # More concurrent filters for heavy testingfeehistory-cap = 200 # Extended fee history for analyticslogs-cap = 20000 # Higher log return limitsblock-range-cap = 20000 # Extended block range for getLogs# Connection and performance settingsbatch-request-limit = 2000 # Higher batch limits for testing toolsbatch-response-max-size = 50000000 # 50MB response limitmax-open-connections = 200 # More concurrent connectionshttp-timeout = "60s" # Extended timeout for complex callshttp-idle-timeout = "300s" # 5-minute idle timeout# Development-specific security settingsallow-unprotected-txs = true # Allow non-EIP155 txs (dev only)allow-insecure-unlock = true # Enable personal namespace unlockingenable-profiling = true # Enable pprof endpoints for debugging# Advanced gas and fee configurationevm-timeout = "30s" # Extended timeout for eth_callfix-revert-gas-refund-height = 0 # Disable gas refund fix for testing
Chain ID Configuration: Unlike standard Cosmos SDK chains, the chain ID must be set in client configuration before running genesis transaction commands.
Background: EVM-specific initialization requires the chain ID to be present in client context for proper coin metadata setup. This differs from standard Cosmos SDK workflows where the chain ID is typically set later in the process.Workflow: Run evmd config set client chain-id <your-chain-id> after evmd init and before any gentx commands.
Process Management: Networks started with local_node.sh use background process management that differs from interactive mode.
Background: The local node script runs evmd as a background process, which continues running after terminal closure. This is different from typical development setups where processes stop with the terminal.Management: Use pkill -9 evmd or lsof -ti:8545 | xargs kill -9 to properly terminate background processes.
# Check if evmd is runningps aux | grep evmd# Check node statusevmd status# Verify accountsevmd keys list --keyring-backend test# Query balancesevmd q bank balances $(evmd keys show <keyname> --address)# Test JSON-RPC connectivitycurl -X POST -H "Content-Type: application/json" \ --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \ http://localhost:8545# Check which ports are in usenetstat -an | grep -E "(8545|26656|26657|1317|9090)"
These workflow differences will be streamlined in future releases to align more closely with standard Cosmos SDK patterns. The current setup steps ensure proper EVM initialization during network genesis.