---
eip: 3085
label: EIP-3085
title: wallet_addEthereumChain RPC Method
status: Stagnant
type: Standards Track
category: Interface
created: 2020-11-01
requires: 155
official: https://eips.ethereum.org/EIPS/eip-3085
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3085.md
canonical: https://eips.huatuo.xyz/eip-3085/
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]
---

# EIP-3085: wallet_addEthereumChain RPC Method

> Adds an RPC method to add EVM-compatible chains

**TL;DR:** 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.

## What problem does it solve?

A 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.

ERC-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.

## How it works

`wallet_addEthereumChain` takes one object:

```ts
interface AddEthereumChainParameter {
  chainId: string;              // hex string, e.g. "0xa"
  chainName?: string;
  rpcUrls?: string[];
  nativeCurrency?: { name: string; symbol: string; decimals: number };
  blockExplorerUrls?: string[];
  iconUrls?: string[];
}
```

Key rules from the spec:

- 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.
- URLs must be valid and must not use `http:` or `file:`.
- If `nativeCurrency` is given, all three fields are required.
- It returns `null` on success, an error otherwise. The wallet may reject for any reason.
- 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.

## Sample code

Adding a chain through an [EIP-1193](/eip-1193/) provider, then switching to it:

```ts
const params = {
  chainId: "0xa", // 10
  chainName: "OP Mainnet",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: ["https://mainnet.optimism.io"],
  blockExplorerUrls: ["https://optimistic.etherscan.io"],
};

try {
  await window.ethereum.request({ method: "wallet_addEthereumChain", params: [params] });
  // Adding does not select it; ask to switch explicitly (EIP-3326)
  await window.ethereum.request({
    method: "wallet_switchEthereumChain",
    params: [{ chainId: params.chainId }],
  });
} catch (err: any) {
  if (err.code === 4001) console.log("user rejected");
  else throw err;
}
```

## Things to know

- 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.
- Switching is a separate concern, proposed in [EIP-3326](/eip-3326/) `wallet_switchEthereumChain`.
- 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.
- 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.


---

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