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

bitboot

v0.1.0

Published

Bootstrap a distributed p2p network

Downloads

8

Readme

bitboot travis npm

P2P Network Bootstrapping

Bitboot allows a new node in a peer-to-peer network to find other nodes in the same network, even if the network being joined is as small as a single node. It has no local dependencies and doesn't require that any other local services be running.

Install

npm install -g bitboot

Command Line Usage

bitboot <magic name>

The magic name should be a unique string (make sure to use quotation marks if it's more than one word) for your network. If at least one other instance of bitboot is running somewhere else with the same magic name, then the program will print out other node's locations as they are found (one per line, in host:port format). If you're just starting a new network, this may take a minute or two before other nodes are found.

Library Example

var Bitboot = require('bitboot')

// The rally point name can be any string and should be unique
// to your peer network
var bb = new Bitboot('bitboot test network')

// this is called whenever the node selects a new ID and rejoins
// the BitTorrent mainline DHT network
bb.on('rejoin', function (nodeId) {
  console.log('I have a new node id:', nodeId.toString('hex'))
})

// this is called whenever a search is made for peers
// peers will be the result of that search (and may be empty)
bb.on('peers', function (peers) {
  console.log('I found peers:', peers)
})

bb.on('error', function (err) {
  console.error(err)
})

Background

Many peer-to-peer networks clients are initially bootstrapped by connecting to a handful of hard-coded, centralized nodes (yes, even Bitcoin and BitTorrent). Every new peer-to-peer network must solve this same challenge, usually by hardcoding centralized bootstrap servers. Bitboot allows you to avoid this step of having to run/maintain a new centralized server if you're creating a new p2p network. Bitboot can also be used more generally to find a single peer (for instance, if you just want to be able to find your home computer and the IP is changing frequently).

When you run bitboot, you give it a magic name to uniquely identify the network you'd like to join. Bitboot then joins the existing BitTorrent DHT (perhaps the largest and most reliable/stable DHT on the planet) and finds other nodes with the same magic name. It does this by selecting a rally point to hang out near based on the magic name where it will meet other nodes with the same magic name value. Also, the ID it uses is carefully selected so other nodes can pick it out as a bitboot peer based on the value of the magic name (in case other non-member nodes are hanging out around the rally point).

Note that while bitboot uses the BitTorrent DHT, it does not harm the existing network in any way (and, in fact, strengthens it by adding additional, fully functional nodes).