Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pinnaculum/py-multiformats-cid
Self-describing content-addressed identifiers for distributed systems implementation in Python (fork of the deprecated ipld/py-cid)
https://github.com/pinnaculum/py-multiformats-cid
Last synced: 14 days ago
JSON representation
Self-describing content-addressed identifiers for distributed systems implementation in Python (fork of the deprecated ipld/py-cid)
- Host: GitHub
- URL: https://github.com/pinnaculum/py-multiformats-cid
- Owner: pinnaculum
- License: mit
- Created: 2022-10-31T08:53:12.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-23T18:44:15.000Z (almost 2 years ago)
- Last Synced: 2024-10-23T03:11:18.385Z (22 days ago)
- Language: Python
- Homepage:
- Size: 109 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
CID (Content IDentifier)
------------------------.. image:: https://img.shields.io/pypi/v/py-multiformats-cid.svg
:target: https://pypi.python.org/pypi/py-multiformats-cidWhat 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
============.. code-block:: python
>>> 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:
.. code-block:: console
$ 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... _pip: https://pip.pypa.io
.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/From sources
~~~~~~~~~~~~The sources for *py-multiformats-cid* can be downloaded from the `Github repo`_.
You can either clone the public repository:
.. code-block:: console
$ git clone https://github.com/pinnaculum/py-multiformats-cid
Or download the `tarball`_:
.. code-block:: console
$ curl -OL https://github.com/pinnaculum/py-multiformats-cid/tarball/master
Once you have a copy of the source, you can install it with:
.. code-block:: console
$ python setup.py install
.. _Github repo: https://github.com/pinnaculum/py-multiformats-cid
.. _tarball: https://github.com/pinnaculum/py-multiformats-cid/tarball/masterOther info
==========* Free software: MIT license
* Documentation: https://py-multiformats-cid.readthedocs.io.
* Python versions: 3.7, 3.8, 3.9, 3.10