iprs

Inter planetary specifications in rust-lang


Keywords
multiformats, libp2p
License
MIT

Documentation

Documentation

Multiformats

A collection of protocols which aim to future-proof systems, today. They do this mainly by enhancing format values with self-description. This allows interoperability, protocol agility, and helps us avoid lock in.

The self-describing aspects of the protocols have a few stipulations:

  • They MUST be in-band (with the value); not out-of-band (in context).
  • They MUST avoid lock-in and promote extensibility.
  • They MUST be compact and have a binary-packed representation.
  • They MUST have a human-readable representation.

Unsigned-varint

VARiable INTeger format used in all the multiformats. The encoding is:

  • Unsigned integers are serialized 7 bits at a time, starting with the least significant bits.
  • The most significant bit (msb) in each output byte indicates if there is a continuation byte (msb = 1).
  • There are no signed integers.
  • Integers are minimally encoded.

Refer unsigned-varint spec for details.

Multibase

Base encoding is converting binary-data to plain-text. There are several base-encoding definitions that can convert binary-data to a small subset of, typically, ASCII code. Purpose,

  • Printable character set.
  • A bridge to backward-compatibility.
  • When a channel cannot, do-not, allow binary data.

Refer multibase for details.

Multicodec

Multicodec is an agreed-upon codec table. It is designed for use in binary representations, such as keys or identifiers (i.e CID). Find the canonical table of multicodecs at [table.csv].

Refer multicodec spec for details.

IPLD Foundational Principles

  • Block, A block is a chunk of an IPLD DAG, encoded in a format. Blocks have CIDs.
  • Node, A node is a point in an IPLD DAG (map, list, number, etc.). Many nodes can exist encoded inside one Block.
  • Link, A link is a kind of IPLD Node that points to another IPLD Node. Links are what make IPLD data a DAG rather than only a tree. Links are content-addressable (CID).
  • Path Segment, A path segment is a piece of information that describes a move from one Node to a directly connected child Node. (In other words, a Path-Segment is either a map key or a list index.)
  • Path, A path is composed of Path Segments, thereby describing a traversal from one Node to another Node somewhere deeper in the DAG.
  • Transforming content of a Block into Nodes conforming to the IPLD Data Model should never require interpretation in the context of anything not contained in the Block plus CID.
  • Similarly, traversing an IPLD Node according to a Path should not require interpretation in the context of anything not already contained in that Node plus Path.
  • Format, is the standardized representation of IPLD Links and Paths. It describes how to translate between structured data and binary. MUST remain consistent across all codec implementations.
  • Content addressability refers to the ability to refer to content by a trustless identifier.
  • IPLD links must not be cyclic, even if we add support for relative links.
  • IPLD path resolution means the same thing, everywhere, every time.

Reference:

List of active multiformat specification(s).

There are other implementations that can suite your need better: