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 { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

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

Runtime Info

Pallet
EVMChainId
Storage Kind
Plain
First Version
v210
Current Version
v393