Skip to content

Latest commit

 

History

History
89 lines (68 loc) · 4.68 KB

File metadata and controls

89 lines (68 loc) · 4.68 KB

Sei Agent Kit

You are working with the Sei blockchain through an MCP server. Sei is dual-stack: a single chain with two address spaces and two transaction surfaces — EVM (0x..., viem) and Cosmos (sei..., cosmjs). This file tells you how to interact with it safely.

⚠️ MAINNET — REAL FUNDS. The default network is Sei mainnet pacific-1 (EVM chainId 1329). prepare_* / cosmos_prepare_* move real SEI. Prefer secure mode with manual approval (npm run signer -- --manual) so every signature needs your y/n. Fund the address from an exchange/bridge.

Addresses

One key controls both:

  • EVM WALLET_ADDRESS (0x...) — read with grep WALLET_ADDRESS .env | cut -d'=' -f2
  • Cosmos COSMOS_ADDRESS (sei...) — read with grep COSMOS_ADDRESS .env | cut -d'=' -f2

These are the ONLY two values you may read from .env.

MCP Server

The Sei MCP server is connected via .mcp.json (https://api.seistream.app/mcp). Tool naming: *_evm_* = EVM side, *_cosmos_* = Cosmos side. Key tools:

  • EVM transactions (write): prepare_native_transfer, prepare_erc20_transfer, prepare_transaction, prepare_contract_write, broadcast_signed_raw_transaction, wait_for_transaction
  • EVM read: get_balance, get_token_balance, get_evm_account_by_address, list_evm_blocks, get_evm_transaction_by_hash, read_evm_contract
  • EVM contracts (verify): get_evm_compiler_versions, verify_evm_contract_standard_json, verify_evm_contract_flattened
  • Cosmos transactions (write): cosmos_prepare_send, cosmos_prepare_delegate, cosmos_prepare_undelegate, cosmos_prepare_claim_rewards, cosmos_prepare_ibc_transfer, cosmos_broadcast_signed_tx, cosmos_simulate_tx
  • Cosmos read: cosmos_get_balance, cosmos_get_account, get_cosmos_account_delegations, get_cosmos_account_rewards, list_cosmos_validators, list_cosmos_proposals
  • Sei-specific: get_pointer_mapping / list_pointer_mappings (EVM↔Cosmos), explorer_search, get_chain_network, get_chain_tokenomics

Amounts: EVM native is wei (1 SEI = 1e18 wei); prepare_native_transfer takes decimal SEI. Cosmos amounts are usei (1 SEI = 1e6 usei).

SECURITY RULES — MANDATORY

NEVER do any of the following:

  • Read the .env file (cat, head, tail, less, grep PRIVATE_KEY, or any method)
  • Read the .keystore/ directory or any file in it
  • Access, print, or log the PRIVATE_KEY environment variable
  • Run env, printenv, set, or export to list environment variables
  • Use generate_disposable_test_wallet / generate_disposable_cosmos_wallet
  • Store, display, or transmit any private key in any form

You may ONLY read these from .env:

grep WALLET_ADDRESS .env | cut -d'=' -f2
grep COSMOS_ADDRESS .env | cut -d'=' -f2

Signing Flows

You CANNOT sign directly. The signing bridge (AI SDK path) or the sign scripts do it locally.

EVM

  1. Prepare via MCP: prepare_native_transfer / prepare_transaction → unsigned tx.
  2. Sign: echo '<unsigned_tx_json>' | npx tsx scripts/sign-tx.ts → signed hex.
  3. Broadcast: broadcast_signed_raw_transaction with the signed hex.
  4. Confirm: wait_for_transaction with the hash.

Cosmos

  1. Prepare via MCP: cosmos_prepare_send / cosmos_prepare_delegate / … → Direct-sign doc.
  2. Sign: echo '<prepared_json>' | npx tsx scripts/sign-cosmos-tx.ts → base64 txBytes.
  3. Broadcast: cosmos_broadcast_signed_tx with txBytes.
  4. Confirm: get_cosmos_transaction_by_hash with the returned hash.

Staking (Cosmos-native)

Sei staking is native Cosmos staking — not an EVM contract.

  1. list_cosmos_validators → pick a seivaloper... (note commission).
  2. cosmos_prepare_delegate (delegator=sei..., validator, amount in usei).
  3. Sign (Cosmos) → cosmos_broadcast_signed_tx → confirm with get_cosmos_account_delegations. Undelegate via cosmos_prepare_undelegate; claim with cosmos_prepare_claim_rewards.

Contract Deployment (EVM)

  1. Read bytecode from contracts/compiled/SimpleStorage.json.
  2. prepare_transaction with from=EVM addr, no to, data=bytecode.
  3. Sign (EVM) → broadcast_signed_raw_transaction → wait_for_transaction; the receipt's contractAddress is the deployed address.
  4. Verify: get_evm_compiler_versions → verify_evm_contract_standard_json.

Available Scripts (USER runs these, not the agent)

  • npx tsx scripts/sign-tx.ts — sign EVM tx (stdin JSON → stdout signed hex)
  • npx tsx scripts/sign-cosmos-tx.ts — sign Cosmos tx (stdin JSON → stdout base64)
  • npx tsx scripts/wallet-manager.ts — wallet management
  • npx tsx scripts/signer-daemon.ts — signing daemon (secure mode)