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>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...Output:
{
"sei_address": "sei1xyz...",
"associated": true
}Get EVM Address from Sei Address
seid q evm evm-addr [sei address]Example:
seid q evm evm-addr sei1xyz...Output:
{
"evm_address": "0x1234abcd5678ef...",
"associated": true
}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...Output:
500000000000000000000Supported methods:
name- Get token namesymbol- Get token symboldecimals- Get token decimalstotalSupply- Get total token supplybalanceOf [address]- Get balance of specific addressallowance [owner] [spender]- Get allowance amount
Payload Generation
Generate hex-encoded call data for contract methods. This is useful for crafting transactions manually.
ERC20
ERC20 Payload Generation
seid q evm erc20-payload [method] [arguments...]Transfer tokens:
seid q evm erc20-payload transfer 0xrecipient... 1000000000000000000Output:
a9059cbb000000000000000000000000recipient...0000000000000000000000000de0b6b3a7640000Approve spender:
seid q evm erc20-payload approve 0xspender... 2000000000000000000Output:
095ea7b3000000000000000000000000spender...0000000000000000000000001bc16d674ec80000Transfer from:
seid q evm erc20-payload transferFrom 0xfrom... 0xto... 1500000000000000000Output:
23b872dd000000000000000000000000from...000000000000000000000000to...00000000000000000000000014d1120d7b160000Supported methods:
transfer [to] [amount]- Transfer tokens to addressapprove [spender] [amount]- Approve spender for amounttransferFrom [from] [to] [amount]- Transfer tokens from one address to another
Amounts should be specified in the token’s smallest unit (e.g., wei for 18-decimal tokens).
Pointer System
The pointer system enables interoperability between different token standards (EVM, CosmWasm, Native).
Get Pointer Address
Retrieve pointer contracts that bridge tokens between EVM and other environments:
seid q evm pointer [type] [pointee]Example:
seid q evm pointer NATIVE useiOutput:
{
"pointer": "0xabc123...",
"version": 1,
"exists": true
}NATIVE, CW20, CW721, CW1155, ERC20, ERC721, ERC1155 Pointee: For tokens, use the contract address; for NATIVE, use the denom (e.g., usei)Get Pointee Address
Get the original contract address from a pointer:
seid q evm pointee [type] [pointer]Example:
seid q evm pointee ERC20 0xpointer123...Output:
{
"pointee": "0xoriginal456...",
"version": 1,
"exists": true
}Get Pointer Version
Query the current pointer version and stored code ID:
seid q evm pointer-version [type]Example:
seid q evm pointer-version ERC20Output:
{
"version": 1,
"cw_code_id": "123"
}Transaction Lookup
Query Transaction by Hash
Query for a transaction by its hash (equivalent to eth_getTransactionByHash):
seid q evm tx [hash] --evm-rpc [EVM RPC endpoint]Example:
seid q evm tx 0x1234567890abcdef... --evm-rpc http://127.0.0.1:8545Output:
{
"blockHash": "0xblock123...",
"blockNumber": "0x123",
"from": "0xsender...",
"gas": "0x5208",
"gasPrice": "0x3b9aca00",
"hash": "0x1234567890abcdef...",
"input": "0x",
"nonce": "0x1",
"to": "0xrecipient...",
"transactionIndex": "0x0",
"value": "0xde0b6b3a7640000",
"v": "0x1c",
"r": "0x...",
"s": "0x..."
}Note: This command is unique - it uses --evm-rpc flag with an EVM RPC endpoint (port 8545), not --node with a Cosmos RPC endpoint like other commands. By default, it uses http://127.0.0.1:8545 . Refer to the RPC endpoints at the bottom of this page for a list of available EVM RPC endpoints.
Common Use Cases
Check Token Balance and Info
# Get token info
seid q evm erc20 0xtoken... symbol
seid q evm erc20 0xtoken... decimals
# Check balance
seid q evm erc20 0xtoken... balanceOf 0xuser...Prepare Transaction Data
# Generate transfer payload
seid q evm erc20-payload transfer 0xrecipient... 1000000000000000000
# Use the output in a transaction
seid tx evm call-contract 0xtoken... [payload-from-above] --from mykeyBridge Token Information
# Find EVM pointer for a native token
seid q evm pointer NATIVE usei
# Find original contract from pointer
seid q evm pointee ERC20 0xpointer...seid tx evm call-contract transactions.