{"eip":1577,"title":"contenthash field for ENS","description":"This EIP introduces the new contenthash field for ENS resolvers, allowing for a better defined system of mapping names to network and content addresses. Additionally the content and multihash fields are deprecated.","authors":["Dean Eigenmann \u003cdean@ens.domains\u003e","Nick Johnson \u003cnick@ens.domains\u003e"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2018-11-13","repo":"ERCs","label":"ERC-1577","officialUrl":"https://eips.ethereum.org/EIPS/eip-1577","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1577.md","url":"https://eips.huatuo.xyz/eip-1577/","tldr":{"en":"Adds a contenthash record to ENS resolvers so a name can point to content on IPFS, Swarm and other networks using a self-describing multicodec format.","ja":"ENS リゾルバーに contenthash レコードを追加し、自己記述型の multicodec 形式を使って、名前が IPFS や Swarm などのネットワーク上のコンテンツを指せるようにする。","ko":"ENS 리졸버에 contenthash 레코드를 추가해, 이름이 자기 기술형 multicodec 형식으로 IPFS, Swarm 등 여러 네트워크의 콘텐츠를 가리킬 수 있게 한다.","zh":"为 ENS 解析器新增 contenthash 记录，使名称可以通过自描述的 multicodec 格式指向 IPFS、Swarm 等网络上的内容。"},"tags":["ens","ipfs","swarm","resolver","dweb"],"explainers":{"en":{"lang":"en","tldr":"Adds a contenthash record to ENS resolvers so a name can point to content on IPFS, Swarm and other networks using a self-describing multicodec format.","tags":["ens","ipfs","swarm","resolver","dweb"],"related":[137,165,634,181],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1577/","markdown":"## What problem does it solve?\n\nWallets and browsers began resolving ENS names to websites hosted on decentralised storage such as IPFS and Swarm. The older resolver fields (`content` and `multihash`) did not clearly say *which* network a hash belonged to, so apps had to guess, and name owners could not be sure how their content would be loaded.\n\nERC-1577 replaces them with one field, `contenthash`, whose value carries its own protocol identifier.\n\n## How it works\n\n- A resolver supporting the field returns `true` from [ERC-165](/eip-165/) `supportsInterface(0xbc1c58d1)`.\n- `contenthash(node)` returns raw bytes in [multicodec](https://github.com/multiformats/multicodec) form:\n\n```text\n\u003cprotoCode uvarint\u003e\u003cvalue []byte\u003e\n```\n\n- For IPFS (`0xe3`) and Swarm (`0xe4`), the value is a CIDv1 without a base prefix:\n\n```text\n\u003cprotoCode uvarint\u003e\u003ccid-version\u003e\u003cmulticodec-content-type\u003e\u003cmultihash-content-address\u003e\n```\n\n- Clients MUST read the protocol code first and resolve the address with the matching network, if they support it.\n- The old `content` and `multihash` fields are deprecated. The spec required a grace period, until at least 31 March 2019, during which clients fell back to them.\n\nBreaking down the spec's IPFS example:\n\n| Bytes | Meaning |\n| --- | --- |\n| `e3 01` | IPFS namespace (`0xe3` as a uvarint) |\n| `01` | CID version 1 |\n| `70` | content type dag-pb |\n| `12 20` | sha2-256, 32-byte digest |\n| `29f2…3f1f` | the hash |\n\n## Sample code\n\nThe spec's examples:\n\n```text\nIPFS  binary: 0xe3010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f\n      text:   ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4\n\nSwarm binary: 0xe40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162\n      text:   bzz://d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162\n```\n\nReading a name's content hash with ethers v6, which decodes common protocols to a URL:\n\n```ts\nimport { JsonRpcProvider, Contract, namehash } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst resolver = await provider.getResolver(\"vitalik.eth\");\nconsole.log(await resolver?.getContentHash()); // e.g. \"ipfs://...\"\n\n// Or call the resolver directly for the raw bytes\nconst r = new Contract(resolver!.address,\n  [\"function contenthash(bytes32 node) view returns (bytes)\"], provider);\nconsole.log(await r.contenthash(namehash(\"vitalik.eth\")));\n```\n\nInside a resolver contract:\n\n```solidity\nfunction contenthash(bytes32 node) external view returns (bytes memory);\nevent ContenthashChanged(bytes32 indexed node, bytes hash);\n```\n\n## Things to know\n\n- **Status: Stagnant** in the EIP repository, but `contenthash` is the record that ENS resolvers and ENS-aware gateways and browsers use for decentralised websites.\n- Only the encoding is standardised; whether a client can actually fetch the content depends on its support for that protocol.\n- Use a library (for example the `content-hash` packages the spec links) to encode values instead of assembling bytes by hand.\n- Name resolution itself is defined by [ENS (EIP-137)](/eip-137/); text records are in [EIP-634](/eip-634/).\n"},"ja":{"lang":"ja","tldr":"ENS リゾルバーに contenthash レコードを追加し、自己記述型の multicodec 形式を使って、名前が IPFS や Swarm などのネットワーク上のコンテンツを指せるようにする。","tags":["ens","ipfs","swarm","resolver","dweb"],"related":[137,165,634,181],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1577/","markdown":"## 何を解決するのか\n\nウォレットやブラウザは、ENS 名を IPFS や Swarm のような分散型ストレージ上でホストされたウェブサイトに解決し始めました。従来のリゾルバーのフィールド（`content` と `multihash`）では、ハッシュがどのネットワークのものなのかが明確ではなかったため、アプリは推測するしかなく、名前の所有者も自分のコンテンツがどう読み込まれるか確信できませんでした。\n\nERC-1577 はこれらを、値自体にプロトコル識別子を含む 1 つのフィールド `contenthash` に置き換えます。\n\n## 仕組み\n\n- このフィールドをサポートするリゾルバーは、[ERC-165](/eip-165/) の `supportsInterface(0xbc1c58d1)` から `true` を返します。\n- `contenthash(node)` は、[multicodec](https://github.com/multiformats/multicodec) 形式の生のバイト列を返します。\n\n```text\n\u003cprotoCode uvarint\u003e\u003cvalue []byte\u003e\n```\n\n- IPFS（`0xe3`）と Swarm（`0xe4`）では、値はベースプレフィックスのない CIDv1 です。\n\n```text\n\u003cprotoCode uvarint\u003e\u003ccid-version\u003e\u003cmulticodec-content-type\u003e\u003cmultihash-content-address\u003e\n```\n\n- クライアントは、まずプロトコルコードを読み、サポートしていれば一致するネットワークでアドレスを解決しなければなりません（MUST）。\n- 古い `content` と `multihash` フィールドは非推奨です。仕様は、少なくとも 2019 年 3 月 31 日までの猶予期間を求めており、その間クライアントはそれらにフォールバックしていました。\n\n仕様の IPFS の例を分解すると次のとおりです。\n\n| バイト | 意味 |\n| --- | --- |\n| `e3 01` | IPFS の名前空間（`0xe3` を uvarint にしたもの） |\n| `01` | CID バージョン 1 |\n| `70` | コンテンツタイプ dag-pb |\n| `12 20` | sha2-256、32 バイトのダイジェスト |\n| `29f2…3f1f` | ハッシュ |\n\n## サンプルコード\n\n仕様の例です。\n\n```text\nIPFS  binary: 0xe3010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f\n      text:   ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4\n\nSwarm binary: 0xe40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162\n      text:   bzz://d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162\n```\n\nethers v6 で名前のコンテンツハッシュを読み取る例です。一般的なプロトコルは URL にデコードされます。\n\n```ts\nimport { JsonRpcProvider, Contract, namehash } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst resolver = await provider.getResolver(\"vitalik.eth\");\nconsole.log(await resolver?.getContentHash()); // e.g. \"ipfs://...\"\n\n// Or call the resolver directly for the raw bytes\nconst r = new Contract(resolver!.address,\n  [\"function contenthash(bytes32 node) view returns (bytes)\"], provider);\nconsole.log(await r.contenthash(namehash(\"vitalik.eth\")));\n```\n\nリゾルバーコントラクトの内部:\n\n```solidity\nfunction contenthash(bytes32 node) external view returns (bytes memory);\nevent ContenthashChanged(bytes32 indexed node, bytes hash);\n```\n\n## 知っておくべきこと\n\n- EIP リポジトリ上のステータスは **Stagnant** ですが、`contenthash` は、ENS リゾルバーと、ENS 対応のゲートウェイやブラウザが、分散型ウェブサイトのために使うレコードです。\n- 標準化されているのはエンコーディングだけです。クライアントが実際にコンテンツを取得できるかどうかは、そのプロトコルへの対応状況に依存します。\n- 値のエンコードには、バイト列を手で組み立てるのではなく、ライブラリ（たとえば仕様がリンクしている `content-hash` パッケージ）を使ってください。\n- 名前解決そのものは [ENS (EIP-137)](/eip-137/) が定義しており、テキストレコードは [EIP-634](/eip-634/) にあります。\n"},"ko":{"lang":"ko","tldr":"ENS 리졸버에 contenthash 레코드를 추가해, 이름이 자기 기술형 multicodec 형식으로 IPFS, Swarm 등 여러 네트워크의 콘텐츠를 가리킬 수 있게 한다.","tags":["ens","ipfs","swarm","resolver","dweb"],"related":[137,165,634,181],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1577/","markdown":"## 어떤 문제를 해결하나요?\n\n지갑과 브라우저는 ENS 이름을 IPFS나 Swarm 같은 분산 스토리지에 호스팅된 웹사이트로 해석하기 시작했습니다. 이전의 리졸버 필드(`content`와 `multihash`)는 해시가 *어느* 네트워크의 것인지 명확히 알려 주지 않아 앱은 추측해야 했고, 이름 소유자도 자기 콘텐츠가 어떻게 로드될지 확신할 수 없었습니다.\n\nERC-1577은 이를 값 자체에 프로토콜 식별자를 담은 하나의 필드 `contenthash`로 대체합니다.\n\n## 어떻게 동작하나요?\n\n- 이 필드를 지원하는 리졸버는 [ERC-165](/eip-165/)의 `supportsInterface(0xbc1c58d1)`에서 `true`를 반환합니다.\n- `contenthash(node)`는 [multicodec](https://github.com/multiformats/multicodec) 형식의 원시 바이트를 반환합니다.\n\n```text\n\u003cprotoCode uvarint\u003e\u003cvalue []byte\u003e\n```\n\n- IPFS(`0xe3`)와 Swarm(`0xe4`)에서 값은 베이스 접두사가 없는 CIDv1입니다.\n\n```text\n\u003cprotoCode uvarint\u003e\u003ccid-version\u003e\u003cmulticodec-content-type\u003e\u003cmultihash-content-address\u003e\n```\n\n- 클라이언트는 먼저 프로토콜 코드를 읽고, 지원한다면 일치하는 네트워크로 주소를 해석해야 합니다(MUST).\n- 이전의 `content`와 `multihash` 필드는 더 이상 쓰이지 않습니다. 명세는 최소 2019년 3월 31일까지의 유예 기간을 요구했으며, 그동안 클라이언트는 그 필드로 폴백했습니다.\n\n명세의 IPFS 예시를 분해하면 다음과 같습니다.\n\n| 바이트 | 의미 |\n| --- | --- |\n| `e3 01` | IPFS 네임스페이스(`0xe3`을 uvarint로 표현한 것) |\n| `01` | CID 버전 1 |\n| `70` | 콘텐츠 타입 dag-pb |\n| `12 20` | sha2-256, 32바이트 다이제스트 |\n| `29f2…3f1f` | 해시 |\n\n## 샘플 코드\n\n명세의 예시입니다.\n\n```text\nIPFS  binary: 0xe3010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f\n      text:   ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4\n\nSwarm binary: 0xe40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162\n      text:   bzz://d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162\n```\n\nethers v6로 이름의 콘텐츠 해시를 읽는 예입니다. 흔한 프로토콜은 URL로 디코딩됩니다.\n\n```ts\nimport { JsonRpcProvider, Contract, namehash } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst resolver = await provider.getResolver(\"vitalik.eth\");\nconsole.log(await resolver?.getContentHash()); // e.g. \"ipfs://...\"\n\n// Or call the resolver directly for the raw bytes\nconst r = new Contract(resolver!.address,\n  [\"function contenthash(bytes32 node) view returns (bytes)\"], provider);\nconsole.log(await r.contenthash(namehash(\"vitalik.eth\")));\n```\n\n리졸버 컨트랙트 내부:\n\n```solidity\nfunction contenthash(bytes32 node) external view returns (bytes memory);\nevent ContenthashChanged(bytes32 indexed node, bytes hash);\n```\n\n## 알아둘 점\n\n- EIP 저장소에서의 상태는 **Stagnant**이지만, `contenthash`는 ENS 리졸버와 ENS를 지원하는 게이트웨이·브라우저가 분산 웹사이트에 사용하는 레코드입니다.\n- 인코딩만 표준화되어 있습니다. 클라이언트가 실제로 콘텐츠를 가져올 수 있는지는 해당 프로토콜 지원 여부에 달려 있습니다.\n- 값을 인코딩할 때는 바이트를 직접 조립하지 말고 라이브러리(예: 명세가 링크한 `content-hash` 패키지)를 사용하세요.\n- 이름 해석 자체는 [ENS (EIP-137)](/eip-137/)가 정의하며, 텍스트 레코드는 [EIP-634](/eip-634/)에 있습니다.\n"},"zh":{"lang":"zh","tldr":"为 ENS 解析器新增 contenthash 记录，使名称可以通过自描述的 multicodec 格式指向 IPFS、Swarm 等网络上的内容。","tags":["ens","ipfs","swarm","resolver","dweb"],"related":[137,165,634,181],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1577/","markdown":"## 它解决什么问题？\n\n钱包和浏览器开始把 ENS 名称解析为托管在 IPFS 和 Swarm 等去中心化存储上的网站。较早的解析器字段（`content` 和 `multihash`）没有清楚说明某个哈希属于*哪个*网络，所以应用只能猜测，名称所有者也无法确定自己的内容会如何被加载。\n\nERC-1577 用一个字段 `contenthash` 取代了它们，其值自带协议标识符。\n\n## 它如何运作\n\n- 支持该字段的解析器会从 [ERC-165](/eip-165/) 的 `supportsInterface(0xbc1c58d1)` 返回 `true`。\n- `contenthash(node)` 返回 [multicodec](https://github.com/multiformats/multicodec) 格式的原始字节：\n\n```text\n\u003cprotoCode uvarint\u003e\u003cvalue []byte\u003e\n```\n\n- 对于 IPFS（`0xe3`）和 Swarm（`0xe4`），值是不带 base 前缀的 CIDv1：\n\n```text\n\u003cprotoCode uvarint\u003e\u003ccid-version\u003e\u003cmulticodec-content-type\u003e\u003cmultihash-content-address\u003e\n```\n\n- 客户端必须（MUST）先读取协议代码，并在支持的情况下用相应的网络解析该地址。\n- 旧的 `content` 和 `multihash` 字段已被弃用。规范要求设置宽限期，至少持续到 2019 年 3 月 31 日，在此期间客户端会回退使用它们。\n\n拆解规范中的 IPFS 示例：\n\n| 字节 | 含义 |\n| --- | --- |\n| `e3 01` | IPFS 命名空间（`0xe3` 的 uvarint 形式） |\n| `01` | CID 版本 1 |\n| `70` | 内容类型 dag-pb |\n| `12 20` | sha2-256，32 字节摘要 |\n| `29f2…3f1f` | 哈希值 |\n\n## 示例代码\n\n规范中的示例：\n\n```text\nIPFS  binary: 0xe3010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f\n      text:   ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4\n\nSwarm binary: 0xe40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162\n      text:   bzz://d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162\n```\n\n用 ethers v6 读取名称的内容哈希，它会把常见协议解码为 URL：\n\n```ts\nimport { JsonRpcProvider, Contract, namehash } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst resolver = await provider.getResolver(\"vitalik.eth\");\nconsole.log(await resolver?.getContentHash()); // e.g. \"ipfs://...\"\n\n// Or call the resolver directly for the raw bytes\nconst r = new Contract(resolver!.address,\n  [\"function contenthash(bytes32 node) view returns (bytes)\"], provider);\nconsole.log(await r.contenthash(namehash(\"vitalik.eth\")));\n```\n\n在解析器合约内部：\n\n```solidity\nfunction contenthash(bytes32 node) external view returns (bytes memory);\nevent ContenthashChanged(bytes32 indexed node, bytes hash);\n```\n\n## 需要注意\n\n- 在 EIP 仓库中的状态是 **Stagnant**，但 `contenthash` 是 ENS 解析器以及支持 ENS 的网关和浏览器用于去中心化网站的记录。\n- 只有编码方式被标准化；客户端能否真正获取内容，取决于它是否支持该协议。\n- 请使用库（例如规范链接的 `content-hash` 包）来编码值，而不要手工拼装字节。\n- 名称解析本身由 [ENS (EIP-137)](/eip-137/) 定义；文本记录见 [EIP-634](/eip-634/)。\n"}},"requiredBy":[2520,5139]}
