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 examines ERC-2520, a proposal that allows an ENS domain to store and retrieve multiple contenthash records, supporting decentralized hosting systems such as IPFS, Swarm, and Onion simultaneously.
This explanation translates, summarizes, and expands on the following specification.
For more articles about EIPs, see the following page.
Overview
ERC-2520 proposes allowing multiple contenthash records to be registered for a single ENS (Ethereum Name Service) domain.
Under the ENS specification discussed in this proposal, each domain can hold only one contenthash record. ERC-2520 removes that limitation, allowing a domain to support multiple decentralized hosting systems, including IPFS, Swarm, Onion, and ZeroNet.
Motivation
Many applications use ENS names to access content hosted on decentralized storage systems. They use the contenthash record to determine which decentralized system and which content to access.
However, when only one contenthash record can be configured per domain, a website owner can select only one hosting mechanism. This makes it difficult to accommodate both existing options, such as IPFS and Swarm, and new decentralized hosting protocols that may emerge.
Supporting multiple contenthash records allows a single ENS name to specify several hosting methods, making deployments more flexible and extensible.
Specification
ERC-2520 extends the handling of contenthash records defined by EIP-1577, enabling multiple records to be stored and retrieved for one ENS domain.
Interface Compatibility
The proposal introduces an additional interface while maintaining compatibility with EIP-1577. It retains the existing format while allowing records to be stored and retrieved by specifying a protocol (proto).
For more information about EIP-1577, see the following article.
ERC-1577 Explained: Accessing IPFS and Swarm Content Through ENS Domains
Setter Function (setContenthash)
function setContenthash(bytes32 node, bytes calldata proto, bytes calldata hash) external authorised(node);This function stores a contenthash record for a specified protocol.
node- The target ENS node, corresponding to the domain name.
proto- The protocol to use, such as IPFS or Swarm, represented as bytes.
hash- The content hash to store.
When no protocol is specified (an empty proto value), the hash is stored as the default record.
Getter Function (contenthash)
function contenthash(bytes32 node, bytes calldata proto) external view returns (bytes memory);This function returns the contenthash associated with a specified protocol.
node- The target ENS node.
proto- The requested protocol; an empty value selects the default record.
When no protocol is specified, the function returns the default record.
Interface Identifier
A resolver supporting multiple contenthash records must return true from supportsInterface for the following interface ID.
0x6de03e07Application Behavior
- Applications supporting only one hosting system, such as an IPFS gateway, should retrieve the
contenthashby specifying the relevant protocol. - Applications supporting multiple hosting systems, such as MetaMask in the proposal's example, should retrieve the default
contenthashwithout specifying a protocol.
Applications can therefore select whether to specify a protocol according to the hosting systems they support.
Additional Considerations
The implementation proposed by ERC-2520 was chosen to remain as simple as possible while supporting the main required features.
It does not support storing multiple contenthash records for the same protocol type, such as IPFS, or assigning priorities to those records.
The rationale is that these features would offer limited benefits while increasing implementation complexity. The design aims to balance simplicity and practicality.
Backward Compatibility
ERC-2520 maintains compatibility with EIP-1577. It adds function overloads with an additional argument without changing the behavior of existing functions.
Legacy applications can continue to operate, retrieving the default contenthash record without modifications. Only applications that want to use the new capabilities need to adopt the additional interface.
Reference Implementation
contract ContentHashResolver {
bytes4 constant private MULTI_CONTENT_HASH_INTERFACE_ID = 0x6de03e07;
mapping(bytes32=>mapping(bytes=>bytes)) hashes;
function setContenthash(bytes32 node, bytes calldata proto, bytes calldata hash) external {
hashes[node][proto] = hash;
emit ContenthashChanged(node, hash);
}
function contenthash(bytes32 node, bytes calldata proto) external view returns (bytes memory) {
return hashes[node][proto];
}
function supportsInterface(bytes4 interfaceID) public pure returns(bool) {
return interfaceID == MULTI_CONTENT_HASH_INTERFACE_ID;
}
}Citation
Filip Štamcar (@filips123), "ERC-2520: Multiple contenthash records for ENS [DRAFT]," Ethereum Improvement Proposals, no. 2520, February 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2520.
Conclusion
ERC-2520 proposes storing and retrieving multiple contenthash records for a single ENS domain so that it can support different decentralized hosting systems, including IPFS, Swarm, and Onion, at the same time.
If you have questions, feel free to contact me on Twitter.
I also publish articles on the following platforms.



