libp2p implementation in Nim https://status-im.github.io/nim-libp2p/docs/
Go to file
Tanguy 718374d890
Merge pull request #718 from status-im/unstable
Unstable
2022-06-07 10:06:31 +02:00
.github/workflows Pin go version in CI (#706) 2022-04-05 13:12:55 +02:00
docs Fixes for style check (#676) 2021-12-16 11:05:20 +01:00
examples Chronos strict exception tracking (#652) 2022-01-05 16:27:33 +01:00
libp2p Fix compilation error on nim 1.4 (#723) 2022-05-27 12:51:56 +02:00
scripts Enable gh actions to run on multiple platforms (#479) 2020-12-22 18:12:02 -06:00
tests Peer store refacto (#700) 2022-05-25 12:12:57 +02:00
tools expose more libp2p performance and queuing metrics (#678) 2022-04-06 16:00:24 +02:00
.appveyor.yml Gossip one one (#240) 2020-09-21 11:16:29 +02:00
.gitignore Pin dependencies for CI (#677) 2021-12-16 18:00:10 +00:00
.pinned Bump deps (#720) 2022-05-19 17:29:09 +02:00
LICENSE Initial commit 2018-11-19 03:58:31 +02:00
LICENSE-APACHEv2 Initialize travis and licenses. 2018-11-19 04:04:47 +02:00
LICENSE-MIT Initialize travis and licenses. 2018-11-19 04:04:47 +02:00
README.md Update README 2021-12-15 15:01:28 +01:00
codecov.yml fix reports number 2021-03-15 12:16:01 +09:00
config.nims Less warnings (#710) 2022-05-24 15:10:57 +02:00
libp2p.nim Cleanup testinterop imports (#589) 2021-06-11 16:34:40 -06:00
libp2p.nimble expose more libp2p performance and queuing metrics (#678) 2022-04-06 16:00:24 +02:00

README.md

libp2p hex logo

The Nim implementation of the libp2p Networking Stack.

Introduction

An implementation of libp2p in Nim.

Project Status

libp2p is used in production by a few projects at Status, including Nimbus.

While far from complete, currently available components are stable.

Check our examples folder to get started!

Table of Contents

Background

libp2p is a networking stack and library modularized out of The IPFS Project, and bundled separately for other tools to use.

libp2p is the product of a long and arduous quest of understanding; a deep dive into the internet's network stack and the peer-to-peer protocols from the past. Building large scale peer-to-peer systems has been complex and difficult in the last 15 years and libp2p is a way to fix that. It is a "network stack", a suite of networking protocols 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.

  • Learn more about libp2p at libp2p.io and follow our evolving documentation efforts at docs.libp2p.io.
  • Here is an overview of libp2p and its implementations in other programming languages.

Install

nimble install libp2p

Prerequisite

Usage

API

The specification is available in the docs/api folder.

Getting Started

Please read the GETTING_STARTED.md guide.

Tutorials and Examples

Example code can be found in the examples folder.

Direct Chat Tutorial

  • Part I: Set up the main function and use multi-thread for processing IO.
  • Part II: Dial remote peer and allow customized user input commands.
  • Part III: Configure and establish a libp2p node.

Using the Go Daemon

Please find the installation and usage intructions in daemonapi.md.

Examples can be found in the examples/go-daemon folder;

Development

Clone and Install dependencies:

git clone https://github.com/status-im/nim-libp2p
cd nim-libp2p
nimble install

Run unit tests

# run all the unit tests
nimble test

The code follows the Status Nim Style Guide.

Packages

List of packages currently in existence for nim-libp2p:

Libp2p

Transports

Secure Channels

Stream Multiplexers

Utilities

Data Types

Pubsub

Packages that exist in the original libp2p specs and are under active development:

  • libp2p-daemon
  • libp2p-webrtc-direct
  • libp2p-webrtc-star
  • libp2p-spdy
  • libp2p-bootstrap
  • libp2p-kad-dht
  • libp2p-mdns
  • libp2p-webrtc-star
  • libp2p-delegated-content-routing
  • libp2p-delegated-peer-routing
  • libp2p-nat-mgnr
  • libp2p-utils

** Note that the current stack reflects the minimal requirements for the upcoming Eth2 implementation.

Tips and tricks

enable expensive metrics:

nim c -d:libp2p_expensive_metrics some_file.nim

use identify metrics

nim c -d:libp2p_agents_metrics -d:KnownLibP2PAgents=nimbus,lighthouse,prysm,teku some_file.nim

specify gossipsub specific topics to measure

nim c -d:KnownLibP2PTopics=topic1,topic2,topic3 some_file.nim

Contribute

The libp2p implementation in Nim is a work in progress. We welcome contributors to help out! Specifically, you can:

  • 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.
  • Perform code reviews. Feel free to let us know if you found anything that can a) speed up the project development b) ensure better quality and c) reduce possible future bugs.
  • Add tests. Help nim-libp2p to be more robust by adding more tests to the tests folder.

The code follows the Status Nim Style Guide.

Core Developers

@cheatfate, Dmitriy Ryajov, Tanguy, Zahary Karadjov

License

Licensed and distributed under either of

or

at your option. These files may not be copied, modified, or distributed except according to those terms.