Socket
Socket
Sign inDemoInstall

libp2p

Package Overview
Dependencies
Maintainers
5
Versions
909
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libp2p

JavaScript implementation of libp2p, a modular peer to peer network stack


Version published
Weekly downloads
15K
increased by11.13%
Maintainers
5
Weekly downloads
 
Created
Source

libp2p hex logo

The JavaScript implementation of the libp2p Networking Stack.



JavaScript implementation of libp2p, a modular peer to peer network stack

About

Use the createLibp2p function to create a libp2p node.

Example

import { createLibp2p } from 'libp2p'

const node = await createLibp2p({
  // ...other options
})

Background

libp2p is the product of a long and arduous quest to understand the evolution of the Internet networking stack. In order to build P2P applications, devs have long had to make custom ad-hoc solutions to fit their needs, sometimes making some hard assumptions about their runtimes and the state of the network at the time of their development. Today, looking back more than 20 years, we see a clear pattern in the types of mechanisms built around the Internet Protocol, IP, which can be found throughout many layers of the OSI layer system, libp2p distils these mechanisms into flat categories and defines clear interfaces that once exposed, enable other protocols and applications to use and swap them, enabling upgradability and adaptability for the runtime, without breaking the API.

We are in the process of writing better documentation, blog posts, tutorials and a formal specification. Today you can find:

To sum up, libp2p is a "network stack" -- a protocol suite -- that cleanly separates concerns, and enables sophisticated applications to only use the protocols they absolutely need, without giving up interoperability and upgradeability. libp2p grew out of IPFS, but it is built so that lots of people can use it, for lots of different projects.

Roadmap

The js-libp2p roadmap can be found here: https://github.com/libp2p/js-libp2p/blob/main/ROADMAP.md

It represents current projects the js-libp2p maintainers are focused on and provides an estimation of completion targets.

It is complementary to the overarching libp2p project roadmap: https://github.com/libp2p/specs/blob/master/ROADMAP.md

Usage

Configuration

For all the information on how you can configure libp2p see CONFIGURATION.md.

Limits

For help configuring your node to resist malicious network peers, see LIMITS.md

Getting started

If you are starting your journey with js-libp2p, read the GETTING_STARTED.md guide.

Tutorials and Examples

You can find multiple examples on the examples repo that will guide you through using libp2p for several scenarios.

Development

Clone and install dependencies:

> git clone https://github.com/libp2p/js-libp2p.git
> cd js-libp2p
> npm install
> npm run build

Tests

Run unit tests

# run all the unit tsts
> npm test

# run just Node.js tests
> npm run test:node

# run just Browser tests (Chrome)
> npm run test:chrome

Packages

List of packages currently in existence for libp2p

This table is generated using the module package-table with package-table --data=package-list.json.

PackageVersionDepsCICoverage
libp2p
libp2pnpmDepsGitHub CIcodecov
@libp2p/interfacenpmDepsGitHub CIcodecov
transports
@libp2p/tcpnpmDepsGitHub CIcodecov
@libp2p/webrtcnpmDepsGitHub CIcodecov
@libp2p/websocketsnpmDepsGitHub CIcodecov
@libp2p/webtransportnpmDepsGitHub CIcodecov
secure channels
@chainsafe/libp2p-noisenpmDepsGitHub CIcodecov
@libp2p/plaintextnpmDepsGitHub CIcodecov
stream multiplexers
@libp2p/mplexnpmDepsGitHub CIcodecov
@chainsafe/libp2p-yamuxnpmDepsGitHub CIcodecov
peer discovery
@libp2p/bootstrapnpmDepsGitHub CIcodecov
@libp2p/kad-dhtnpmDepsGitHub CIcodecov
@libp2p/mdnsnpmDepsGitHub CIcodecov
@chainsafe/discv5npmDepsGitHub CIcodecov
content routing
@libp2p/http-v1-content-routingnpmDepsGitHub CIcodecov
@libp2p/delegated-content-routingnpmDepsGitHub CIcodecov
@libp2p/kad-dhtnpmDepsGitHub CIcodecov
peer routing
@libp2p/delegated-peer-routingnpmDepsGitHub CIcodecov
@libp2p/kad-dhtnpmDepsGitHub CIcodecov
utilities
@libp2p/cryptonpmDepsGitHub CIcodecov
data types
@libp2p/peer-idnpmDepsGitHub CIcodecov
@libp2p/peer-recordnpmDepsGitHub CIcodecov
pubsub
@ChainSafe/libp2p-gossipsubnpmDepsGitHub CIcodecov
@libp2p/floodsubnpmDepsGitHub CIcodecov

Used by

HOPR Logo Helia logo OrbitDB logo Waku Peerbit logo

And many others...

Contribute

The libp2p implementation in JavaScript is a work in progress. As such, there are a few things you can do right now to help out:

  • Go through the modules and check out existing issues. This would be especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
  • Perform code reviews. Most of this has been developed by @diasdavid, which means that 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.

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Keywords

FAQs

Package last updated on 27 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc