ERC-2304 ENS multichain address resolution (Multichain address resolution for ENS)

Stagnant · Names & metadata · created 2019-09-09

A standard that allows a single ENS name to also register and look up cryptocurrency addresses outside Ethereum, such as Bitcoin, Ripple, and Binance Chain.

Why it is needed

The existing ENS standard's (EIP-137) addr(bytes32) was designed to return only an Ethereum address. However, as more developers built multicoin wallets, a need arose to look up addresses on other chains, such as Bitcoin or Ripple, through a single ENS name. If each resolver stores addresses in its own way per chain, or if there is simply no way to store addresses for non-Ethereum chains at all, the same ENS name ends up being interpreted differently by different wallets, or multichain addresses cannot be shown at all. This proposal defines a common interface for storing and looking up addresses by coin type, so that any wallet or app can handle multichain addresses the same way.

What to implement

In depth

coinType and SLIP44

coinType uses the coin type index from the SLIP44 standard directly. For example, Bitcoin is 0, Litecoin is 2, Ethereum is 60, Ripple is 144, and Binance is 714. The addr(node, coinType) function must return the address for the specified node and coin type in native binary format, and must return a zero-length string if that node has no address for that coin type. The EIP165 interface ID for this function is 0xf1cb7e06.

setAddr and the AddressChanged event

setAddr(node, coinType, addr) is the recommended interface for adding or replacing the address for a given node and coin type; resolvers SHOULD use this interface to set addresses unless they have some other need. Resolvers MUST emit an AddressChanged event containing the new address whenever the address for a name and coin type changes.

Address encoding principles

Addresses are generally stored in their native binary representation, without the checksum used in text representations. P2PKH and P2SH addresses are decoded from base58check and stored as a scriptPubkey format that includes the version byte, while SegWit addresses are decoded from bech32 and stored as a scriptPubkey made up of OP_n and the witness program. ChecksummedHex strips the 0x prefix and stores the hex-decoded value, and when encoding to text it must use the EIP-55 checksum or its extension, RSKIP60.

Ripple, CashAddr, and Bech32 encoding

Ripple addresses are encoded with base58check using an alternate alphabet, and both formats, r-address (version byte + 20-byte hash) and X-address (version byte + 20-byte hash + tag), are stored as decoded, including the version byte. Bitcoin Cash's CashAddr is decoded from a bech32 variant and then converted to and stored as P2PKH or P2SH format. Plain Bech32 addresses used on chains like Binance are stored as the decoded data as is.

Table of supported chains and coin types

The specification provides a table of coinType and supported encoding methods (P2PKH, P2SH, SegWit, ChecksummedHex, Ripple, CashAddr, Bech32, etc.) for Bitcoin (0), Litecoin (2), Dogecoin (3), Monacoin (22), Ethereum (60), Ethereum Classic (61), Rootstock (137), Ripple (144), Bitcoin Cash (145), and Binance (714), and also presents text and on-chain hex test vectors for each encoding.

Backward compatibility with EIP-137

If a resolver also supports EIP-137's addr(bytes32) interface, the value returned by addr(node) must always match the value of addr(node, 60) (60 being Ethereum's coin type). In addition, any action that emits EIP-137's AddrChanged event must also emit this EIP's AddressChanged event with coinType set to 60, and this must also apply in reverse.

Proposal status

This proposal is recorded as Stagnant, meaning it has not yet been finalized or discussion has stalled.

Original ERC · ← ERCs