Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines EIP-3085, which proposes wallet_addEthereumChain, a standard interface for requesting that an Ethereum wallet add a new chain.
This article translates, summarizes, and expands on the specification linked below.
I also cover a variety of other EIPs.
Overview
The proposal provides a standard way to add a new chain (blockchain network) to an Ethereum wallet.
Ethereum wallets normally interact with the Ethereum blockchain itself, but the Ethereum ecosystem includes several networks, such as testnets and other Ethereum-based chains. For users and developers to use these different chains easily through a wallet, the wallet must know how to connect to them and perform operations on them.
The proposed wallet_addEthereumChain is a namespaced RPC method for adding a new chain to a wallet.
An RPC (remote procedure call) method lets one program request that another program on a network, in this case an Ethereum wallet, perform a specific operation.
A namespace groups related methods or functionality. In this case, the method has the wallet_ prefix.
With this method, a wallet can receive a request from a developer or user and add information about a new chain, such as its name, RPC endpoints, currency symbol, and block explorer URLs. The wallet can then send transactions on the added chain and manage assets associated with that chain.
The EIP aims to provide a standard way for Ethereum wallets to interact easily with different Ethereum-based blockchains. This improves interoperability throughout the ecosystem and provides a better user experience.
Specification
The proposal defines a new RPC method, wallet_addEthereumChain.
wallet_addEthereumChain parameters
The proposed wallet_addEthereumChain method is used to suggest that an Ethereum wallet add a new chain. It requests the addition of a blockchain to the wallet's chain list and requires specific parameters to support that process.
Overview
- Parameters
- The method accepts a single
AddEthereumChainParameterobject as its parameter.
- The method accepts a single
- Return value
- Returns
nullif the chain is added successfully, or an error if it is not added.
- Returns
The AddEthereumChainParameter object
The object contains the following fields.
- chainId
- Represents the chain's integer ID as a hexadecimal string.
- Follows EIP155.
For more information about EIP155, see the article below.
[EIP155] Understanding Replay Protection on Ethereum
- blockExplorerUrls
- An array of block explorer URLs.
- The URLs must be valid.
- chainName
- A string containing the chain's name.
- iconUrls
- An array of URLs for chain icon images.
- The URLs must point to valid images.
- nativeCurrency
- An object containing information about the chain's native currency.
- Its fields are interpreted in the same way as those defined by EIP20.
For more information about ERC20, see the article below.
- rpcUrls
- An array of URLs for the chain's RPC endpoints.
- The URLs must be valid.
Wallet requirements
Wallets must accept or reject requests according to the following conditions.
- Reject a request if chainId is not a valid hexadecimal string or does not represent a valid chain ID.
- Reject a request if rpcUrls is omitted or is an empty array.
- Reject it if the array contains invalid URLs as well.
- If nativeCurrency is provided, its
name,symbol, anddecimalsfields are required.- Reject the request if
decimalsis a negative integer.
- Reject the request if
- If blockExplorerUrls or iconUrls is provided, reject the request if it contains an invalid URL.
- Reject URLs using the
file:orhttp:scheme.
The method provides a standardized way to add new chains to Ethereum wallets and defines requirements that must be satisfied. This allows users and developers to interact easily with multiple Ethereum-based blockchains through their wallets.
Return value of wallet_addEthereumChain
The following describes the return value of the wallet_addEthereumChain method.
Successful and failed requests
- Success
- If the method handles the request successfully, it must return
null. - This indicates that the chain has been added to the wallet's chain list.
- If the method handles the request successfully, it must return
- Error
- If the request fails for any reason, the method must return an error.
- A wallet may reject the request for any reason.
- Possible reasons include technical issues, security concerns, or the user's decision to reject the request.
Automatic chain selection
Even if a wallet does not reject a request, it does not necessarily select the newly added chain automatically. The wallet may require the user to select the chain manually or take additional action before using it.
Handling chains that have already been added
A request to add a chain that is already present should generally succeed. Exceptions include cases in which the user rejects the request or validation fails.
Preventing duplicate additions with the same chainId
Wallets must not allow the same chainId to be added more than once.
This security measure helps prevent confusion and malicious activity.
For example, it can help prevent an attacker from adding a fraudulent chain with a duplicate ID.
Security considerations
The proposal's Security Considerations section may provide further details and recommendations for using this method safely. In addition to rules such as preventing duplicate additions, these considerations may include data validation, methods of interacting with users, and relying on trusted sources of information.
Following these guidelines helps wallets provide safer and more efficient services. The principles aim to improve the user experience while minimizing security risks.
Additional details
The design of wallet_addEthereumChain intentionally leaves the meaning of adding a chain to a wallet unspecified.
What it means to add a chain depends on the wallet implementation.
This includes how the wallet recognizes a new chain, presents it in the user interface, and interacts with it.
Why chainId is required
chainId must always be supplied when calling the method because the EIP155 chain ID effectively serves as a globally unique identifier (GUID) in the Ethereum chain ecosystem.
It is an important means of identifying different Ethereum chains.
The role of other parameters
The remaining parameters are presumed to be the minimum information a wallet needs to support and represent the chain effectively to the user. The network ID is omitted because the chain ID has effectively superseded it.
Security and metadata validation
For security reasons, wallets should always attempt to validate chain metadata provided by the requester. In some cases, they may choose to obtain metadata from an entirely different source.
Only the wallet knows what chain metadata it needs.
All parameters other than chainId are therefore specified as optional, although a wallet may require them in practice.
Switching the active chain
The specification does not require a wallet to switch its active or currently selected chain after a successful request. The meaning of adding a chain and switching between chains depends on the wallet implementation and is therefore outside the scope of this specification.
This design gives wallets flexibility in how they interact with different Ethereum chains. Wallet developers can integrate chains in a way that best meets their products' functional, user interface, and security requirements. It also allows wallets to offer users more choice and control.
Security
The wallet_addEthereumChain method has several important security considerations.
It is a powerful method, and incorrect implementation can expose end users to serious risks, making strict security guidelines necessary.
Handling chain IDs
- Chain ID validation
- The chain ID used to sign a transaction determines the chain on which the transaction is valid.
- The wallet must verify that the submitted chain ID is valid, is a hexadecimal string with the
0xprefix as specified by EIP695, and can be parsed as an integer.
For more information about EIP695, see the article below.
[EIP695] Retrieving the Ethereum Chain ID through JSON-RPC
- Preventing duplicates
- Prevent the same chain ID from being added more than once.
- Chain ID used for signing
- Use only the submitted chain ID to sign transactions, not a chain ID obtained from an RPC endpoint.
- A malicious or defective endpoint could return an arbitrary chain ID, causing a user to sign a transaction for an unintended chain.
- Verifying the chain ID matches
- Verify that the specified chain ID matches the value returned by
eth_chainIdfrom the endpoint.
- Verify that the specified chain ID matches the value returned by
RPC endpoints and RPC URLs
Wallets normally interact with chains through RPC endpoints.
Many wallets come with a set of chains and corresponding trusted RPC endpoints.
The endpoints identified by rpcUrls may be dishonest, incorrect, or associated with different chains.
Wallets must inform users that their on-chain activity and IP addresses are exposed to RPC endpoints and that unknown endpoints may behave unexpectedly.
Wallets should follow good web security practices when interacting with endpoints, such as requiring HTTPS.
Chain data validation
Wallets implementing wallet_addEthereumChain should expect requests for chains entirely unknown to wallet maintainers.
However, community resources are available to help validate requests for many Ethereum chains.
Wallets should maintain a list of known chains and validate chain-addition requests against that list.
A wallet may prefer its own chain metadata to the metadata submitted in a wallet_addEthereumChain request.
These security considerations form the basis for protecting end users and providing reliable wallet services. Wallet developers are responsible for adhering to the guidelines to help users use their wallets safely.
The following guidelines address user experience (UX) and privacy when using wallet_addEthereumChain. They govern the process of adding a chain, which can have a significant impact on wallet functionality and user experience.
Presenting user confirmation
- Adding a new chain to a wallet requires explicit user consent. When a
wallet_addEthereumChainrequest is received, the wallet must display a confirmation screen informing the user that a particular requester has asked to add the chain. This allows users to understand and consent to changes that affect their wallets.
Using chain metadata
- Chain metadata, such as
nativeCurrencyandblockExplorerUrls, should be validated so that it can be used effectively in the wallet interface. This enables users to understand accurately the characteristics of the chain they are interacting with.
Icons and representation
- If images are supplied through
iconUrls, the wallet must make users aware that those icons may misrepresent the chain that has actually been added. This helps prevent users from judging a chain solely by its appearance.
Selecting the active chain
- If the wallet interface has a concept of a currently selected or active chain, it must enable users to understand when a chain added through
wallet_addEthereumChainhas been selected.
Protecting user privacy
- A request to add an existing chain should generally be considered successful, but automatically treating such requests as successful can reveal information to the requester about chains already added to a user's wallet. To protect user privacy, implementers of
wallet_addEthereumChainshould consider showing a confirmation prompt in these cases as well. If the user rejects the request, the wallet should return the usual user-rejection error, preventing the requester from learning which chains the wallet supports without the user's explicit permission.
These guidelines help users make informed decisions when adding new chains to their wallets. They also contribute to respecting user privacy and minimizing security risks.
Citation
Erik Marks (@rekmarks), Pedro Gomes (@pedrouid), Pandapip1 (@Pandapip1), "EIP-3085: wallet_addEthereumChain RPC Method [DRAFT]," Ethereum Improvement Proposals, no. 3085, November 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-3085.
Conclusion
This article covered EIP-3085, which proposes wallet_addEthereumChain, a standard interface for requesting that an Ethereum wallet add a new chain.
I hope this explanation was helpful.
If you have questions, feel free to reach out via direct message on Twitter.
I also publish content on other platforms, which you can find below.


