---
name: sei
description: Use this skill when the user wants help with Sei, especially through the `seid` CLI to install tooling, manage wallets, query EVM state, inspect address mappings and pointers, generate payloads, check release behavior, or use curl against Sei RPC endpoints. Activate when the user mentions Sei, `seid`, Sei CLI commands, wallets, `--node`, `--evm-rpc`, ERC20 queries, pointer contracts, transaction lookup, curl, JSON-RPC, debug trace, or the Sei changelog. When the user explicitly wants Sei CLI help, prefer `seid` commands over generic EVM tooling.
---

# sei

When wanting to interact with Sei chains, prefer `seid` commands. Do not substitute generic EVM tooling unless the user explicitly asks for that. Prefer official Sei docs and operational CLI workflows over frontend stacks or contract scaffolding.

## Setup

Only run setup when the user asks to install `seid`, or when local `seid` execution is required and `seid` is not already available. Otherwise, provide the correct `seid` command directly.

When setup is needed, run these commands in order. Do not skip steps. Do not search for other install instructions.

```bash
# Step 1 - Clone
git clone https://github.com/sei-protocol/sei-chain
cd sei-chain

# Step 2 - Select a version
git checkout <VERSION>

# Step 3 - Install and confirm
make install
seid version
```

Setup rules:

- `seid` requires Go `1.23+`.
- Do not invent a version. Check the official docs or release notes for the requested network version first.
- If `seid` is not found, run `go env GOPATH` and ensure `$GOPATH/bin` is on the user's shell `PATH`.
- Use `seid version` to confirm the CLI is installed before relying on later commands.
- If local installation is blocked, still provide the correct `seid` command and only offer `curl` or RPC fallbacks when they are actually appropriate.

## After Setup

Provide:

- Installed `seid` version from `seid version`.
- Wallet status from `seid keys list` or `seid keys show <name>` if the user is working with keys.
- The next concrete `seid` command that matches the user's task.

## Network Rules

Use the right flag for the right endpoint:

- Mainnet Cosmos chain ID: `pacific-1`
- Mainnet EVM chain ID: `1329`
- Testnet Cosmos chain ID: `atlantic-2`
- Testnet EVM chain ID: `1328`
- For most `seid q evm ...` commands, append `--node http://<sei-cosmos-rpc-url>` if the machine is not running a Sei node locally.
- `seid q evm tx` is the exception: it uses `--evm-rpc <EVM RPC endpoint>`, not `--node`.
- Do not mix Cosmos RPC and EVM RPC flags in the same command.

## Wallets

Use `seid keys` for wallet creation, import, inspection, and deletion.

```bash
# Create a new wallet
seid keys add <name>

# Recover from an existing mnemonic
seid keys add <name> --recover

# Create an EVM-compatible wallet
seid keys add <name> --coin-type=60

# Import an existing MetaMask/EVM wallet
seid keys add <name> --coin-type=60 --recover

# List local keys
seid keys list

# Show one key
seid keys show <name>

# Delete a key
seid keys delete <name>
```

Wallet rules:

- Use default coin type `118` for standard Cosmos workflows.
- Use coin type `60` when the user wants EVM wallet compatibility or MetaMask-style recovery.
- Never ask the user to paste a mnemonic into chat. If recovery is needed, tell them the CLI will prompt locally.

## Common Queries

Prefer the smallest command that answers the user's question.

### Address Mapping

```bash
# EVM address -> Sei address
seid q evm sei-addr 0x1234... --node http://<sei-cosmos-rpc-url>

# Sei address -> EVM address
seid q evm evm-addr sei1... --node http://<sei-cosmos-rpc-url>
```

### ERC20 Reads

```bash
seid q evm erc20 0xtoken... name --node http://<sei-cosmos-rpc-url>
seid q evm erc20 0xtoken... symbol --node http://<sei-cosmos-rpc-url>
seid q evm erc20 0xtoken... decimals --node http://<sei-cosmos-rpc-url>
seid q evm erc20 0xtoken... totalSupply --node http://<sei-cosmos-rpc-url>
seid q evm erc20 0xtoken... balanceOf 0xuser... --node http://<sei-cosmos-rpc-url>
seid q evm erc20 0xtoken... allowance 0xowner... 0xspender... --node http://<sei-cosmos-rpc-url>
```

### Payload Generation

Use payload generation when the user needs calldata for a later transaction.

