- Start Date: 2019-08-15
- Related issues: go-ipfs/issues/5287, multicodec/issues/130, go-libp2p-core/pull/41
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.
- 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.
- 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. - 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.
- Switch text encoding and decoding of Peer Ids from Multihash to CID.
- 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)
- MUST have multicodec set to
- Release support for reading Peer Id represented with CIDv1
- Wait three months or until the next release (whichever comes first)
- Switch the default Peer Id output format to CIDv1 in Base32
The old text representation (Multihash encoded as base58btc
)
is a valid CIDv0 and does not require any special handling.
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.
This RFC punts pids-as-cids on the wire down the road but that's something we can revisit if it ever becomes relevant.