Skip to content

Commit

Permalink
Update eip-1577.md (#1685)
Browse files Browse the repository at this point in the history
* Update eip-1577.md

* Update eip-1577.md

* Update eip-1577.md

* Update eip-1577.md
  • Loading branch information
Dean Eigenmann authored and Arachnid committed Jan 10, 2019
1 parent b17d0d6 commit 058136c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions EIPS/eip-1577.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,24 @@ The value returned by `contenthash` MUST be represented as a machine-readable [m
<protoCode uvarint><value []byte>
```

protoCodes and their meanings are specified in the [ensdomains/multicodec](https://github.com/ensdomains/multicodec) repository.
protoCodes and their meanings are specified in the [multiformats/multicodec](https://github.com/multiformats/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:
The encoding of the value depends on the content type specified by the protoCode. Values with protocodes of 0xee and 0xef represent IPFS and Swarm content; these values are encoded as v1 [CIDs](https://github.com/multiformats/cid) without a base prefix, meaning their value is formatted as follows:

```
<varint hash function code><varint digest size in bytes><hash function output>
<protoCode uvarint><cid-version><multicodec-content-type><multihash-content-address>
```

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

Input data:

```
storage system: IPFS (0x01)
storage system: IPFS (0xee)
CID version: 1 (0x01)
content type: dag-pb (0x70)
hash function: sha2-256 (0x12)
hash length: 32 bytes (0x20)
hash: 29f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
Expand All @@ -53,13 +56,13 @@ hash: 29f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
Binary format:

```
0x01122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
0xee010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
```

Text format:

```
/ipfs/QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4
ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4
```

### Fallback
Expand Down

0 comments on commit 058136c

Please sign in to comment.