Skip to content
wallet.page

Chains

Every EVM network has a chainId — a hex-encoded integer that wallets and dapps use to agree on which chain they're talking about. Three RPCs cover the basics: read the active chain, switch to one the wallet already knows, or register a new one entirely.

eth_chainId

Returns the chainId the wallet is currently active on. No user prompt, no approval flow — just a read. A well-implemented wallet should always respond to this, even before any accounts are connected.

RPC: eth_chainId → hex string (e.g. 0x1)

eth_chainId

Read the wallet's active chain (hex).

Connect on /connect first.

wallet_switchEthereumChain (EIP-3326)

Asks the wallet to switch to a chain it already has configured. The user may see a confirmation prompt depending on the wallet; some switch silently if the chain is already in their list.

RPC: wallet_switchEthereumChain({ chainId })

wallet_switchEthereumChain

Switch to Sepolia (0xaa36a7).

Connect on /connect first.

wallet_addEthereumChain (EIP-3085)

Prompts the user to add a new chain to their wallet, providing the minimum required metadata: RPC endpoint, native currency details, chain name, and chainId. Once added, the chain is available for future switches without repeating this call.

RPC: wallet_addEthereumChain({ chainId, chainName, rpcUrls, nativeCurrency, ... })

wallet_addEthereumChain

Register Sepolia in the wallet (RPC + currency).

Connect on /connect first.