---
eip: 1062
label: ERC-1062
title: Formalize IPFS hash into ENS(Ethereum Name Service) resolver
status: Stagnant
type: Standards Track
category: ERC
created: 2018-05-02
official: https://eips.ethereum.org/EIPS/eip-1062
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1062.md
canonical: https://eips.huatuo.xyz/eip-1062/
lang: en
tldr: An early proposal for storing IPFS content hashes in an ENS resolver, so a human-readable name like mysite.eth could point to a decentralized website.
tags: [ens, ipfs, resolver, storage, naming]
---

# ERC-1062: Formalize IPFS hash into ENS(Ethereum Name Service) resolver

> To specify the mapping protocol between resources stored on IPFS and ENS(Ethereum Naming Service).

**TL;DR:** An early proposal for storing IPFS content hashes in an ENS resolver, so a human-readable name like mysite.eth could point to a decentralized website.

## What problem does it solve?

IPFS addresses content by its hash, a long Base58 string such as `QmXo...`. That is great for integrity but useless for humans: nobody remembers or types it. ENS ([EIP-137](/eip-137/)) already maps readable names like `mysite.eth` to data stored in a resolver contract.

ERC-1062 proposed a standard way to put an IPFS hash into an ENS resolver and get it back out, so a browser or extension could type an `.eth` name and load a fully decentralized site. The goal was a simple bridge between human-readable names and content-addressed storage.

## How it works

The main difficulty is encoding. IPFS shows hashes as Base58 strings, while Ethereum contracts and JSON-RPC deal in raw bytes shown as hex. The proposal bridges the two through the underlying binary *multihash*:

1. **Store:** decode the Base58 IPFS hash into bytes, then write those bytes to the resolver.
2. **Read:** read the bytes from the resolver and encode them back into Base58 to get the IPFS hash.

It relies on two resolver methods:

| Function | Purpose |
| --- | --- |
| `setMultihash(bytes32 node, bytes hash)` | Owner of the ENS name stores the multihash bytes |
| `multihash(bytes32 node)` | Anyone reads the stored bytes back |

`node` is the usual ENS namehash of the name. Only the owner of that node may call the setter.

A classic IPFS (CIDv0) hash decodes to bytes starting with `0x12 0x20`: `0x12` means SHA-256 and `0x20` means a 32-byte digest, followed by the digest itself.

## Sample code

Converting between Base58 and hex with ethers v6 (the spec's own examples use the `multihashes` npm library):

```ts
import { decodeBase58, encodeBase58, getBytes, toBeHex } from "ethers";

// IPFS Base58 hash -> 0x-hex bytes for the resolver
export const toHex = (ipfsHash: string): string => toBeHex(decodeBase58(ipfsHash));

// 0x-hex bytes from the resolver -> IPFS Base58 hash
export const toBase58 = (hex: string): string => encodeBase58(getBytes(hex));
```

The resolver interface as described:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

interface IMultihashResolver {
    function setMultihash(bytes32 node, bytes calldata hash) external; // only node owner
    function multihash(bytes32 node) external view returns (bytes memory);
}
```

## Things to know

- **Status: Stagnant.** This proposal was never finalized.
- The ecosystem standardized on the `contenthash` resolver field from [EIP-1577](/eip-1577/) instead. It can hold IPFS, Swarm and other content identifiers with a self-describing prefix, and is what ENS-aware wallets, gateways and libraries read today (for example ethers' `resolver.getContentHash()`).
- `multihash` stores only the hash, without saying which storage network it belongs to. That limitation is one reason a more general field was preferred.
- If you are publishing a site behind an ENS name today, set `contenthash`, not `multihash`.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1062
