---
eip: 2015
label: EIP-2015
title: wallet_updateEthereumChain RPC Method
status: Stagnant
type: Standards Track
category: Interface
created: 2019-05-12
requires: 155
official: https://eips.ethereum.org/EIPS/eip-2015
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2015.md
canonical: https://eips.huatuo.xyz/eip-2015/
lang: en
tldr: Proposes wallet_updateEthereumChain, one RPC method that asks a wallet to switch to an EVM chain and add it first if the wallet does not know it yet.
tags: [wallet, json-rpc, chain-switching, dapp, interface]
---

# EIP-2015: wallet_updateEthereumChain RPC Method

> Adds an RPC method to switch between EVM-compatible chains

**TL;DR:** Proposes wallet_updateEthereumChain, one RPC method that asks a wallet to switch to an EVM chain and add it first if the wallet does not know it yet.

## What problem does it solve?

A dapp deployed on several EVM chains often needs the user's wallet to be on a specific one. Without a standard, the dapp could only display "please switch to network X" and hope the user found the right settings. If the wallet had never heard of that chain, the user also had to type in an RPC URL, chain ID and currency symbol by hand, which is error-prone and a phishing risk.

EIP-2015 defines a single wallet method that covers both cases: switch to a known chain, or register a new one and switch to it.

## How it works

The dapp calls `wallet_updateEthereumChain` through the wallet's provider with one object:

| Field | Required | Meaning |
| --- | --- | --- |
| `chainId` | yes | `0x`-prefixed [EIP-155](/eip-155/) chain ID |
| `chainName` | no | Display name |
| `rpcUrls` | no | RPC endpoints for the chain |
| `nativeCurrency` | no | `{ name, symbol, decimals }`, read like ERC-20 metadata |
| `blockExplorerUrl` | no | Block explorer URL |

Wallet behaviour:

- Everything except `chainId` is only a suggestion; the wallet may ignore or override it.
- The wallet **should** ask the user before switching or adding a chain, and **should** ship its own defaults for well-known chains to resist phishing.
- The wallet **must** sanitize each RPC URL, including checking that it answers `net_version` and `eth_chainId` correctly.
- On success, it returns `true` once the active chain matches the request. If the user declines, it returns error code `4001`.

## Sample code

Calling it from a dapp through an [EIP-1193](/eip-1193/) provider:

```ts
const ethereum = (window as any).ethereum;

try {
  await ethereum.request({
    method: "wallet_updateEthereumChain",
    params: [{
      chainId: "0x2a",                       // example values only
      chainName: "Example Chain",
      rpcUrls: ["https://rpc.example.org"],
      nativeCurrency: { name: "Example Ether", symbol: "EETH", decimals: 18 },
      blockExplorerUrl: "https://explorer.example.org",
    }],
  });
} catch (err: any) {
  if (err.code === 4001) console.log("User rejected the switch");
  else throw err;
}
```

What most wallets support today instead:

```ts
try {
  await ethereum.request({ method: "wallet_switchEthereumChain", params: [{ chainId: "0x2a" }] });
} catch (err: any) {
  if (err.code === 4902) { // chain not added yet (wallet-specific code)
    await ethereum.request({ method: "wallet_addEthereumChain", params: [chainParams] });
  }
}
```

## Things to know

- **Status: Stagnant.** Wallets did not adopt `wallet_updateEthereumChain`.
- The ecosystem standardized on two separate methods instead: [EIP-3085](/eip-3085/) `wallet_addEthereumChain` and [EIP-3326](/eip-3326/) `wallet_switchEthereumChain`. Both are themselves marked Stagnant but are widely implemented.
- Never trust RPC URLs supplied by a dapp blindly. The spec specifically warns of server-side request forgery and phishing.
- The `4902` "unrecognized chain" code in the second snippet is a common wallet convention, not part of this EIP.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-2015
