Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Latest commit

 

History

History
159 lines (115 loc) · 7.47 KB

File metadata and controls

159 lines (115 loc) · 7.47 KB

IPFS in JavaScript logo

Traverse IPLD graphs

Resolve through IPLD graphs with the dag API


Explore the docs · View Demo · Report Bug · Request Feature/Example

Table of Contents

About The Project

Getting Started

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

Installation and Running example

> npm install
> npm start

Usage

IPLD stands for InterPlanetary Linked-Data, it is the data model of the content-addressable web. It gives IPFS the ability to resolve through any kind of content-addressed graph, as long as the adapter for the format is available.

This tutorial goes through several operations over IPLD graphs using the DAG API.

IPLD Formats

IPLD can read many datatypes, all of which are represented as blocks in the blockstore of your IPFS node. In order to turn a block into a data structure it can use, IPLD uses different codecs to turn Uint8Arrays into JavaScript objects and back.

By default IPFS is bundled with dag-pb, dag-cbor and raw codecs which allow reading UnixFS files and JavaScript objects from the blockstore.

To configure other types, we must pass the ipld.formats option to the IPFS.create() function:

const IPFS = require("ipfs");

const node = await IPFS.create({
  ipld: {
    formats: [
      require("ipld-git"),
      require("ipld-zcash"),
      require("ipld-bitcoin"),
      ...Object.values(require("ipld-ethereum")), // this format exports multiple codecs so flatten into a list
      // etc, etc
    ],
  },
});

See ipld/interface-ipld-format for a list of modules that implement the ipld-format interface.

The example objects contained in "git-objects" have already been decompressed with zlib. An example of how to do this:

$ cat .git/objects/7d/df25817f57c2090a9568cdb17106a76dad7d04 | zlib-flate -uncompress > 7ddf25817f57c2090a9568cdb17106a76dad7d04

Video of the demos

Find a video with a walkthrough of this examples on Youtube:

For more examples, please refer to the Documentation

Documentation

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the IPFS Project
  2. Create your Feature Branch (git checkout -b feature/amazing-feature)
  3. Commit your Changes (git commit -a -m 'feat: add some amazing feature')
  4. Push to the Branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Want to hack on IPFS?

The IPFS implementation in JavaScript needs your help! There are a few things you can do right now to help out:

Read the Code of Conduct and JavaScript Contributing Guidelines.

  • Check out existing issues The issue list has many that are marked as 'help wanted' or 'difficulty:easy' which make great starting points for development, many of which can be tackled with no prior IPFS knowledge
  • Look at the IPFS Roadmap This are the high priority items being worked on right now
  • Perform code reviews More eyes will help a. speed the project along b. ensure quality, and c. reduce possible future bugs.
  • Add tests. There can never be enough tests.
  • Join the Weekly Core Implementations Call it's where everyone discusses what's going on with IPFS and what's next