Skip to content

Commit

Permalink
peer-ids.md: be explicit about supporting CID v0&v1
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
  • Loading branch information
lidel committed Sep 30, 2019
1 parent 4e2c796 commit b621ac5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions peer-ids/peer-ids.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,17 @@ behavior.

Peer Ids are [multihashes][multihash] canonically represented with [CIDs](https://github.com/ipld/cid) when encoded into strings.

CID is a multihash with a prefix that specifies things like base encoding, cid version and the type of data behind it:
Encoding and decoding of string representation MUST follow [CID specification][cid-decoding].

Implementations parsing IDs from text MUST support both base58 CIDv0 and CIDv1 in base32, and they MUST generate base32-encoded CIDv1 by default. Generating CIDv0 is allowed as an opt-in (behind a flag).

CIDv0 is a multihash encoded in Base58.
CIDv1 is a multihash with a prefix that specifies things like base encoding, cid version and the type of data behind it:

```
<cidv1> ::= <multibase><cid-version><multicodec><multihash>
```

Encoding and decoding of string representation must follow [CID spec][cid-decoding].

#### libp2p-key CID

The canonical string representation of a Peer Id is a CID v1
Expand Down

0 comments on commit b621ac5

Please sign in to comment.