Skip to content

Self-describing content-addressed identifiers for distributed systems implementation in Python (fork of the deprecated ipld/py-cid)

License

Notifications You must be signed in to change notification settings

pinnaculum/py-multiformats-cid

Repository files navigation

CID (Content IDentifier)

What is CID ?

CID is a format for referencing content in distributed information systems, like IPFS. It leverages content addressing, cryptographic hashing, and self-describing formats.

It is the core identifier used by IPFS and IPLD.

CID is a self-describing content-addressed identifier.

It uses cryptographic hashes to achieve content addressing.

It uses several multiformats to achieve flexible self-description, namely multihash for hashes, multicodec for data content types, and multibase to encode the CID itself into strings.

Sample Usage

>>> from multiformats_cid import make_cid
>>> make_cid('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')
CIDv0(version=0, codec=dag-pb, multihash=b"\x12 \xb9M'\xb9\x93M>\x08\xa5.R\xd7\xda}\xab\xfa\xc4\x84..")

>>> cid = make_cid('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')
>>> print(cid.version, cid.codec, cid.multihash)

>>> print(cid.encode())
QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4

>>> str(cid)
'QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'

Installation

Stable release

To install py-multiformats-cid, run this command in your terminal:

$ pip install py-multiformats-cid

This is the preferred method to install CID, as it will always install the most recent stable release.

If you don't have pip installed, this Python installation guide can guide you through the process.

From sources

The sources for py-multiformats-cid can be downloaded from the Github repo.

You can either clone the public repository:

$ git clone https://github.com/pinnaculum/py-multiformats-cid

Or download the tarball:

$ curl  -OL https://github.com/pinnaculum/py-multiformats-cid/tarball/master

Once you have a copy of the source, you can install it with:

$ python setup.py install

Other info

About

Self-describing content-addressed identifiers for distributed systems implementation in Python (fork of the deprecated ipld/py-cid)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published