EIP-3085 Chain addition request method (wallet_addEthereumChain RPC Method)
No call decision · Networking & nodes · EIP status Stagnant · created 2020-11-01
Defines the standard RPC method used by wallets to add a new Ethereum chain. When an app sends chain information, the wallet verifies it and adds the chain after obtaining user confirmation.
Why it is needed
Currently, for a user to use a new chain (such as a sidechain or L2), they must go into the wallet settings screen and manually enter values like the RPC address, chain ID, and currency symbol. A typo or incorrect chain ID entered during this process creates the risk of unknowingly signing transactions on the wrong network, and since each app guides this process differently, users can easily get confused. wallet_addEthereumChain standardizes the way apps request chain additions from wallets, so that the wallet validates the submitted values and adds the chain only after clear user confirmation.
What changes
Today
- To use a new chain, users must manually enter the RPC address, chain ID, currency symbol, and other values in the wallet settings.
- Typos or errors in the entered values risk signing on the wrong network.
- Since each app guides chain addition differently, the user experience varies inconsistently.
After EIP-3085
- An app requests a chain addition from the wallet with a single call to wallet_addEthereumChain.
- The wallet validates fields such as chainId and rpcUrls and adds the chain only after obtaining user confirmation.
- The wallet prevents the same chainId from being added more than once.
Who is affected
- Users: Users can add a new chain just by clicking a confirmation dialog, without manually entering values in a settings screen.
- Wallet developers: Bears responsibility for validating request parameters and implementing the user confirmation UI.
- dApp/frontend developers: Standardized calls allow users to be safely guided into adding a chain.
- New chain/L2 operators: Reduced wallet onboarding friction makes it easier to attract users.
In depth
Method and parameters
wallet_addEthereumChain takes a single AddEthereumChainParameter object. Its fields are chainId, blockExplorerUrls, chainName, iconUrls, nativeCurrency, and rpcUrls. Of these, only chainId is required; the rest are optional. However, a wallet may require additional fields, impose stricter conditions, or ignore them entirely. If a field does not meet the specification's requirements and the wallet does not ignore that field, the wallet must reject the request.
chainId validation
chainId is the EIP-155-based chain ID expressed as a hexadecimal string. If it is not a valid hexadecimal value or not a valid chain ID, the wallet must reject the request. The wallet must also use only the chainId received in the request for signing, and must not trust the value returned by the RPC endpoint, since a malicious or faulty endpoint could return an arbitrary chainId. The wallet must verify that the requested chainId actually matches the result of calling eth_chainId on one of the rpcUrls.
rpcUrls requirements
The wallet must reject the request if the rpcUrls field is missing or an empty array. If any string in rpcUrls is not a valid URL, the wallet must reject the request, and any URL using the file: or http: scheme must also be rejected. In other words, plaintext HTTP or local file paths are not allowed.
nativeCurrency·blockExplorerUrls·iconUrls
If nativeCurrency is provided, the request must be rejected if any of name, symbol, or decimals is missing, and must be rejected if decimals is negative. The meaning of decimals is interpreted the same way as in EIP-20. If blockExplorerUrls is provided and contains a value that is not a valid URL, the request must be rejected. If iconUrls is provided and contains a value that is not a valid URL or not an actual image, the request must be rejected.
Return value and 'selection'
If the request succeeds, it returns null; otherwise it returns an error. The wallet may reject the request for any reason. Even if a chain is successfully added, it should not be assumed that the wallet automatically makes that chain the 'currently selected' chain. What exactly it means to 'add' versus 'switch' a chain depends on the wallet implementation, and this specification does not define that meaning.
Preventing duplicate additions and privacy
A wallet must not allow the same chainId to be added more than once. If a request is made to add a chain that has already been added, it must be treated as a success unless the user rejects it or validation fails. However, if such requests are always treated as an automatic success with no exceptions, this can leak to the requester the information that 'this user has already added this chain.' The specification therefore recommends showing a user confirmation prompt even in this case, and returning the same error as a normal rejection error if the user rejects it, so the requester cannot determine whether it is supported.
Current status
This EIP's status is Stagnant. That is, active discussion or progress has stopped, and it has not been finalized as a standard.