> ## Documentation Index
> Fetch the complete documentation index at: https://seilabs-docs-evm-cookbook.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Querying the EVM

> Read EVM state from the seid CLI: address associations, ERC20 reads, ABI-encoded payloads, and transaction details.

The `seid q evm` subcommands let you read EVM state (token data, address associations, and transactions). You do not need to send a transaction or run your own node.

## Prerequisites

If your machine does not run a Sei node, append the `--node` flag to every `seid q evm` command. Point it at a Sei Cosmos RPC endpoint, the same kind that `seid status` uses:

```bash theme={null}
--node https://<sei-cosmos-rpc-url>
```

The one exception is `seid q evm tx`, which uses `--evm-rpc` to point at an EVM JSON-RPC endpoint (port 8545 by convention). See [Transaction lookup](#transaction-lookup) below.

<Info>For a list of available RPC endpoints, see [RPC endpoints](/evm/networks).</Info>

<Info>
  **Output format.** Most commands print YAML by default. To get JSON, pass `-o json`. ERC20 read methods (such as `name` and `balanceOf`) return a bare value with no formatting. The output shown below is the raw stdout.
</Info>

## Address mapping

Sei addresses (`sei1…`) and EVM addresses (`0x…`) are linked through an on-chain association. The association is set the first time an account signs an EVM transaction or calls the address-association precompile. Until then, the two address spaces are independent.

### Get Sei address from EVM address

```bash theme={null}
seid q evm sei-addr [evm address]
```

**Example:**

```bash theme={null}
seid q evm sei-addr 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55
```

**Output:**

```yaml theme={null}
associated: true
sei_address: sei13ytysxs88z0fp9cssagg77ekpecrrlrwce9pwl
```

### Get EVM address from Sei address

```bash theme={null}
seid q evm evm-addr [sei address]
```

**Example:**

```bash theme={null}
seid q evm evm-addr sei13ytysxs88z0fp9cssagg77ekpecrrlrwce9pwl
```

**Output:**

```yaml theme={null}
associated: true
evm_address: 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55
```

<Info>If the account is not associated yet, `associated` is `false`, and the other field is empty. This is normal for accounts that have transacted on only one side of the chain.</Info>

## ERC20 contract queries

Call standard view methods on any ERC20 contract:

```bash theme={null}
seid q evm erc20 [contract address] [method] [arguments...]
```

**Example query for Wrapped Sei (`WSEI`):**

```bash theme={null}
seid q evm erc20 0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7 symbol
```

**Output:**

```
WSEI
```

**Example balance query:**

```bash theme={null}
seid q evm erc20 0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7 balanceOf 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55
```

**Output (raw integer, in the smallest unit):**

```
0
```

<Info>
  **Supported methods:**

  * `name`: token name
  * `symbol`: token symbol
  * `decimals`: token decimals
  * `totalSupply`: total supply
  * `balanceOf [address]`: balance of an address
  * `allowance [owner] [spender]`: current allowance

  For arbitrary methods or non-standard contracts, use [`payload`](#custom-abi) with the contract ABI.
</Info>

## Payload generation

These commands generate ABI-encoded calldata without sending a transaction. They are useful when you build `seid tx evm call-contract` calls or inspect expected calldata.

<Tabs>
  <Tab title="ERC20">
    ### ERC20 payload generation

    ```bash theme={null}
    seid q evm erc20-payload [method] [arguments...]
    ```

    **Transfer tokens (1 token, 18 decimals):**

    ```bash theme={null}
    seid q evm erc20-payload transfer 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55 1000000000000000000
    ```

    **Output:**

    ```
    a9059cbb000000000000000000000000da52b9e673d1f48fcd9916b3f606a136a8ea5e550000000000000000000000000000000000000000000000000de0b6b3a7640000
    ```

    **Approve a spender:**

    ```bash theme={null}
    seid q evm erc20-payload approve 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55 2000000000000000000
    ```

    **Output:**

    ```
    095ea7b3000000000000000000000000da52b9e673d1f48fcd9916b3f606a136a8ea5e550000000000000000000000000000000000000000000000001bc16d674ec80000
    ```

    **Transfer from (pulls tokens from `from` to `to`, based on an earlier `approve`):**

    ```bash theme={null}
    seid q evm erc20-payload transferFrom 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55 0xdEAD000000000000000042069420694206942069 1500000000000000000
    ```

    **Output:**

    ```
    23b872dd000000000000000000000000da52b9e673d1f48fcd9916b3f606a136a8ea5e55000000000000000000000000dead00000000000000004206942069420694206900000000000000000000000000000000000000000000000014d1120d7b160000
    ```

    <Info>
      **Supported methods:**

      * `transfer [to] [amount]`
      * `approve [spender] [amount]`
      * `transferFrom [from] [to] [amount]`

      Amounts are in the token's smallest unit: for example, wei for an 18-decimal token, or `1000000` for 1 USDC with 6 decimals.
    </Info>
  </Tab>

  <Tab title="ERC721">
    ### ERC721 payload generation

    ```bash theme={null}
    seid q evm erc721-payload [method] [arguments...]
    ```

    **Approve a token ID:**

    ```bash theme={null}
    seid q evm erc721-payload approve 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55 123
    ```

    **Output:**

    ```
    095ea7b3000000000000000000000000da52b9e673d1f48fcd9916b3f606a136a8ea5e55000000000000000000000000000000000000000000000000000000000000007b
    ```

    **Transfer a token:**

    ```bash theme={null}
    seid q evm erc721-payload transferFrom 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55 0xdEAD000000000000000042069420694206942069 123
    ```

    **Output:**

    ```
    23b872dd000000000000000000000000da52b9e673d1f48fcd9916b3f606a136a8ea5e55000000000000000000000000dead000000000000000042069420694206942069000000000000000000000000000000000000000000000000000000000000007b
    ```

    **Set operator approval:**

    ```bash theme={null}
    seid q evm erc721-payload setApprovalForAll 0xdEAD000000000000000042069420694206942069 true
    ```

    **Output:**

    ```
    a22cb465000000000000000000000000dead0000000000000000420694206942069420690000000000000000000000000000000000000000000000000000000000000001
    ```

    <Info>
      **Supported methods:**

      * `approve [spender] [tokenId]`
      * `transferFrom [from] [to] [tokenId]`
      * `setApprovalForAll [operator] [true|false]`
    </Info>
  </Tab>

  <Tab title="ERC1155">
    ### ERC1155 payload generation

    ```bash theme={null}
    seid q evm erc1155-payload [method] [arguments...]
    ```

    **Safe transfer:**

    ```bash theme={null}
    seid q evm erc1155-payload safeTransferFrom 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55 0xdEAD000000000000000042069420694206942069 123 5 0x
    ```

    **Output:**

    ```
    f242432a000000000000000000000000da52b9e673d1f48fcd9916b3f606a136a8ea5e55000000000000000000000000dead000000000000000042069420694206942069000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000
    ```

    **Safe batch transfer:**

    ```bash theme={null}
    seid q evm erc1155-payload safeBatchTransferFrom 0xDa52B9E673d1f48FcD9916b3F606A136a8eA5e55 0xdEAD000000000000000042069420694206942069 "[123,456]" "[5,10]" 0x
    ```

    **Set operator approval:**

    ```bash theme={null}
    seid q evm erc1155-payload setApprovalForAll 0xdEAD000000000000000042069420694206942069 true
    ```

    <Info>
      **Supported methods:**

      * `safeTransferFrom [from] [to] [tokenId] [amount] [data]`
      * `safeBatchTransferFrom [from] [to] [tokenIds] [amounts] [data]`
      * `setApprovalForAll [operator] [true|false]`

      For batch operations, pass arrays as quoted bracketed strings: `"[123,456]"`. The trailing `data` field is a hex string (use `0x` for empty data).
    </Info>
  </Tab>

  <Tab title="Custom ABI">
    ### Custom ABI payload generation

    To encode a call against any contract, supply its ABI:

    ```bash theme={null}
    seid q evm payload [abi-filepath] [method] [arguments...]
    ```

    **Example:**

    ```bash theme={null}
    seid q evm payload ./MyContract.json myMethod arg1 arg2
    ```

    <Info>
      The ABI file must be a JSON array of function definitions. It must have the same shape that Hardhat and Foundry emit: the `abi` field of an artifact, not the whole artifact.
    </Info>
  </Tab>
</Tabs>

## Pointer system

Pointers bridge the EVM and CosmWasm sides of Sei. A CW20 can be exposed as an ERC20 through an EVM pointer at a `0x` address. An ERC20 can be exposed as a CW20 through a CW pointer at a `sei1…` address. The same applies to NFTs (CW721 and ERC721) and multi-token contracts (CW1155 and ERC1155).

## Transaction lookup

### Query transaction by hash

This command is equivalent to `eth_getTransactionByHash`:

```bash theme={null}
seid q evm tx [hash] --evm-rpc [EVM RPC endpoint]
```

**Example:**

```bash theme={null}
seid q evm tx 0x828c91592453fe7c5bf743204495a35bf02b67b579b8f59ee7eea8af031d7c14 \
  --evm-rpc https://evm-rpc.sei-apis.com
```

**Output:**

```json theme={null}
{
  "blockHash": "0x5620c15afd9a1d0ab19d7560043df6e038d731c6205974dca7a55900071e3864",
  "blockNumber": "0xc5e1386",
  "from": "0xda52b9e673d1f48fcd9916b3f606a136a8ea5e55",
  "gas": "0x493e0",
  "gasPrice": "0xe1614bd00",
  "maxFeePerGas": "0xe1614bd00",
  "maxPriorityFeePerGas": "0xe1614bd00",
  "hash": "0x828c91592453fe7c5bf743204495a35bf02b67b579b8f59ee7eea8af031d7c14",
  "input": "0x9cab5684...",
  "nonce": "0x0",
  "to": "0x7507454444fa193d39f1392076bc784b77a7a8ff",
  "transactionIndex": "0x0",
  "value": "0x0",
  "type": "0x2",
  "accessList": [],
  "chainId": "0x531",
  "v": "0x0",
  "r": "0x468ac709b74e666834bcc740e5156e019fd0ba40cff7f8a59a46f08bff56eb2b",
  "s": "0x3496458ec06b57315721cf5e6be810b9548744a5dafab1739b8fdcff23939939",
  "yParity": "0x0"
}
```

<Info>
  This is the only `seid q evm` command that takes `--evm-rpc` (an EVM JSON-RPC endpoint, typically port 8545) instead of `--node` (a Cosmos RPC). If you omit the flag, the default is `http://0.0.0.0:8545`, which works only if you run a local node. For hosted EVM RPC endpoints, see [RPC endpoints](/evm/networks).
</Info>

## Common use cases

### Check token balance and info

```bash theme={null}
# Token metadata
seid q evm erc20 0xtoken... symbol
seid q evm erc20 0xtoken... decimals

# Balance (raw integer, in smallest unit)
seid q evm erc20 0xtoken... balanceOf 0xuser...
```

### Prepare and send a transaction

```bash theme={null}
# 1. Encode the calldata
PAYLOAD=$(seid q evm erc20-payload transfer 0xrecipient... 1000000000000000000)

# 2. Send via seid
seid tx evm call-contract 0xtoken... $PAYLOAD --from mykey
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.