npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ipfs-coord

v8.0.8

Published

A JS library for helping IPFS peers coordinate, find a common interest, and stay connected around that interest.

Downloads

923

Readme

ipfs-coord logo

ipfs-coord

This is a JavaScript npm library built on top of js-ipfs. It provides the following high-level features:

  • Subnets - Helps IPFS nodes create an on-the-fly subnetwork, using pubsub channels.
  • Peer Discovery - Allows new peers entering the subnetwork to find the other subnetwork peers.
  • E2EE - Creates end-to-end encrypted (e2ee) communication channels between peers.
  • Censorship Resistance - Allows automatic networking between peers, even if they are behind a firewall.
  • Payments - Allows peers to easily pay one another in cryptocurrency for access to web services.

This library will help IPFS peers discover one another, coordinate around a common interest, and then stay connected around that interest. It's main sub-components are:

  • IPFS pubsub channels for communication
  • OrbitDB for persistence and to prevent 'dropped messages'
  • Circuit Relays for censorship resistance and tunneling through firewalls
  • Bitcoin Cash for end-to-end encryption and payments.

This library will automatically track peers, connects to them through circuit-relays, and end-to-end encrypts all communication with each node. For more details, read the ipfs-coord specification.

Here are some use cases where IPFS node coordination is needed:

  • e2e encrypted chat
  • Circuit-relay as-a-service
  • Creating CoinJoin transactions
  • Decentralized exchange of currencies
  • Compute-as-a-service
  • Storage-as-a-service

The ultimate goal for this library is to be a building block for building a replacement to the conventional REST API. APIs like REST or gRPC are incredibly valuable, but suffer from the same censorship risks as the rest of the web (location-based addressing). An IPFS-based API, in a fully distributed network like IPFS, must have sophisticated coordination in order for it to function properly. ipfs-coord is that coordination library.

Here is some videos and blog posts that preceded this work:

Additional content that preceded this work:

A live demo of using this library to build an e2e encrypted chat app can be interacted with here:

Install

Install the npm library: npm install --save ipfs-coord

This library requires a peer dependency of:

Example in a node.js app:

Here is an example of adding ipfs-coord to your own node.js app:

const IPFS = require('ipfs')
const BCHJS = require('@psf/bch-js')
const IpfsCoord = require('ipfs-coord')

async function start() {
  // Create an instance of bch-js and IPFS.
  const bchjs = new BCHJS()
  const ipfs = await IPFS.create()

  // Pass bch-js and IPFS to ipfs-coord when instantiating it.
  const ipfsCoord = new IpfsCoord({
    ipfs,
    bchjs,
    type: 'node.js'
  })

  await ipfsCoord.start()
  console.log('IPFS and the coordination library is ready.')
}
start()

Example in a browser app:

This example is exactly the same, except when instantiating the ipfs-coord library, you want to specify the type as browser.

import IPFS from 'ipfs'
import BCHJS from '@psf/bch-js'
import IpfsCoord from 'ipfs-coord'

async function start() {
  // Create an instance of bch-js and IPFS.
  const bchjs = new BCHJS()
  const ipfs = await IPFS.create()

  // Pass bch-js and IPFS to ipfs-coord when instantiating it.
  const ipfsCoord = new IpfsCoord({
    ipfs,
    bchjs,
    type: 'browser'
  })

  await ipfsCoord.start()
  console.log('IPFS and the coordination library is ready.')
}
start()

Development Environment

Setup a development environment:

git clone https://github.com/christroutner/ipfs-coord
cd ipfs-coord
npm install
npm test

Licence

MIT