Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eip-1577.md #1685

Merged
merged 4 commits into from
Jan 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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