Update eip-1577.md (#1611)

This commit is contained in:
Nick Johnson 2018-11-28 18:59:16 +13:00 committed by GitHub
parent 37ef8edc8d
commit 2fc626317d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -24,13 +24,21 @@ The field `contenthash` is introduced, which permits a wide range of protocols t
The fields `content` and `multihash` are deprecated.
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:
The value returned by `contenthash` MUST be represented as a machine-readable [multicodec](https://github.com/multiformats/multicodec). The format is specified as follows:
```
<protoCode uvarint><value []byte>
```
protoCodes and their meanings are specified in the [ensdomains/multicodec](https://github.com/ensdomains/multicodec) repository.
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 value is formatted as follows:
```
<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.
When resolving a `contenthash`, 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