Querying the EVM
What is EVM Querying?
EVM querying allows you to interact with Ethereum-compatible smart contracts and state on Sei using read-only methods. These queries can extract data such as balances, token information, and contract configurations without initiating a transaction.
Prerequisites
If your machine is not running a Sei node, you’ll need to append the following to all query commands:
--node http://<sei-cosmos-rpc-url>
Refer to the RPC endpoints at the bottom of this page for a list of available RPC endpoints.
Network Configuration
You must specify the correct RPC node if you are not running a local node:
--node http://<sei-cosmos-rpc-url>
Use this flag with all seid q evm
commands.
Address Mapping
Get Sei Address from EVM Address
seid q evm sei-addr [evm address]
Example:
seid q evm sei-addr 0x1234abcd5678ef...
Get EVM Address from Sei Address
seid q evm evm-addr [sei address]
Example:
seid q evm evm-addr sei1xyz...
ERC20 Contract Queries
Query standard ERC20 contract methods using:
seid q evm erc20 [contract address] [method] [arguments...]
Example:
seid q evm erc20 0xabc123... balanceOf 0xuser456...
Supported methods include balanceOf
, totalSupply
, symbol
, decimals
, and name
.
Payload Generation
Generate the raw call data for a contract method using its ABI:
seid q evm payload [method] [arguments...]
Example:
seid q evm payload transfer 0xrecipient... 1000
This is useful for manually crafting call-contract
transactions. Supported methods include transfer
, approve
, and transferFrom
.
Pointer Contract Lookup
Retrieve pointer contracts that bridge tokens between EVM and other environments (e.g. CosmWasm):
seid q evm pointer [type] [pointee]
- type:
NATIVE
,CW20
,CW721
,ERC20
, orERC721
- pointee: For tokens, this is the contract address; for
NATIVE
, use the denom (e.g.,usei
)
Examples:
# Get pointer for native denom
seid q evm pointer NATIVE usei
# Get pointer for an ERC20 token
seid q evm pointer ERC20 0xabc123...
Pointer contracts allow cross-environment interoperability between CosmWasm and EVM.