{"eip":2015,"title":"wallet_updateEthereumChain RPC Method","description":"Adds an RPC method to switch between EVM-compatible chains","authors":["Pedro Gomes (@pedrouid)","Erik Marks (@rekmarks)","Pandapip1 (@Pandapip1)"],"status":"Stagnant","type":"Standards Track","category":"Interface","created":"2019-05-12","requires":[155],"discussionsTo":"https://ethereum-magicians.org/t/eip-2015-wallet-update-chain-json-rpc-method-wallet-updatechain/3274","repo":"EIPs","label":"EIP-2015","officialUrl":"https://eips.ethereum.org/EIPS/eip-2015","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2015.md","url":"https://eips.huatuo.xyz/eip-2015/","tldr":{"en":"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.","ja":"wallet_updateEthereumChain を提案する。ウォレットに EVM チェーンへの切り替えを依頼し、ウォレットがそのチェーンを知らなければ先に追加させる 1 つの RPC メソッド。","ko":"wallet_updateEthereumChain을 제안한다. 지갑에 EVM 체인으로 전환하도록 요청하고, 지갑이 해당 체인을 아직 모르면 먼저 추가하게 하는 하나의 RPC 메서드.","zh":"提出 wallet_updateEthereumChain：一个 RPC 方法，请求钱包切换到某条 EVM 链，如果钱包尚不认识该链，则先添加。"},"tags":["wallet","json-rpc","chain-switching","dapp","interface"],"explainers":{"en":{"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"],"related":[155,3085,3326,1193],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2015/","markdown":"## What problem does it solve?\n\nA 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.\n\nEIP-2015 defines a single wallet method that covers both cases: switch to a known chain, or register a new one and switch to it.\n\n## How it works\n\nThe dapp calls `wallet_updateEthereumChain` through the wallet's provider with one object:\n\n| Field | Required | Meaning |\n| --- | --- | --- |\n| `chainId` | yes | `0x`-prefixed [EIP-155](/eip-155/) chain ID |\n| `chainName` | no | Display name |\n| `rpcUrls` | no | RPC endpoints for the chain |\n| `nativeCurrency` | no | `{ name, symbol, decimals }`, read like ERC-20 metadata |\n| `blockExplorerUrl` | no | Block explorer URL |\n\nWallet behaviour:\n\n- Everything except `chainId` is only a suggestion; the wallet may ignore or override it.\n- 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.\n- The wallet **must** sanitize each RPC URL, including checking that it answers `net_version` and `eth_chainId` correctly.\n- On success, it returns `true` once the active chain matches the request. If the user declines, it returns error code `4001`.\n\n## Sample code\n\nCalling it from a dapp through an [EIP-1193](/eip-1193/) provider:\n\n```ts\nconst ethereum = (window as any).ethereum;\n\ntry {\n  await ethereum.request({\n    method: \"wallet_updateEthereumChain\",\n    params: [{\n      chainId: \"0x2a\",                       // example values only\n      chainName: \"Example Chain\",\n      rpcUrls: [\"https://rpc.example.org\"],\n      nativeCurrency: { name: \"Example Ether\", symbol: \"EETH\", decimals: 18 },\n      blockExplorerUrl: \"https://explorer.example.org\",\n    }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"User rejected the switch\");\n  else throw err;\n}\n```\n\nWhat most wallets support today instead:\n\n```ts\ntry {\n  await ethereum.request({ method: \"wallet_switchEthereumChain\", params: [{ chainId: \"0x2a\" }] });\n} catch (err: any) {\n  if (err.code === 4902) { // chain not added yet (wallet-specific code)\n    await ethereum.request({ method: \"wallet_addEthereumChain\", params: [chainParams] });\n  }\n}\n```\n\n## Things to know\n\n- **Status: Stagnant.** Wallets did not adopt `wallet_updateEthereumChain`.\n- 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.\n- Never trust RPC URLs supplied by a dapp blindly. The spec specifically warns of server-side request forgery and phishing.\n- The `4902` \"unrecognized chain\" code in the second snippet is a common wallet convention, not part of this EIP.\n"},"ja":{"lang":"ja","tldr":"wallet_updateEthereumChain を提案する。ウォレットに EVM チェーンへの切り替えを依頼し、ウォレットがそのチェーンを知らなければ先に追加させる 1 つの RPC メソッド。","tags":["wallet","json-rpc","chain-switching","dapp","interface"],"related":[155,3085,3326,1193],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2015/","markdown":"## 何を解決するのか\n\n複数の EVM チェーンにデプロイされた dapp は、ユーザーのウォレットを特定のチェーンに合わせる必要がよくあります。標準がなければ、dapp は「ネットワーク X に切り替えてください」と表示して、ユーザーが正しい設定を見つけてくれることを期待するしかありません。ウォレットがそのチェーンを一度も知らない場合は、RPC URL、チェーン ID、通貨シンボルを手入力する必要もあり、ミスが起きやすくフィッシングのリスクもあります。\n\nEIP-2015 は、既知のチェーンへの切り替えと、新しいチェーンの登録と切り替えという両方のケースをカバーする 1 つのウォレットメソッドを定義します。\n\n## 仕組み\n\ndapp はウォレットの provider を通じて、1 つのオブジェクトを渡して `wallet_updateEthereumChain` を呼び出します。\n\n| フィールド | 必須 | 意味 |\n| --- | --- | --- |\n| `chainId` | はい | `0x` で始まる [EIP-155](/eip-155/) のチェーン ID |\n| `chainName` | いいえ | 表示名 |\n| `rpcUrls` | いいえ | そのチェーンの RPC エンドポイント |\n| `nativeCurrency` | いいえ | `{ name, symbol, decimals }`。ERC-20 のメタデータと同様に読み取る |\n| `blockExplorerUrl` | いいえ | ブロックエクスプローラーの URL |\n\nウォレットの挙動:\n\n- `chainId` 以外はすべて提案にすぎず、ウォレットは無視または上書きしてかまいません。\n- ウォレットはチェーンの切り替えや追加の前にユーザーに確認する**べき**であり、フィッシング対策として有名なチェーンには独自のデフォルト値を同梱する**べき**です。\n- ウォレットは各 RPC URL をサニタイズ**しなければなりません**。`net_version` と `eth_chainId` に正しく応答するかの確認も含みます。\n- 成功すると、アクティブなチェーンがリクエストと一致した時点で `true` を返します。ユーザーが拒否した場合はエラーコード `4001` を返します。\n\n## サンプルコード\n\n[EIP-1193](/eip-1193/) provider 経由で dapp から呼び出す例:\n\n```ts\nconst ethereum = (window as any).ethereum;\n\ntry {\n  await ethereum.request({\n    method: \"wallet_updateEthereumChain\",\n    params: [{\n      chainId: \"0x2a\",                       // example values only\n      chainName: \"Example Chain\",\n      rpcUrls: [\"https://rpc.example.org\"],\n      nativeCurrency: { name: \"Example Ether\", symbol: \"EETH\", decimals: 18 },\n      blockExplorerUrl: \"https://explorer.example.org\",\n    }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"User rejected the switch\");\n  else throw err;\n}\n```\n\n現在ほとんどのウォレットが代わりにサポートしているもの:\n\n```ts\ntry {\n  await ethereum.request({ method: \"wallet_switchEthereumChain\", params: [{ chainId: \"0x2a\" }] });\n} catch (err: any) {\n  if (err.code === 4902) { // chain not added yet (wallet-specific code)\n    await ethereum.request({ method: \"wallet_addEthereumChain\", params: [chainParams] });\n  }\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** ウォレットは `wallet_updateEthereumChain` を採用しませんでした。\n- エコシステムは代わりに 2 つの別々のメソッドで標準化しました。[EIP-3085](/eip-3085/) の `wallet_addEthereumChain` と [EIP-3326](/eip-3326/) の `wallet_switchEthereumChain` です。どちらも自身は Stagnant とされていますが、広く実装されています。\n- dapp から渡された RPC URL を鵜呑みにしてはいけません。仕様はサーバーサイドリクエストフォージェリとフィッシングについて特に警告しています。\n- 2 つ目のスニペットの `4902`「未知のチェーン」コードはウォレットの一般的な慣習であり、この EIP の一部ではありません。\n"},"ko":{"lang":"ko","tldr":"wallet_updateEthereumChain을 제안한다. 지갑에 EVM 체인으로 전환하도록 요청하고, 지갑이 해당 체인을 아직 모르면 먼저 추가하게 하는 하나의 RPC 메서드.","tags":["wallet","json-rpc","chain-switching","dapp","interface"],"related":[155,3085,3326,1193],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2015/","markdown":"## 어떤 문제를 해결하나요?\n\n여러 EVM 체인에 배포된 dapp은 사용자의 지갑이 특정 체인에 있어야 하는 경우가 많습니다. 표준이 없으면 dapp은 \"네트워크 X로 전환해 주세요\"라고 표시하고 사용자가 올바른 설정을 찾아 주기를 바랄 수밖에 없습니다. 지갑이 그 체인을 한 번도 본 적이 없다면 사용자가 RPC URL, 체인 ID, 통화 기호를 직접 입력해야 하는데, 실수하기 쉽고 피싱 위험도 있습니다.\n\nEIP-2015는 두 경우를 모두 다루는 하나의 지갑 메서드를 정의합니다. 이미 아는 체인으로 전환하거나, 새 체인을 등록한 뒤 전환합니다.\n\n## 어떻게 동작하나요?\n\ndapp은 지갑의 provider를 통해 객체 하나를 넘겨 `wallet_updateEthereumChain`을 호출합니다.\n\n| 필드 | 필수 | 의미 |\n| --- | --- | --- |\n| `chainId` | 예 | `0x`로 시작하는 [EIP-155](/eip-155/) 체인 ID |\n| `chainName` | 아니오 | 표시 이름 |\n| `rpcUrls` | 아니오 | 해당 체인의 RPC 엔드포인트 |\n| `nativeCurrency` | 아니오 | `{ name, symbol, decimals }`. ERC-20 메타데이터처럼 읽음 |\n| `blockExplorerUrl` | 아니오 | 블록 탐색기 URL |\n\n지갑의 동작:\n\n- `chainId`를 제외한 모든 값은 제안일 뿐이며, 지갑은 무시하거나 덮어쓸 수 있습니다.\n- 지갑은 체인을 전환하거나 추가하기 전에 사용자에게 물어봐야 **합니다(should)**. 또한 피싱에 대비해 잘 알려진 체인에 대해서는 자체 기본값을 내장해야 **합니다(should)**.\n- 지갑은 각 RPC URL을 정제해야 **합니다(must)**. `net_version`과 `eth_chainId`에 올바르게 응답하는지 확인하는 것도 포함됩니다.\n- 성공하면 활성 체인이 요청과 일치한 시점에 `true`를 반환합니다. 사용자가 거부하면 에러 코드 `4001`을 반환합니다.\n\n## 샘플 코드\n\n[EIP-1193](/eip-1193/) provider를 통해 dapp에서 호출하기:\n\n```ts\nconst ethereum = (window as any).ethereum;\n\ntry {\n  await ethereum.request({\n    method: \"wallet_updateEthereumChain\",\n    params: [{\n      chainId: \"0x2a\",                       // example values only\n      chainName: \"Example Chain\",\n      rpcUrls: [\"https://rpc.example.org\"],\n      nativeCurrency: { name: \"Example Ether\", symbol: \"EETH\", decimals: 18 },\n      blockExplorerUrl: \"https://explorer.example.org\",\n    }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"User rejected the switch\");\n  else throw err;\n}\n```\n\n대부분의 지갑이 현재 대신 지원하는 방식:\n\n```ts\ntry {\n  await ethereum.request({ method: \"wallet_switchEthereumChain\", params: [{ chainId: \"0x2a\" }] });\n} catch (err: any) {\n  if (err.code === 4902) { // chain not added yet (wallet-specific code)\n    await ethereum.request({ method: \"wallet_addEthereumChain\", params: [chainParams] });\n  }\n}\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 지갑들은 `wallet_updateEthereumChain`을 채택하지 않았습니다.\n- 생태계는 대신 두 개의 별도 메서드로 표준화되었습니다. [EIP-3085](/eip-3085/)의 `wallet_addEthereumChain`과 [EIP-3326](/eip-3326/)의 `wallet_switchEthereumChain`입니다. 둘 다 스스로는 Stagnant로 표시되어 있지만 널리 구현되어 있습니다.\n- dapp이 제공한 RPC URL을 맹목적으로 신뢰하지 마세요. 스펙은 서버 측 요청 위조와 피싱에 대해 특히 경고합니다.\n- 두 번째 스니펫의 `4902` \"알 수 없는 체인\" 코드는 지갑들의 일반적인 관례이며 이 EIP의 일부가 아닙니다.\n"},"zh":{"lang":"zh","tldr":"提出 wallet_updateEthereumChain：一个 RPC 方法，请求钱包切换到某条 EVM 链，如果钱包尚不认识该链，则先添加。","tags":["wallet","json-rpc","chain-switching","dapp","interface"],"related":[155,3085,3326,1193],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2015/","markdown":"## 它解决什么问题？\n\n部署在多条 EVM 链上的 dapp 往往需要用户的钱包处于特定链上。没有标准时，dapp 只能显示\"请切换到网络 X\"，并指望用户能找到正确的设置。如果钱包从未听说过这条链，用户还得手动输入 RPC URL、链 ID 和货币符号，既容易出错，也有钓鱼风险。\n\nEIP-2015 定义了一个钱包方法，同时覆盖两种情况：切换到已知链，或注册一条新链并切换过去。\n\n## 它如何运作\n\ndapp 通过钱包的 provider 调用 `wallet_updateEthereumChain`，传入一个对象：\n\n| 字段 | 必填 | 含义 |\n| --- | --- | --- |\n| `chainId` | 是 | 以 `0x` 开头的 [EIP-155](/eip-155/) 链 ID |\n| `chainName` | 否 | 显示名称 |\n| `rpcUrls` | 否 | 该链的 RPC 端点 |\n| `nativeCurrency` | 否 | `{ name, symbol, decimals }`，读取方式与 ERC-20 元数据相同 |\n| `blockExplorerUrl` | 否 | 区块浏览器 URL |\n\n钱包的行为：\n\n- 除 `chainId` 外，其余都只是建议，钱包可以忽略或覆盖。\n- 钱包**应当**在切换或添加链之前询问用户，并且**应当**为知名链内置自己的默认值以抵御钓鱼。\n- 钱包**必须**清理每个 RPC URL，包括检查它是否能正确响应 `net_version` 和 `eth_chainId`。\n- 成功时，一旦活动链与请求一致，就返回 `true`。如果用户拒绝，则返回错误码 `4001`。\n\n## 示例代码\n\n通过 [EIP-1193](/eip-1193/) provider 从 dapp 调用：\n\n```ts\nconst ethereum = (window as any).ethereum;\n\ntry {\n  await ethereum.request({\n    method: \"wallet_updateEthereumChain\",\n    params: [{\n      chainId: \"0x2a\",                       // example values only\n      chainName: \"Example Chain\",\n      rpcUrls: [\"https://rpc.example.org\"],\n      nativeCurrency: { name: \"Example Ether\", symbol: \"EETH\", decimals: 18 },\n      blockExplorerUrl: \"https://explorer.example.org\",\n    }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"User rejected the switch\");\n  else throw err;\n}\n```\n\n目前大多数钱包实际支持的做法：\n\n```ts\ntry {\n  await ethereum.request({ method: \"wallet_switchEthereumChain\", params: [{ chainId: \"0x2a\" }] });\n} catch (err: any) {\n  if (err.code === 4902) { // chain not added yet (wallet-specific code)\n    await ethereum.request({ method: \"wallet_addEthereumChain\", params: [chainParams] });\n  }\n}\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 钱包并未采用 `wallet_updateEthereumChain`。\n- 生态系统转而标准化为两个独立的方法：[EIP-3085](/eip-3085/) 的 `wallet_addEthereumChain` 和 [EIP-3326](/eip-3326/) 的 `wallet_switchEthereumChain`。两者本身也被标记为 Stagnant，但已被广泛实现。\n- 切勿盲目信任 dapp 提供的 RPC URL。规范特别警告了服务端请求伪造和钓鱼。\n- 第二段代码中的 `4902`\"未识别的链\"错误码是钱包的常见约定，并不属于本 EIP。\n"}}}
