节点要求要使用 query 和 tx 命令,你的 evmd 节点必须满足以下任一条件:
- 与你正在交互的网络完全同步,或
- 已配置为在
~/.evmd/config/client.toml 中使用外部 RPC 端点
client.toml 配置示例:
# The network chain ID
chain-id = "myapp-1"
# The keyring's backend
keyring-backend = "os"
# CLI output format
output = "text"
# <host>:<port> to CometBFT RPC interface for this chain
node = "tcp://localhost:26657"
# Transaction broadcasting mode (sync|async)
broadcast-mode = "sync"
如果要使用外部 RPC,请更新 node 字段,使其指向一个公共或私有 RPC 端点。
全局参数
这些参数适用于所有命令:
| 参数 | 说明 | 默认值 |
|---|
-b, --broadcast-mode | 交易广播模式(sync|async) | sync |
--chain-id | 指定发送交易时使用的 Chain ID | |
--fees | 与交易一同支付的手续费(例如 10atest) | |
--from | 用于签名的私钥名称或地址 | |
--gas-adjustment | 乘以交易模拟返回估算值的调整系数 | 1 |
--gas-prices | 用于确定交易手续费的 Gas 价格(例如 10atest) | |
--home | 配置和数据目录 | ~/.evmd |
--keyring-backend | 选择 keyring 后端 | os |
--log_format | 日志格式(json|plain) | plain |
--log_level | 日志级别 | info |
--log_no_color | 禁用彩色日志 | |
--node | 连接到 CometBFT RPC 接口的 <host>:<port> | tcp://localhost:26657 |
--trace | 出错时打印完整堆栈跟踪 | |
节点操作
密钥管理
EVM 查询
ERC20 查询
Feemarket 查询
Precisebank 查询
Cosmos SDK 查询
EVM 交易
ERC20 交易
Cosmos SDK 交易
高级命令
启动节点
节点初始化
evmd init my-node --chain-id cosmos-evm-1
节点状态
交易索引
evmd index-eth-tx forward
账户管理
密钥操作
以太坊密钥导入/导出
evmd keys unsafe-export-eth-key my-eth-account
账户与余额查询
evmd query evm account 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81
合约查询
evmd query evm code 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
配置与参数
地址转换
evmd query evm 0x-to-bech32 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81
代币对查询
evmd query erc20 token-pairs
费用市场信息
evmd query feemarket base-fee
精度银行
evmd query precisebank remainder
Bank 模块
evmd query bank balances cosmos1wsk4trnzfszs55jlt5ugz76lwl2hp04slh5s5s
Staking 模块
evmd query staking validators
Distribution 模块
evmd query distribution rewards \
cosmos1wsk4trnzfszs55jlt5ugz76lwl2hp04slh5s5s \
cosmosvaloper1xyz...
Governance 模块
EVM 转账
evmd tx evm send \
my-account \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81 \
1000000atest \
--gas-prices 10atest
代币转换
evmd tx erc20 convert-coin \
1000000atest \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81 \
--from my-account \
--gas-prices 10atest
治理操作
evmd tx erc20 register-erc20 \
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
--from validator
Bank 交易
evmd tx bank send \
my-account \
cosmos1abc... \
1000000atest \
--gas-prices 10atest
Staking 交易
evmd tx staking delegate \
cosmosvaloper1abc... \
1000000atest \
--from my-account \
--gas-prices 10atest
治理交易
evmd tx gov submit-proposal \
--title="Upgrade Proposal" \
--description="Upgrade to v2.0.0" \
--type="Text" \
--deposit="1000000atest" \
--from my-account
Genesis 操作
evmd genesis add-genesis-account \
cosmos1abc... \
1000000000atest
CometBFT 命令
调试工具
evmd debug addr cosmos1abc...
完整工作流
# 创建新的 Cosmos 账户
evmd keys add my-account
# 请妥善保存助记词!
# 将显示地址,格式为 cosmos1...
# 查询 Cosmos 账户
evmd query bank balances \
cosmos1wsk4trnzfszs55jlt5ugz76lwl2hp04slh5s5s
# 查询 EVM 账户
evmd query evm account \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81
# 通过 bank 模块发送代币
evmd tx bank send \
my-account \
cosmos1abc... \
1000000atest \
--gas-prices 10atest \
--gas-adjustment 1.5
- 配置目录:
~/.evmd/
- 密钥存储:由 keyring 后端管理(os、file、test)
- 节点配置:
~/.evmd/config/config.toml
- 应用配置:
~/.evmd/config/app.toml
如果你在初始化轻客户端时使用 --home 标志,根目录/config 目录将会在该位置生成
Node RequirementsTo use the query and tx commands, your evmd node must either:
- Be fully synced with the network you’re interacting with, OR
- Be configured to use an external RPC endpoint in
~/.evmd/config/client.toml
Example client.toml configuration:# The network chain ID
chain-id = "myapp-1"
# The keyring's backend
keyring-backend = "os"
# CLI output format
output = "text"
# <host>:<port> to CometBFT RPC interface for this chain
node = "tcp://localhost:26657"
# Transaction broadcasting mode (sync|async)
broadcast-mode = "sync"
To use an external RPC, update the node field to point to a public or private RPC endpoint.
Global Flags
These flags are available for all commands:
| Flag | Description | Default |
|---|
-b, --broadcast-mode | Transaction broadcasting mode (sync|async) | sync |
--chain-id | Specify Chain ID for sending Tx | |
--fees | Fees to pay along with transaction (e.g., 10atest) | |
--from | Name or address of private key with which to sign | |
--gas-adjustment | Adjustment factor to multiply against the estimate returned by tx simulation | 1 |
--gas-prices | Gas prices to determine the transaction fee (e.g., 10atest) | |
--home | Directory for config and data | ~/.evmd |
--keyring-backend | Select keyring’s backend | os |
--log_format | The logging format (json|plain) | plain |
--log_level | The logging level | info |
--log_no_color | Disable colored logs | |
--node | <host>:<port> to CometBFT RPC interface | tcp://localhost:26657 |
--trace | Print out full stack trace on errors | |
Commands
Node Operations
Key Management
EVM Queries
ERC20 Queries
Feemarket Queries
Precisebank Queries
Cosmos SDK Queries
EVM Transactions
ERC20 Transactions
Cosmos SDK Transactions
Advanced Commands
Starting the Node
Node Initialization
evmd init my-node --chain-id cosmos-evm-1
Node Status
Transaction Indexing
evmd index-eth-tx forward
Account Management
Key Operations
Ethereum Key Import/Export
evmd keys unsafe-export-eth-key my-eth-account
Account & Balance Queries
evmd query evm account 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81
Contract Queries
evmd query evm code 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Configuration & Parameters
Address Conversion
evmd query evm 0x-to-bech32 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81
Token Pair Queries
evmd query erc20 token-pairs
evmd query feemarket base-fee
Precision Banking
evmd query precisebank remainder
Bank Module
evmd query bank balances cosmos1wsk4trnzfszs55jlt5ugz76lwl2hp04slh5s5s
Staking Module
evmd query staking validators
Distribution Module
evmd query distribution rewards \
cosmos1wsk4trnzfszs55jlt5ugz76lwl2hp04slh5s5s \
cosmosvaloper1xyz...
Governance Module
EVM Transfers
evmd tx evm send \
my-account \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81 \
1000000atest \
--gas-prices 10atest
Token Conversions
evmd tx erc20 convert-coin \
1000000atest \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81 \
--from my-account \
--gas-prices 10atest
Governance Operations
evmd tx erc20 register-erc20 \
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
--from validator
Bank Transactions
evmd tx bank send \
my-account \
cosmos1abc... \
1000000atest \
--gas-prices 10atest
Staking Transactions
evmd tx staking delegate \
cosmosvaloper1abc... \
1000000atest \
--from my-account \
--gas-prices 10atest
Governance Transactions
evmd tx gov submit-proposal \
--title="Upgrade Proposal" \
--description="Upgrade to v2.0.0" \
--type="Text" \
--deposit="1000000atest" \
--from my-account
Genesis Operations
evmd genesis add-genesis-account \
cosmos1abc... \
1000000000atest
CometBFT Commands
Debug Utilities
evmd debug addr cosmos1abc...
Examples
Complete Workflows
Account Setup
Query Examples
Transactions
# Create new Cosmos account
evmd keys add my-account
# Save mnemonic safely!
# Address will be shown as cosmos1...
# Query Cosmos account
evmd query bank balances \
cosmos1wsk4trnzfszs55jlt5ugz76lwl2hp04slh5s5s
# Query EVM account
evmd query evm account \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb81
# Send tokens via bank module
evmd tx bank send \
my-account \
cosmos1abc... \
1000000atest \
--gas-prices 10atest \
--gas-adjustment 1.5
Configuration
- Configuration directory:
~/.evmd/
- Key storage: Managed by the keyring backend (os, file, test)
- Node configuration:
~/.evmd/config/config.toml
- App configuration:
~/.evmd/config/app.toml
If you use the --home flag upon initializing the light client, the root/config directory will be generated there