ERC-2520 ENS multi content hash records (Multiple contenthash records for ENS)

Stagnant · Names & metadata · created 2020-02-18

Allows a single ENS domain to store multiple contenthash records, one per protocol, so it can simultaneously link to multiple decentralized hosting systems such as IPFS and Swarm.

Why it is needed

Under EIP-1577, the contenthash record that points to a decentralized hosting site on the Ethereum Name Service (ENS) can store only one value per domain. However, there are multiple ENS-compatible decentralized hosting systems besides IPFS and Swarm, including Onion and ZeroNet more recently, and this number is expected to keep growing. With only one record allowed, a domain owner must pick just one of these hosting methods, leaving no way for users running the site via a different method to reach it through the same ENS name. This constraint grows larger as the number of hosting systems increases.

What to implement

In depth

Background: the constraint of choosing a hosting system

ENS contenthash stores the location of the decentralized hosting content a domain points to. Besides IPFS and Swarm, ENS-compatible hosting systems such as Onion and ZeroNet are growing in number, but the existing structure allows only one record per domain, forcing the owner to pick a single system. This proposal aims to remove that constraint by letting a domain hold records for multiple hosting systems at once.

The setContenthash function

setContenthash(bytes32 node, bytes calldata proto, bytes calldata hash) adds a proto parameter to the existing EIP-1577 interface. It is restricted by the authorised(node) modifier so only the node owner can call it, and it stores the hash value for the hosting system specified by proto. If no proto is provided, the value must be stored as the default record.

The contenthash lookup function

contenthash(bytes32 node, bytes calldata proto) returns the record for the hosting system specified by proto. If no proto is provided, it must return the default record, which guarantees compatibility with existing apps that only know EIP-1577.

Interface identification and supportsInterface

A resolver that supports multiple contenthashes must return true for interface ID 0x6de03e07 when supportsInterface is called. Apps can use this value to check in advance whether a resolver supports multiple records.

Recommended handling for apps

Apps that handle only one hosting system directly, such as an IPFS or Swarm gateway, should request contenthash by specifying that particular proto. Conversely, apps that support multiple hosting systems together, such as MetaMask, should request without a proto, identically to EIP-1577, to receive the default record.

Design rationale and limitations

The author chose this structure because it is simple to implement while meeting the required functionality. However, supporting multiple records or priority ordering within the same proto is not supported, since it was judged to offer little practical benefit while adding implementation complexity.

Backward compatibility

This proposal is compatible with EIP-1577. The only difference is the addition of overloaded methods, and existing apps can continue receiving the default contenthash record unmodified.

Proposal status

This proposal is in Stagnant status, meaning discussion is no longer progressing and has halted. It has not yet been adopted as a standard, and its content may change or be abandoned in the future.

Original ERC · ← ERCs