{"eip":2304,"title":"Multichain address resolution for ENS","description":"This EIP introduces new overloads for the addr field for ENS resolvers, which permit resolution of addresses for other blockchains via ENS.","authors":["Nick Johnson \u003cnick@ens.domains\u003e"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2019-09-09","requires":[137],"discussionsTo":"https://discuss.ens.domains/t/new-standard-proposal-ens-multicoin-support/1148","repo":"ERCs","label":"ERC-2304","officialUrl":"https://eips.ethereum.org/EIPS/eip-2304","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-2304.md","url":"https://eips.huatuo.xyz/eip-2304/","tldr":{"en":"Adds an `addr(node, coinType)` function to ENS resolvers so one name can point to addresses on Bitcoin, Litecoin and other chains, not just Ethereum.","ja":"ENS リゾルバーに `addr(node, coinType)` 関数を追加し、1 つの名前で Ethereum だけでなく Bitcoin、Litecoin などのチェーン上のアドレスも指せるようにする。","ko":"ENS 리졸버에 `addr(node, coinType)` 함수를 추가해, 하나의 이름이 이더리움뿐 아니라 비트코인, 라이트코인 등 다른 체인의 주소도 가리킬 수 있게 한다.","zh":"为 ENS 解析器增加 `addr(node, coinType)` 函数，让同一个名称不仅能指向以太坊地址，还能指向比特币、莱特币等其他链上的地址。"},"tags":["ens","naming","multichain","resolver","addresses"],"explainers":{"en":{"lang":"en","tldr":"Adds an `addr(node, coinType)` function to ENS resolvers so one name can point to addresses on Bitcoin, Litecoin and other chains, not just Ethereum.","tags":["ens","naming","multichain","resolver","addresses"],"related":[137,2544,165,55],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2304/","markdown":"## What problem does it solve?\n\nThe original ENS spec ([EIP-137](/eip-137/)) lets a name such as `alice.eth` resolve to a single Ethereum address via `addr(bytes32 node)`. Multi-coin wallets wanted more: a user should be able to type `alice.eth` and send BTC, LTC or DOGE too. Without a shared standard, each wallet would invent its own record format and names would not work across clients.\n\nERC-2304 standardises how non-Ethereum addresses are stored in and read from an ENS resolver.\n\n## How it works\n\n- A new resolver function `addr(bytes32 node, uint coinType) returns (bytes)` returns the address for a given chain. Its [ERC-165](/eip-165/) interface ID is `0xf1cb7e06`.\n- `coinType` is the coin type index from SLIP-44 (for example Bitcoin `0`, Litecoin `2`, Dogecoin `3`, Ethereum `60`, Ethereum Classic `61`).\n- The return value is the address in its **native binary form**, not the human-readable text. For Bitcoin-style chains that means the scriptPubkey bytes (e.g. a P2PKH address is stored as `76a914\u003c20-byte hash\u003e88ac`); for Ethereum it is the raw 20 bytes with the `0x` prefix removed. A name with no address for that coin returns empty bytes.\n- Resolvers must emit `AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress)` on every change. The recommended setter is `setAddr(bytes32 node, uint coinType, bytes addr)`.\n- Backwards compatibility: if a resolver also supports the old `addr(bytes32)`, it must return the same value as `addr(node, 60)`, and the old `AddrChanged` and new `AddressChanged` events must be emitted together.\n\nClients are responsible for converting between text and binary. When turning stored bytes back into an Ethereum-style address, they must apply the [EIP-55](/eip-55/) checksum.\n\n## Sample code\n\nResolver storage and accessors (simplified; access control omitted):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract MultiCoinResolver {\n    uint256 constant COIN_TYPE_ETH = 60;\n    event AddressChanged(bytes32 indexed node, uint256 coinType, bytes newAddress);\n\n    mapping(bytes32 =\u003e mapping(uint256 =\u003e bytes)) private _addresses;\n\n    function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external {\n        // real resolvers check that msg.sender controls `node`\n        _addresses[node][coinType] = a;\n        emit AddressChanged(node, coinType, a);\n    }\n\n    function addr(bytes32 node, uint256 coinType) external view returns (bytes memory) {\n        return _addresses[node][coinType]; // empty bytes if unset\n    }\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0xf1cb7e06 || id == 0x01ffc9a7;\n    }\n}\n```\n\nReading a Bitcoin address with ethers v6, which decodes the binary format for you:\n\n```ts\nimport { JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst resolver = await provider.getResolver(\"alice.eth\");\nconst btc = await resolver?.getAddress(0); // coinType 0 = Bitcoin\nconsole.log(btc);\n```\n\n## Things to know\n\n- Status is **Stagnant** in the EIP repository. The ENS project maintains this scheme in its own ENSIP process, and it is what ENS resolvers and libraries implement in practice.\n- Always store the binary form, never the display string, and validate checksums when parsing user input; a mis-encoded Bitcoin scriptPubkey can make funds unspendable.\n- The spec includes test vectors for each listed chain. Use them when writing an encoder/decoder.\n- For resolving names that have no resolver of their own (e.g. `user.wallet.eth`), see [ERC-2544](/eip-2544/) wildcard resolution.\n"},"ja":{"lang":"ja","tldr":"ENS リゾルバーに `addr(node, coinType)` 関数を追加し、1 つの名前で Ethereum だけでなく Bitcoin、Litecoin などのチェーン上のアドレスも指せるようにする。","tags":["ens","naming","multichain","resolver","addresses"],"related":[137,2544,165,55],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2304/","markdown":"## 何を解決するのか\n\n元の ENS 仕様（[EIP-137](/eip-137/)）では、`alice.eth` のような名前は `addr(bytes32 node)` によって 1 つの Ethereum アドレスに解決されます。マルチコイン対応のウォレットはそれ以上を求めていました。ユーザーが `alice.eth` と入力するだけで、BTC、LTC、DOGE なども送れるようにしたいのです。共通の標準がなければ、各ウォレットが独自のレコード形式を作り、名前がクライアント間で機能しなくなります。\n\nERC-2304 は、Ethereum 以外のアドレスを ENS リゾルバーに保存し、そこから読み取る方法を標準化します。\n\n## 仕組み\n\n- 新しいリゾルバー関数 `addr(bytes32 node, uint coinType) returns (bytes)` が、指定したチェーンのアドレスを返します。その [ERC-165](/eip-165/) インターフェース ID は `0xf1cb7e06` です。\n- `coinType` は SLIP-44 のコインタイプインデックスです（例：Bitcoin は `0`、Litecoin は `2`、Dogecoin は `3`、Ethereum は `60`、Ethereum Classic は `61`）。\n- 戻り値は、人が読めるテキストではなく、アドレスの**ネイティブなバイナリ形式**です。Bitcoin 系チェーンでは scriptPubkey のバイト列を意味し（例：P2PKH アドレスは `76a914\u003c20-byte hash\u003e88ac` として保存）、Ethereum では `0x` プレフィックスを除いた生の 20 バイトです。そのコインのアドレスを持たない名前には、空の bytes が返ります。\n- リゾルバーは、変更のたびに `AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress)` を emit しなければなりません。推奨されるセッターは `setAddr(bytes32 node, uint coinType, bytes addr)` です。\n- 後方互換性：リゾルバーが従来の `addr(bytes32)` もサポートする場合は、`addr(node, 60)` と同じ値を返さなければならず、従来の `AddrChanged` と新しい `AddressChanged` の両イベントを同時に emit しなければなりません。\n\nテキストとバイナリの変換はクライアントの責任です。保存されたバイト列を Ethereum 形式のアドレスに戻すときは、[EIP-55](/eip-55/) のチェックサムを適用する必要があります。\n\n## サンプルコード\n\nリゾルバーのストレージとアクセサです（簡略化しており、アクセス制御は省略しています）。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract MultiCoinResolver {\n    uint256 constant COIN_TYPE_ETH = 60;\n    event AddressChanged(bytes32 indexed node, uint256 coinType, bytes newAddress);\n\n    mapping(bytes32 =\u003e mapping(uint256 =\u003e bytes)) private _addresses;\n\n    function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external {\n        // real resolvers check that msg.sender controls `node`\n        _addresses[node][coinType] = a;\n        emit AddressChanged(node, coinType, a);\n    }\n\n    function addr(bytes32 node, uint256 coinType) external view returns (bytes memory) {\n        return _addresses[node][coinType]; // empty bytes if unset\n    }\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0xf1cb7e06 || id == 0x01ffc9a7;\n    }\n}\n```\n\nethers v6 で Bitcoin アドレスを読み取る例です。バイナリ形式のデコードはライブラリが行います。\n\n```ts\nimport { JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst resolver = await provider.getResolver(\"alice.eth\");\nconst btc = await resolver?.getAddress(0); // coinType 0 = Bitcoin\nconsole.log(btc);\n```\n\n## 知っておくべきこと\n\n- EIP リポジトリ上のステータスは **Stagnant** です。ENS プロジェクトは、この方式を独自の ENSIP プロセスで管理しており、ENS のリゾルバーやライブラリが実際に実装しているのはそちらです。\n- 保存するのは常にバイナリ形式で、表示用の文字列は保存しないでください。ユーザー入力をパースするときはチェックサムを検証してください。Bitcoin の scriptPubkey を誤ってエンコードすると、資金が使えなくなるおそれがあります。\n- 仕様には、記載された各チェーンのテストベクターが含まれています。エンコーダー／デコーダーを書くときに活用してください。\n- 独自のリゾルバーを持たない名前（例：`user.wallet.eth`）の解決については、[ERC-2544](/eip-2544/) のワイルドカード解決を参照してください。\n"},"ko":{"lang":"ko","tldr":"ENS 리졸버에 `addr(node, coinType)` 함수를 추가해, 하나의 이름이 이더리움뿐 아니라 비트코인, 라이트코인 등 다른 체인의 주소도 가리킬 수 있게 한다.","tags":["ens","naming","multichain","resolver","addresses"],"related":[137,2544,165,55],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2304/","markdown":"## 어떤 문제를 해결하나요?\n\n기존 ENS 명세([EIP-137](/eip-137/))에서는 `alice.eth` 같은 이름이 `addr(bytes32 node)`를 통해 이더리움 주소 하나로 해석됩니다. 멀티코인 지갑은 더 많은 것을 원했습니다. 사용자가 `alice.eth`를 입력해 BTC, LTC, DOGE도 보낼 수 있어야 한다는 것입니다. 공통 표준이 없으면 지갑마다 자체 레코드 형식을 만들어, 클라이언트 간에 이름이 동작하지 않게 됩니다.\n\nERC-2304는 이더리움이 아닌 주소를 ENS 리졸버에 저장하고 읽는 방식을 표준화합니다.\n\n## 어떻게 동작하나요?\n\n- 새 리졸버 함수 `addr(bytes32 node, uint coinType) returns (bytes)`가 지정한 체인의 주소를 반환합니다. [ERC-165](/eip-165/) 인터페이스 ID는 `0xf1cb7e06`입니다.\n- `coinType`은 SLIP-44의 코인 타입 인덱스입니다(예: 비트코인 `0`, 라이트코인 `2`, 도지코인 `3`, 이더리움 `60`, 이더리움 클래식 `61`).\n- 반환값은 사람이 읽을 수 있는 텍스트가 아니라 주소의 **네이티브 바이너리 형식**입니다. 비트코인 계열 체인에서는 scriptPubkey 바이트를 뜻하며(예: P2PKH 주소는 `76a914\u003c20-byte hash\u003e88ac`로 저장), 이더리움에서는 `0x` 접두사를 뺀 원시 20바이트입니다. 해당 코인의 주소가 없는 이름은 빈 bytes를 반환합니다.\n- 리졸버는 변경될 때마다 `AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress)`를 emit해야 합니다. 권장 setter는 `setAddr(bytes32 node, uint coinType, bytes addr)`입니다.\n- 하위 호환성: 리졸버가 기존 `addr(bytes32)`도 지원한다면 `addr(node, 60)`과 같은 값을 반환해야 하며, 기존 `AddrChanged` 이벤트와 새 `AddressChanged` 이벤트를 함께 emit해야 합니다.\n\n텍스트와 바이너리 사이의 변환은 클라이언트의 책임입니다. 저장된 바이트를 이더리움 형식 주소로 되돌릴 때는 [EIP-55](/eip-55/) 체크섬을 적용해야 합니다.\n\n## 샘플 코드\n\n리졸버의 스토리지와 접근자입니다(단순화했으며 접근 제어는 생략했습니다).\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract MultiCoinResolver {\n    uint256 constant COIN_TYPE_ETH = 60;\n    event AddressChanged(bytes32 indexed node, uint256 coinType, bytes newAddress);\n\n    mapping(bytes32 =\u003e mapping(uint256 =\u003e bytes)) private _addresses;\n\n    function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external {\n        // real resolvers check that msg.sender controls `node`\n        _addresses[node][coinType] = a;\n        emit AddressChanged(node, coinType, a);\n    }\n\n    function addr(bytes32 node, uint256 coinType) external view returns (bytes memory) {\n        return _addresses[node][coinType]; // empty bytes if unset\n    }\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0xf1cb7e06 || id == 0x01ffc9a7;\n    }\n}\n```\n\nethers v6로 비트코인 주소를 읽는 예시입니다. 바이너리 형식은 라이브러리가 디코딩해 줍니다.\n\n```ts\nimport { JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst resolver = await provider.getResolver(\"alice.eth\");\nconst btc = await resolver?.getAddress(0); // coinType 0 = Bitcoin\nconsole.log(btc);\n```\n\n## 알아둘 점\n\n- EIP 저장소에서의 상태는 **Stagnant**입니다. ENS 프로젝트는 이 방식을 자체 ENSIP 절차로 관리하며, ENS 리졸버와 라이브러리가 실제로 구현하는 것도 그쪽입니다.\n- 표시용 문자열이 아니라 항상 바이너리 형식을 저장하고, 사용자 입력을 파싱할 때는 체크섬을 검증하세요. 잘못 인코딩된 비트코인 scriptPubkey는 자금을 사용할 수 없게 만들 수 있습니다.\n- 명세에는 나열된 각 체인의 테스트 벡터가 포함되어 있습니다. 인코더/디코더를 작성할 때 활용하세요.\n- 자체 리졸버가 없는 이름(예: `user.wallet.eth`)을 해석하는 방법은 [ERC-2544](/eip-2544/)의 와일드카드 해석을 참고하세요.\n"},"zh":{"lang":"zh","tldr":"为 ENS 解析器增加 `addr(node, coinType)` 函数，让同一个名称不仅能指向以太坊地址，还能指向比特币、莱特币等其他链上的地址。","tags":["ens","naming","multichain","resolver","addresses"],"related":[137,2544,165,55],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2304/","markdown":"## 它解决什么问题？\n\n最初的 ENS 规范（[EIP-137](/eip-137/)）让 `alice.eth` 这样的名称通过 `addr(bytes32 node)` 解析为单个以太坊地址。多币种钱包想要更多：用户应该可以输入 `alice.eth` 并发送 BTC、LTC 或 DOGE。没有共同标准，每个钱包都会发明自己的记录格式，名称在不同客户端之间就无法通用。\n\nERC-2304 规范了非以太坊地址如何存入 ENS 解析器并从中读取。\n\n## 它如何运作\n\n- 新的解析器函数 `addr(bytes32 node, uint coinType) returns (bytes)` 返回指定链的地址。其 [ERC-165](/eip-165/) 接口 ID 为 `0xf1cb7e06`。\n- `coinType` 是 SLIP-44 中的币种类型索引（例如比特币为 `0`，莱特币为 `2`，狗狗币为 `3`，以太坊为 `60`，以太坊经典为 `61`）。\n- 返回值是地址的**原生二进制形式**，而不是人类可读的文本。对于比特币系的链，这意味着 scriptPubkey 字节（例如 P2PKH 地址存储为 `76a914\u003c20-byte hash\u003e88ac`）；对于以太坊，则是去掉 `0x` 前缀的原始 20 字节。如果名称没有该币种的地址，则返回空 bytes。\n- 解析器必须在每次变更时触发 `AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress)` 事件。推荐的 setter 是 `setAddr(bytes32 node, uint coinType, bytes addr)`。\n- 向后兼容：如果解析器同时支持旧的 `addr(bytes32)`，它必须返回与 `addr(node, 60)` 相同的值，并且旧的 `AddrChanged` 事件和新的 `AddressChanged` 事件必须一起触发。\n\n文本与二进制之间的转换由客户端负责。把存储的字节转换回以太坊风格的地址时，必须应用 [EIP-55](/eip-55/) 校验和。\n\n## 示例代码\n\n解析器的存储与访问函数（已简化，省略了访问控制）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract MultiCoinResolver {\n    uint256 constant COIN_TYPE_ETH = 60;\n    event AddressChanged(bytes32 indexed node, uint256 coinType, bytes newAddress);\n\n    mapping(bytes32 =\u003e mapping(uint256 =\u003e bytes)) private _addresses;\n\n    function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external {\n        // real resolvers check that msg.sender controls `node`\n        _addresses[node][coinType] = a;\n        emit AddressChanged(node, coinType, a);\n    }\n\n    function addr(bytes32 node, uint256 coinType) external view returns (bytes memory) {\n        return _addresses[node][coinType]; // empty bytes if unset\n    }\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0xf1cb7e06 || id == 0x01ffc9a7;\n    }\n}\n```\n\n用 ethers v6 读取比特币地址，它会替你解码二进制格式：\n\n```ts\nimport { JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst resolver = await provider.getResolver(\"alice.eth\");\nconst btc = await resolver?.getAddress(0); // coinType 0 = Bitcoin\nconsole.log(btc);\n```\n\n## 需要注意\n\n- 在 EIP 仓库中状态为 **Stagnant**。ENS 项目在自己的 ENSIP 流程中维护这一方案，ENS 解析器和库在实践中实现的也是它。\n- 始终存储二进制形式，而不是显示用的字符串，并且在解析用户输入时验证校验和；编码错误的比特币 scriptPubkey 可能导致资金无法花费。\n- 规范为列出的每条链都提供了测试向量。编写编码器/解码器时请使用它们。\n- 对于没有自己解析器的名称（例如 `user.wallet.eth`）的解析，请参阅 [ERC-2544](/eip-2544/) 的通配符解析。\n"}},"requiredBy":[2525,7785,7831]}
