js-IPFS 0.56.0 upgrades to new multiformats stack and adds .car import/export

js-IPFS 0.56.0 upgrades to new multiformats stack and adds .car import/export

# πŸ”¦ Highlights

upgrades to new multiformats stack and adds .car import/export

[email protected] is on its way to the moon with a new data layer and import/export for Content Addressable aRchive (opens new window)s along with many small bug fixes and performance improvements!

# πŸ“š Multiformats

Underneath the Interplanetary Filesystem is a multitude of Merkle Directed Acyclic Graphs (opens new window). When you add a file to your IPFS node, you are converting it into a DAG representation of that file. This DAG may be made up of one or more nodes of the dag-pb (opens new window) or raw (opens new window) format in various UnixFS layouts (opens new window).

DAG node formats are not limited to dag-pb or raw, however, we also have dag-cbor (opens new window), dag-json (opens new window) and the newcomer dag-jose (opens new window).

The interfaces that these formats implement was previously defined by the ipld/interface-ipld-format (opens new window) module, but there is an all-new implementation in the form of BlockCodec (opens new window)s from the multiformats/js-multiformats (opens new window) module.

[email protected] ships with this new implementation which is much more lightweight and easier to work with and has seen the gzipped size of the ipfs-http-client (opens new window) bundle drop by amost 26%.

The most common formats are supported out of the box - dag-pb (opens new window), dag-cbor (opens new window), raw (opens new window), and json (opens new window). Older formats that haven't been refactored into BlockCodecs yet such as ipld-ethereum (opens new window) and ipld-git (opens new window) can be converted at runtime using the ipld-format-to-blockcodec (opens new window) module, and you can configure your node to use them - see the traverse-ipld-graphs (opens new window) example for how to do this.

Multiformats also covers multihashing and multibase encoding of data. Out of the box [email protected] supports common hashes and bases such as sha2-256, base58btc and base32 but more esoteric hashes/bases will need to be configured in a similar way - see the docs (opens new window) for more information and howtos.

If you want to learn more about Merkle DAGs, there's a whole tutorial (opens new window) on the ProtoSchool website!

# .car import/export

The low-level ipfs.block.put and ipfs.block.get commands allow you to get and put invidiual blocks into your blockstore, but this can be tedious when dealing with large DAG (opens new window)s since you will invoke these operations multiple times and without interpreting the blocks as you read them, there's no way to follow links (opens new window) to other blocks.

Enter the Content Addressable aRchive (opens new window) or .car file. This file functions as storage for the blocks that make up one or more DAGs, consisting of a root CID (opens new window) then some or all of the blocks that are children of that CID.

.car files can be exported from [email protected] and later with:

$ jsipfs dag export ${CID} | archive.car

and imported with:

$ jsipfs dag import ./archive.car

or

$ cat ./archive.car | jsipfs dag import

Equivalent API methods exist to perform the same operations against an in-process node or over HTTP to a remote js-IPFS or go-IPFS node - see the docs for ipfs.dag.export (opens new window) and ipfs.dag.import (opens new window) for more information.

# ✨New features

# πŸ”¨ Breaking changes

# πŸ•·οΈ Bug fixes

# πŸ—ΊοΈ What’s next?

Check out the js-IPFS Project Roadmap (opens new window) which contains headline features organised in the order we hope them to land.

Only large features are called out in the roadmap, expect lots of small bugfix releases between the roadmapped items!

# 😍 Huge thank you to everyone that made this release possible

# πŸ™ŒπŸ½ Want to contribute?

Would you like to contribute to the IPFS project and don’t know how? Well, there are a few places you can get started:

  • Check the issues with the help wanted label in the js-IPFS repo (opens new window)
  • Join an IPFS All Hands, introduce yourself and let us know where you would like to contribute: https://github.com/ipfs/team-mgmt/#weekly-ipfs-all-hands
  • Hack with IPFS and show us what you made! The All Hands call is also the perfect venue for demos, join in and show us what you built
  • Join the discussion at https://discuss.ipfs.io/ and help users finding their answers.
  • Join the πŸš€ IPFS Core Implementations Weekly Sync πŸ›° (opens new window) and be part of the action!

# ⁉️ Do you have questions?

The best place to ask your questions about IPFS, how it works, and what you can do with it is at discuss.ipfs.io (opens new window). We are also available at the #ipfs channel on Freenode.