Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

RFC 0001: Text Peer Ids as CIDs

Abstract

This is an RFC to modify Peer Id spec to alter the default string representation from Multihash to CIDv1 in Base32 and to support encoding/decoding text Peer Ids as CIDs.

Motivation

  1. Current text representation of Peer Id (multihash in Base58btc) is case-sensitive. This means we can't use it in case-insensitive contexts such as domain names (RFC1035 + RFC1123) or FAT filesystems.
  2. CID provide multibase support and base32 makes a safe default that will work in case-insensitive contexts, enabling us to put Peer Ids in domains or create files with Peer Ids as names.
  3. It's much easier to upgrade wire protocols than text. This RFC makes Peer Ids in text form fully self describing, making them more future-proof. A dedicated multicodec in text-encoded CID will indicate that it's a hash of a libp2p public key.

Detailed design

  1. Switch text encoding and decoding of Peer Ids from Multihash to CID.
  2. The new text representation should be CIDv1 with additional requirements:
    • MUST have multicodec set to libp2p-key (0x72)
    • SHOULD have multibase set to base32 (Base32 without padding, as specified by RFC4648)

Upgrade path

  1. Release support for reading Peer Id represented with CIDv1
  2. Wait three months or until the next release (whichever comes first)
  3. Switch the default Peer Id output format to CIDv1 in Base32

Backward compatibility

The old text representation (Multihash encoded as base58btc) is a valid CIDv0 and does not require any special handling.

Alternatives

We could just add a multibase prefix to multihash, but that requires more work and introduces a new format. This option was rejected as using CID enables reuse of existing serializers/deserializers and does not create any new standards.

Unresolved questions

This RFC punts pids-as-cids on the wire down the road but that's something we can revisit if it ever becomes relevant.