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 explains ERC-1577, which introduces a contenthash field into ENS resolvers to provide a unified way of addressing content stored on decentralized systems such as IPFS and Swarm.

The following specification is the basis for this explanation.

For more articles about Ethereum improvement proposals, see the following page.

Overview

ERC-1577 proposes a new contenthash field for resolvers in the Ethereum Name Service (ENS). It allows ENS domains to be mapped more explicitly to network content addresses.

The previously used content and multihash fields are deprecated. Using contenthash provides a unified representation for references to decentralized storage systems such as IPFS and Swarm.

Motivation

As described in the original article, wallets and mobile clients such as MetaMask and Status began providing access to content stored on IPFS and Swarm using ENS domain names.

However, decentralized storage protocols use different addressing formats, and there was no unified resolution method.

Standardization was needed so applications could determine how to resolve names and domain owners could understand how their content would be handled.

The contenthash field improves the reliability and predictability of decentralized content references through ENS.

Specification

Introducing the contenthash Field

ERC-1577 introduces the contenthash field into ENS resolvers. It provides a consistent way to manage addressing information for different decentralized storage protocols, including IPFS and Swarm.

To determine whether a resolver supports contenthash, call supportsInterface with the interface ID 0xbc1c58d1 and check whether it returns true.

The previous content and multihash fields are deprecated.

contenthash Format

The value of contenthash is represented using the machine-readable multicodec format.

text
<protoCode(uvarint)><value(バイト列)>
  • protoCode: An identifier for the protocol, such as IPFS or Swarm.
  • value: Protocol-specific bytes. For IPFS and Swarm, the structure described in the article is as follows.
text
<protoCode(uvarint)><cid-version><multicodec-content-type><multihash-content-address>

In the format examples, the Japanese annotations identify a uvarint and a byte sequence, respectively.

Role of Each Component

  • cid-version: CID version, shown as 0x01 in the examples.
  • multicodec-content-type: Content type, such as dag-pb for IPFS or swarm-manifest for Swarm.
  • multihash-content-address: The content hash itself.

Applications inspect protoCode to identify the protocol and then apply the appropriate resolution procedure.

IPFS Example

  • Storage protocol: IPFS (0xe3).
  • CID version: 0x01.
  • Content type: dag-pb (0x70).
  • Hash function: sha2-256 (0x12).
  • Hash length: 32 bytes (0x20).
  • Hash value: 29f2d17b...c7e3f1f.

Binary Representation

text
0xe3010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f

Human-Readable Representation

text
ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4

Swarm Example

  • Storage protocol: Swarm (0xe4).
  • CID version: 0x01.
  • Content type: swarm-manifest (0xfa).
  • Hash function: keccak256 (0x1b).
  • Hash length: 32 bytes (0x20).
  • Hash value: d1de9994...265ea162.

Binary Representation

text
0xe40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162

Text Representation

text
bzz://d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162

Using the Swarm CLI

bash
$ swarm hash ens contenthash d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
> e40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162

Fallback

ENS names that already use the content or multihash fields for IPFS or Swarm hashes needed a migration grace period.

The article describes the following fallback requirements.

  • If the resolver does not support the multihash interface, check the content interface instead.
  • If content exists, the application must interpret it according to the relevant context.
  • The compatibility procedure was required until at least March 31, 2019.

This date refers to the historical migration requirements in the proposal.

Citation

Dean Eigenmann dean@ens.domains, Nick Johnson nick@ens.domains, "ERC-1577: contenthash field for ENS [DRAFT]," Ethereum Improvement Proposals, no. 1577, November 2018. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-1577.

Conclusion

ERC-1577 introduces a unified contenthash field for ENS resolvers, allowing domain names to reference content on decentralized storage protocols such as IPFS and Swarm.