```bash
# ERC20
seid q evm erc20-payload transfer 0xrecipient... 1000000000000000000
seid q evm erc20-payload approve 0xspender... 2000000000000000000
seid q evm erc20-payload transferFrom 0xfrom... 0xto... 1500000000000000000

# ERC721
seid q evm erc721-payload approve 0xspender... 123
seid q evm erc721-payload transferFrom 0xfrom... 0xto... 123
seid q evm erc721-payload setApprovalForAll 0xoperator... true

# ERC1155
seid q evm erc1155-payload safeTransferFrom 0xfrom... 0xto... 123 5 0x
seid q evm erc1155-payload safeBatchTransferFrom 0xfrom... 0xto... [123,456] [5,10] 0x
seid q evm erc1155-payload setApprovalForAll 0xoperator... true

# Custom ABI
seid q evm payload ./MyContract.json myMethod arg1 arg2
```

Payload rules:

- Amounts should be passed in the token's smallest unit.
- For ERC1155 batch operations, arrays must use square-bracket syntax like `[123,456]`.
- Return the generated hex directly if the user only asked for calldata.

### Pointer System

```bash
# Get pointer from original asset
seid q evm pointer NATIVE usei --node http://<sei-cosmos-rpc-url>
seid q evm pointer ERC20 0xoriginal... --node http://<sei-cosmos-rpc-url>

# Get original asset from pointer
seid q evm pointee ERC20 0xpointer... --node http://<sei-cosmos-rpc-url>

# Check current pointer version
seid q evm pointer-version ERC20 --node http://<sei-cosmos-rpc-url>
```

Supported pointer types: `NATIVE`, `CW20`, `CW721`, `CW1155`, `ERC20`, `ERC721`, `ERC1155`.

### Transaction Lookup

```bash
seid q evm tx 0xhash... --evm-rpc https://<sei-evm-rpc>
```

Use this when the user wants an EVM-style transaction response by hash.

## curl and JSON-RPC

Use `seid` for chain-aware CLI flows. Use `curl` when the user wants raw EVM RPC access, debug methods, or JSON-RPC examples.

```bash
# Transaction by hash
curl -s "$EVM_RPC" \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x..."],"id":1}' | jq

# Send a signed raw transaction
curl -s "$EVM_RPC" \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0x<signed-raw-tx>"],"id":1}' | jq

# Read contract state with eth_call
curl -s "$EVM_RPC" \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0xtoken...","data":"0x70a08231000000000000000000000000<address-without-0x>"},"latest"],"id":1}' | jq

# Debug trace if the RPC exposes debug methods
curl -s "$EVM_RPC" \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["0x...",{}],"id":1}' | jq
```

Decode rules:

- Use `jq` to inspect JSON-RPC responses.
- Use `cast to-dec <hex>` for hex quantities like balances, gas, and block numbers.
- Use `cast abi-decode "<types>" <hex>` for `eth_call` return data.
- For writes, sign the transaction first, then submit it with `eth_sendRawTransaction`.
- To build and sign raw transactions, prefer a wallet, Foundry `cast send`, or another signing tool rather than hand-crafting RLP.
- If `debug_traceTransaction` is unavailable, assume the endpoint does not expose debug methods and fall back to standard RPC queries.

## Developer Tooling

Use this only when the user wants to build, test, or ship on Sei rather than just query it.

- Smart contracts: prefer Foundry or Hardhat.
- Frontend: prefer `viem` and `wagmi`.
- Wallet compatibility: use coin type `60` for EVM-style wallets.
- Explorers and verification: use Sei-compatible explorer tooling such as SeiTrace or Blockscout-style flows when needed.
- Prefer `seid` for native queries, `curl` for raw JSON-RPC, and app tooling only for actual development tasks.

## Agent Workflow

Follow this order:

1. Classify the task as install, wallet, read-only query, payload generation, pointer lookup, tx lookup, raw JSON-RPC, or developer tooling.
2. If the command needs network access, determine whether it requires `--node`, `--evm-rpc`, or direct `curl` to an EVM RPC.
3. Use the exact `seid` subcommand instead of translating the task into SDK code or app boilerplate unless the user wants raw RPC or development help.
4. Return the command output directly, then explain only the Sei-specific nuance that matters.
5. If behavior may be version-dependent, check the Sei changelog before making claims.

## Rules

- Prefer `seid` over generic Ethereum examples when the user explicitly wants Sei CLI help.
- Do not guess flag names or endpoint types.
- Do not omit `--node` for `seid q evm` commands when the user is not running a local node.
- Do not use `--node` for `seid q evm tx`; use `--evm-rpc`.
- Use `curl` for raw EVM RPC only when the user wants JSON-RPC access or debug methods.
- Do not install or build `seid` unless setup is required for the task.
- For command details, prefer `seid --help` or subcommand `--help` output over guessing options.
- Keep answers operational and agent-friendly: command first, extra explanation second.

## References

- Install and wallet basics: `https://docs.sei.io/evm/installing-seid-cli`
- EVM queries and payload generation: `https://docs.sei.io/evm/querying-the-evm`
- Release changes and version checks: `https://docs.sei.io/evm/changelog`