Skip to main content

Add Chain To Wallet

Creates a confirmation asking the user to add the specified chain to the wallet application. The caller must specify a chain ID and some chain metadata.

Request Parameters

Params[0]

ParameterTypeRequiredDescription
chainIdStringYesThe chain ID is a 0x-prefixed hexadecimal string
chainNameStringYesA human-readable name for the chain.
rpcUrlsArray[string]YesOne or more URLs pointing to RPC endpoints that can be used to communicate with the chain.
iconUrlsArray[string]NoOne or more URLs pointing to reasonably sized images that can be used to visually identify the chain.
nativeCurrencyObjectYesDescribes the native currency of the chain using the name, symbol, and decimals fields.
nativeCurrency.decimalsIntegerYesA non-negative integer.
nativeCurrency.symbolStringYesA human-readable symbol.
nativeCurrency.nameStringNoA human-readable name.
blockExplorerUrlsArray[string]NoOne or more URLs pointing to block explorer sites for the chain.

Response Parameters

ParameterTypeDescription
nullThe method MUST return null if the request was successful, and an error otherwise.

Request Example

ethereum.request({
"method": "wallet_addEthereumChain",
"params": [
{
"chainId": "0x64",
"chainName": "Gnosis",
"rpcUrls": [
"https://rpc.ankr.com/gnosis"
],
"iconUrls": [
"https://xdaichain.com/fake/example/url/xdai.svg",
"https://xdaichain.com/fake/example/url/xdai.png"
],
"nativeCurrency": {
"decimals": 18
"symbol": "xDAI",
"name": "xDAI",
},
"blockExplorerUrls": [
"https://blockscout.com/poa/xdai/"
]
}
]
})

Response Example

null