{"eip":3085,"title":"wallet_addEthereumChain RPC Method","description":"Adds an RPC method to add EVM-compatible chains","authors":["Erik Marks (@rekmarks)","Pedro Gomes (@pedrouid)","Pandapip1 (@Pandapip1)"],"status":"Stagnant","type":"Standards Track","category":"Interface","created":"2020-11-01","requires":[155],"discussionsTo":"https://ethereum-magicians.org/t/eip-3085-wallet-addethereumchain/5469","repo":"EIPs","label":"EIP-3085","officialUrl":"https://eips.ethereum.org/EIPS/eip-3085","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3085.md","url":"https://eips.huatuo.xyz/eip-3085/","tldr":{"en":"The wallet_addEthereumChain RPC method that lets a dapp ask a wallet to add an EVM chain (chain ID, RPC URLs, currency, explorer), with the user approving the request.","ja":"dapp がウォレットに EVM チェーン（チェーン ID、RPC URL、通貨、エクスプローラー）の追加を依頼し、ユーザーがそのリクエストを承認する wallet_addEthereumChain RPC メソッド。","ko":"dapp이 지갑에 EVM 체인(체인 ID, RPC URL, 통화, 탐색기) 추가를 요청하고 사용자가 그 요청을 승인하는 wallet_addEthereumChain RPC 메서드.","zh":"wallet_addEthereumChain RPC 方法让 dapp 请求钱包添加一条 EVM 链（链 ID、RPC URL、货币、浏览器），由用户批准该请求。"},"tags":["wallet","json-rpc","multichain","interface","dapp"],"explainers":{"en":{"lang":"en","tldr":"The wallet_addEthereumChain RPC method that lets a dapp ask a wallet to add an EVM chain (chain ID, RPC URLs, currency, explorer), with the user approving the request.","tags":["wallet","json-rpc","multichain","interface","dapp"],"related":[3326,1193,155,695,3014],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3085/","markdown":"## What problem does it solve?\n\nA dapp deployed on an L2 or sidechain needs the user's wallet to know about that network. Without a standard, users had to copy a chain ID, RPC URL and currency symbol into wallet settings by hand, which is error-prone and easy to phish.\n\nERC-3085 defines one wallet-namespaced method a site can call to *suggest* a chain. The wallet validates the data, shows it to the user, and adds the chain only if they approve.\n\n## How it works\n\n`wallet_addEthereumChain` takes one object:\n\n```ts\ninterface AddEthereumChainParameter {\n  chainId: string;              // hex string, e.g. \"0xa\"\n  chainName?: string;\n  rpcUrls?: string[];\n  nativeCurrency?: { name: string; symbol: string; decimals: number };\n  blockExplorerUrls?: string[];\n  iconUrls?: string[];\n}\n```\n\nKey rules from the spec:\n\n- Only `chainId` is required by the type, but the wallet **must** reject the request if `rpcUrls` is missing or empty, and if `chainId` does not match what `eth_chainId` returns from the RPC URLs.\n- URLs must be valid and must not use `http:` or `file:`.\n- If `nativeCurrency` is given, all three fields are required.\n- It returns `null` on success, an error otherwise. The wallet may reject for any reason.\n- Adding a chain does **not** mean it becomes selected. Re-adding an existing chain should succeed (unless the user declines), and the same chain ID must not be added twice.\n\n## Sample code\n\nAdding a chain through an [EIP-1193](/eip-1193/) provider, then switching to it:\n\n```ts\nconst params = {\n  chainId: \"0xa\", // 10\n  chainName: \"OP Mainnet\",\n  nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n  rpcUrls: [\"https://mainnet.optimism.io\"],\n  blockExplorerUrls: [\"https://optimistic.etherscan.io\"],\n};\n\ntry {\n  await window.ethereum.request({ method: \"wallet_addEthereumChain\", params: [params] });\n  // Adding does not select it; ask to switch explicitly (EIP-3326)\n  await window.ethereum.request({\n    method: \"wallet_switchEthereumChain\",\n    params: [{ chainId: params.chainId }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"user rejected\");\n  else throw err;\n}\n```\n\n## Things to know\n\n- Status is **Stagnant**, though the method is widely supported in practice by browser wallets such as MetaMask. Behaviour details (which fields are required, whether the chain is auto-selected) still vary by wallet.\n- Switching is a separate concern, proposed in [EIP-3326](/eip-3326/) `wallet_switchEthereumChain`.\n- The chain ID is the [EIP-155](/eip-155/) replay-protection ID, formatted as in [EIP-695](/eip-695/). Wallets should sign with the submitted chain ID, never one reported by an RPC endpoint.\n- Security guidance in the spec: warn users that RPC endpoints see their IP and activity, treat icons as untrusted, prefer the wallet's own known-chain metadata, and avoid leaking which chains the user already has by auto-approving duplicates.\n"},"ja":{"lang":"ja","tldr":"dapp がウォレットに EVM チェーン（チェーン ID、RPC URL、通貨、エクスプローラー）の追加を依頼し、ユーザーがそのリクエストを承認する wallet_addEthereumChain RPC メソッド。","tags":["wallet","json-rpc","multichain","interface","dapp"],"related":[3326,1193,155,695,3014],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3085/","markdown":"## 何を解決するのか\n\nL2 やサイドチェーンにデプロイされた dapp は、ユーザーのウォレットがそのネットワークを知っている必要があります。標準がなければ、ユーザーはチェーン ID、RPC URL、通貨シンボルをウォレットの設定に手作業でコピーする必要があり、ミスが起きやすくフィッシングも簡単でした。\n\nERC-3085 は、サイトがチェーンを*提案*するために呼び出せる、wallet 名前空間のメソッドを 1 つ定義します。ウォレットはデータを検証してユーザーに表示し、ユーザーが承認した場合にのみチェーンを追加します。\n\n## 仕組み\n\n`wallet_addEthereumChain` は 1 つのオブジェクトを受け取ります。\n\n```ts\ninterface AddEthereumChainParameter {\n  chainId: string;              // hex string, e.g. \"0xa\"\n  chainName?: string;\n  rpcUrls?: string[];\n  nativeCurrency?: { name: string; symbol: string; decimals: number };\n  blockExplorerUrls?: string[];\n  iconUrls?: string[];\n}\n```\n\n仕様の主なルール:\n\n- 型として必須なのは `chainId` だけですが、`rpcUrls` がない、または空の場合、および `chainId` が RPC URL から `eth_chainId` で返される値と一致しない場合、ウォレットはリクエストを拒否**しなければなりません**。\n- URL は有効で、`http:` や `file:` を使ってはなりません。\n- `nativeCurrency` を指定する場合、3 つのフィールドすべてが必須です。\n- 成功時は `null` を返し、そうでなければエラーを返します。ウォレットはどんな理由でも拒否できます。\n- チェーンを追加しても、それが選択されるわけでは**ありません**。既存のチェーンの再追加は（ユーザーが拒否しない限り）成功すべきで、同じチェーン ID を二重に追加してはなりません。\n\n## サンプルコード\n\n[EIP-1193](/eip-1193/) provider 経由でチェーンを追加し、そのチェーンに切り替える:\n\n```ts\nconst params = {\n  chainId: \"0xa\", // 10\n  chainName: \"OP Mainnet\",\n  nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n  rpcUrls: [\"https://mainnet.optimism.io\"],\n  blockExplorerUrls: [\"https://optimistic.etherscan.io\"],\n};\n\ntry {\n  await window.ethereum.request({ method: \"wallet_addEthereumChain\", params: [params] });\n  // Adding does not select it; ask to switch explicitly (EIP-3326)\n  await window.ethereum.request({\n    method: \"wallet_switchEthereumChain\",\n    params: [{ chainId: params.chainId }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"user rejected\");\n  else throw err;\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** ですが、このメソッドは実際には MetaMask などのブラウザウォレットで広くサポートされています。動作の詳細（どのフィールドが必須か、チェーンが自動選択されるか）はウォレットによって依然として異なります。\n- 切り替えは別の関心事で、[EIP-3326](/eip-3326/) の `wallet_switchEthereumChain` で提案されています。\n- チェーン ID は [EIP-155](/eip-155/) のリプレイ保護用 ID で、[EIP-695](/eip-695/) と同じ形式です。ウォレットは、RPC エンドポイントが報告するものではなく、送信されたチェーン ID で署名すべきです。\n- 仕様のセキュリティ上のガイダンス: RPC エンドポイントがユーザーの IP と活動を見ることをユーザーに警告する、アイコンは信頼できないものとして扱う、ウォレット自身の既知チェーンのメタデータを優先する、重複を自動承認してユーザーが既に持っているチェーンが漏れることを避ける。\n"},"ko":{"lang":"ko","tldr":"dapp이 지갑에 EVM 체인(체인 ID, RPC URL, 통화, 탐색기) 추가를 요청하고 사용자가 그 요청을 승인하는 wallet_addEthereumChain RPC 메서드.","tags":["wallet","json-rpc","multichain","interface","dapp"],"related":[3326,1193,155,695,3014],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3085/","markdown":"## 어떤 문제를 해결하나요?\n\nL2나 사이드체인에 배포된 dapp은 사용자의 지갑이 그 네트워크를 알고 있어야 합니다. 표준이 없으면 사용자는 체인 ID, RPC URL, 통화 심볼을 지갑 설정에 손으로 복사해야 했고, 이는 실수하기 쉽고 피싱에 취약했습니다.\n\nERC-3085는 사이트가 체인을 *제안*하기 위해 호출할 수 있는, wallet 네임스페이스의 메서드 하나를 정의합니다. 지갑은 데이터를 검증하고 사용자에게 보여 주며, 사용자가 승인한 경우에만 체인을 추가합니다.\n\n## 어떻게 동작하나요?\n\n`wallet_addEthereumChain`은 객체 하나를 받습니다.\n\n```ts\ninterface AddEthereumChainParameter {\n  chainId: string;              // hex string, e.g. \"0xa\"\n  chainName?: string;\n  rpcUrls?: string[];\n  nativeCurrency?: { name: string; symbol: string; decimals: number };\n  blockExplorerUrls?: string[];\n  iconUrls?: string[];\n}\n```\n\n스펙의 핵심 규칙:\n\n- 타입상 필수인 것은 `chainId`뿐이지만, `rpcUrls`가 없거나 비어 있는 경우, 그리고 `chainId`가 RPC URL에서 `eth_chainId`로 반환되는 값과 일치하지 않는 경우 지갑은 요청을 거부해야 **합니다(must)**.\n- URL은 유효해야 하며 `http:`나 `file:`을 사용해서는 안 됩니다.\n- `nativeCurrency`를 지정하면 세 필드가 모두 필수입니다.\n- 성공하면 `null`을 반환하고, 그렇지 않으면 에러를 반환합니다. 지갑은 어떤 이유로든 거부할 수 있습니다.\n- 체인을 추가한다고 해서 그 체인이 선택되는 것은 **아닙니다**. 이미 있는 체인을 다시 추가하는 것은(사용자가 거부하지 않는 한) 성공해야 하며, 같은 체인 ID를 두 번 추가해서는 안 됩니다.\n\n## 샘플 코드\n\n[EIP-1193](/eip-1193/) provider를 통해 체인을 추가한 뒤 그 체인으로 전환하기:\n\n```ts\nconst params = {\n  chainId: \"0xa\", // 10\n  chainName: \"OP Mainnet\",\n  nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n  rpcUrls: [\"https://mainnet.optimism.io\"],\n  blockExplorerUrls: [\"https://optimistic.etherscan.io\"],\n};\n\ntry {\n  await window.ethereum.request({ method: \"wallet_addEthereumChain\", params: [params] });\n  // Adding does not select it; ask to switch explicitly (EIP-3326)\n  await window.ethereum.request({\n    method: \"wallet_switchEthereumChain\",\n    params: [{ chainId: params.chainId }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"user rejected\");\n  else throw err;\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**이지만, 실제로 이 메서드는 MetaMask 같은 브라우저 지갑에서 널리 지원됩니다. 동작 세부 사항(어떤 필드가 필수인지, 체인이 자동 선택되는지)은 여전히 지갑마다 다릅니다.\n- 전환은 별개의 관심사이며 [EIP-3326](/eip-3326/)의 `wallet_switchEthereumChain`에서 제안되었습니다.\n- 체인 ID는 [EIP-155](/eip-155/)의 리플레이 방지 ID이며 [EIP-695](/eip-695/)와 같은 형식입니다. 지갑은 RPC 엔드포인트가 보고한 값이 아니라 제출된 체인 ID로 서명해야 합니다.\n- 스펙의 보안 지침: RPC 엔드포인트가 사용자의 IP와 활동을 볼 수 있음을 사용자에게 경고하고, 아이콘은 신뢰할 수 없는 것으로 취급하며, 지갑 자체의 알려진 체인 메타데이터를 우선하고, 중복 요청을 자동 승인해 사용자가 이미 가진 체인이 드러나는 일을 피합니다.\n"},"zh":{"lang":"zh","tldr":"wallet_addEthereumChain RPC 方法让 dapp 请求钱包添加一条 EVM 链（链 ID、RPC URL、货币、浏览器），由用户批准该请求。","tags":["wallet","json-rpc","multichain","interface","dapp"],"related":[3326,1193,155,695,3014],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3085/","markdown":"## 它解决什么问题？\n\n部署在 L2 或侧链上的 dapp 需要用户的钱包认识该网络。没有标准时，用户必须手动把链 ID、RPC URL 和货币符号复制到钱包设置中，既容易出错，也容易被钓鱼。\n\nERC-3085 定义了一个位于 wallet 命名空间的方法，网站可以调用它来*建议*一条链。钱包会验证数据并展示给用户，只有用户批准才会添加该链。\n\n## 它如何运作\n\n`wallet_addEthereumChain` 接受一个对象：\n\n```ts\ninterface AddEthereumChainParameter {\n  chainId: string;              // hex string, e.g. \"0xa\"\n  chainName?: string;\n  rpcUrls?: string[];\n  nativeCurrency?: { name: string; symbol: string; decimals: number };\n  blockExplorerUrls?: string[];\n  iconUrls?: string[];\n}\n```\n\n规范中的关键规则：\n\n- 类型上只有 `chainId` 是必填的，但如果 `rpcUrls` 缺失或为空，或者 `chainId` 与从这些 RPC URL 通过 `eth_chainId` 返回的值不一致，钱包**必须**拒绝该请求。\n- URL 必须有效，且不得使用 `http:` 或 `file:`。\n- 如果提供了 `nativeCurrency`，则三个字段都是必填的。\n- 成功时返回 `null`，否则返回错误。钱包可以出于任何原因拒绝。\n- 添加一条链**并不**意味着它会被选中。重新添加一条已存在的链应当成功（除非用户拒绝），并且同一个链 ID 不得被添加两次。\n\n## 示例代码\n\n通过 [EIP-1193](/eip-1193/) provider 添加一条链，然后切换到它：\n\n```ts\nconst params = {\n  chainId: \"0xa\", // 10\n  chainName: \"OP Mainnet\",\n  nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n  rpcUrls: [\"https://mainnet.optimism.io\"],\n  blockExplorerUrls: [\"https://optimistic.etherscan.io\"],\n};\n\ntry {\n  await window.ethereum.request({ method: \"wallet_addEthereumChain\", params: [params] });\n  // Adding does not select it; ask to switch explicitly (EIP-3326)\n  await window.ethereum.request({\n    method: \"wallet_switchEthereumChain\",\n    params: [{ chainId: params.chainId }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"user rejected\");\n  else throw err;\n}\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**，不过实际上该方法已被 MetaMask 等浏览器钱包广泛支持。具体行为细节（哪些字段必填、链是否自动选中）在不同钱包之间仍有差异。\n- 切换是另一个独立的问题，由 [EIP-3326](/eip-3326/) 的 `wallet_switchEthereumChain` 提出。\n- 链 ID 是 [EIP-155](/eip-155/) 的重放保护 ID，格式与 [EIP-695](/eip-695/) 相同。钱包应当使用提交的链 ID 签名，绝不能使用 RPC 端点报告的链 ID。\n- 规范中的安全指引：提醒用户 RPC 端点能看到他们的 IP 和活动；将图标视为不可信；优先使用钱包自己已知链的元数据；避免自动批准重复请求而泄露用户已经拥有哪些链。\n"}}}
