ChainId

Storage Plain v210 → current

The EVM chain ID for this network.

Explore chain
Queried by: developerswallets

The Big Picture

The chain ID is critical for Ethereum compatibility - it's included in transaction signatures to prevent replay attacks across different networks. Wallets need this to sign correctly.

Use Cases

  • Configure wallet chain ID
  • Validate transaction signatures
  • Prevent replay attacks across chains

From Chain Metadata

The EVM chain ID.

Purpose & Usage

Purpose

Stores the chain ID used for Ethereum transaction signing.

Common Query Patterns

  • Single value query

Stored Value

Value in RAO (÷10⁹ for TAO)

RAO -> TAO (/ 10^9)

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query ChainId storage (no keys - plain value)
const result = await api.query.EVMChainId.ChainId.getValue();
console.log("ChainId:", result);

Runtime Info

Pallet
EVMChainId
Storage Kind
Plain
First Version
v210
Current Version
v411