Update eip-1577.md (#1593)

This commit is contained in:
Dean Eigenmann 2018-11-19 12:10:36 +09:00 committed by Nick Johnson
parent 4bfe033f00
commit 9130d7a45d
1 changed files with 20 additions and 13 deletions

View File

@ -1,50 +1,57 @@
---
eip: 1577
title: Multiaddr support for ENS
title: contenthash field for ENS
author: Dean Eigenmann <dean@ens.domains>, Nick Johnson <nick@ens.domains>
type: Standards Track
category: ERC
status: Draft
created: 2018-11-13
discussion-to: https://github.com/ethereum/EIPs/pull/1577
---
## Abstract
This EIP introduces the new `multiaddr` 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.
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.
## Motivation
Multiple applications including [Metamask](https://metamask.io/) and mobile wallets such as [Status](https://status.im) have begun resolving ENS names to content hosted on distributed systems such as [IPFS](https://ipfs.io/) and [Swarm](https://swarm-guide.readthedocs.io). Due to the various ways content can be stored and addressed, a standard is required so these applications know how to resolve names and that domain owners know how their content will be resolved.
Multiple applications including [Metamask](https://metamask.io/) and mobile clients such as [Status](https://status.im) have begun resolving ENS names to content hosted on distributed systems such as [IPFS](https://ipfs.io/) and [Swarm](https://swarm-guide.readthedocs.io). Due to the various ways content can be stored and addressed, a standard is required so these applications know how to resolve names and that domain owners know how their content will be resolved.
The `multiaddr` field allows for easy specification of network and content addresses in ENS.
The `contenthash` field allows for easy specification of network and content addresses in ENS.
## Specification
The field `multiaddr` is introduced, which permits a wide range of protocols to be supported by ENS names. Resolvers supporting this field MUST return `true` when the `supportsInterface` function is called with argument `0x4cb7724c`.
The field `contenthash` is introduced, which permits a wide range of protocols to be supported by ENS names. Resolvers supporting this field MUST return `true` when the `supportsInterface` function is called with argument `0xbc1c58d1`.
The fields `content` and `multihash` are deprecated.
Addresses MUST be represented as a machine-readable [multiaddr](https://github.com/multiformats/multiaddr). The format is specified as follows:
The encoding of the value depends on the content type specified by the protoCode; for instance, types in the range 0x00-0xf0 are encoded using [multihash](https://github.com/multiformats/multihash), meaning their format is specified as follows:
```
<protoCode uvarint><value []byte>
<varint hash function code><varint digest size in bytes><hash function output>
```
When resolving a multiaddr, applications MUST use the protocol code to determine what type of address is encoded, and resolve the address appropriately for that protocol, if supported.
### Example
Text format:
Input data:
```
/p2p/QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4
storage system: IPFS (0x01)
hash function: sha2-256 (0x12)
hash length: 32 bytes (0x20)
hash: 29f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
```
Binary format:
```
a50322122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
0x01122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
```
Text format:
```
/ipfs/7CRg9waUqSw8n2qweMebgzgBa4hxtpNonC7RBeWN5HSF4wx
```
### Fallback
@ -53,7 +60,7 @@ In order to support names that have an IPFS or Swarm hash in their `content` fie
### Implementation
To support `multiaddr`, a new resolver has been developed and can be found [here](https://github.com/ensdomains/resolvers/blob/master/contracts/PublicResolver.sol).
To support `contenthash`, a new resolver has been developed and can be found [here](https://github.com/ensdomains/resolvers/blob/master/contracts/PublicResolver.sol), which has been deployed at [0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3](https://etherscan.io/address/0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3)
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).