libp2p implementation in Nim https://status-im.github.io/nim-libp2p/docs/
Go to file
Tanguy 0f6b934628
Merge remote-tracking branch 'origin/unstable' into quic
2022-08-25 14:59:52 +02:00
.assets Documentation (#716) 2022-07-01 20:19:57 +02:00
.github/workflows ci: test Nim 1.6 branch (#747) 2022-08-02 19:07:08 +02:00
examples Circuit relay v2 (#717) 2022-08-01 14:31:22 +02:00
libp2p Merge remote-tracking branch 'origin/unstable' into quic 2022-08-25 14:59:52 +02:00
scripts Enable gh actions to run on multiple platforms (#479) 2020-12-22 18:12:02 -06:00
tests Merge remote-tracking branch 'origin/unstable' into quic 2022-08-25 14:59:52 +02:00
tools Documentation (#716) 2022-07-01 20:19:57 +02:00
.appveyor.yml Gossip one one (#240) 2020-09-21 11:16:29 +02:00
.gitignore Add setup files (#738) 2022-07-12 21:03:23 +03:00
.pinned fix ci 2022-08-02 16:00:45 +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 Documentation site (#745) 2022-07-26 12:44:26 +02:00
codecov.yml fix reports number 2021-03-15 12:16:01 +09:00
config.nims make it more Nim 1.4+ compatible (#742) 2022-08-03 13:33:19 +02:00
libp2p.nim Documentation site (#745) 2022-07-26 12:44:26 +02:00
libp2p.nimble Merge remote-tracking branch 'origin/unstable' into quic 2022-08-03 14:33:57 +02:00
mkdocs.yml Documentation site (#745) 2022-07-26 12:44:26 +02:00
nimble.lock Add setup files (#738) 2022-07-12 21:03:23 +03:00
nimdoc.cfg Documentation (#716) 2022-07-01 20:19:57 +02:00

README.md

nim-libp2p logo

The Nim implementation of the libp2p Networking Stack.

Introduction

An implementation of libp2p in Nim.

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

Prerequisite

nimble install libp2p

Getting Started

You'll find the documentation [here].(https://status-im.github.io/nim-libp2p/docs/)

Go Daemon: Please find the installation and usage intructions in daemonapi.md.

Modules

List of packages modules implemented in nim-libp2p:

Name Description
Libp2p
libp2p The core of the project
connmanager Connection manager
identify / push identify Identify protocol
ping Ping protocol
libp2p-daemon-client go-daemon nim wrapper
interop-libp2p Interop tests
Transports
libp2p-tcp TCP transport
libp2p-ws WebSocket & WebSocket Secure transport
Secure Channels
libp2p-secio Secio secure channel
libp2p-noise Noise secure channel
libp2p-plaintext Plain Text for development purposes
Stream Multiplexers
libp2p-mplex MPlex multiplexer
Data Types
peer-id Cryptographic identifiers
peer-store "Phone book" of known peers
multiaddress Composable network addresses
signed envelope Signed generic data container
routing record Signed peer dialing informations
Utilities
libp2p-crypto Cryptographic backend
libp2p-crypto-secp256k1
Pubsub
libp2p-pubsub Pub-Sub generic interface
libp2p-floodsub FloodSub implementation
libp2p-gossipsub GossipSub implementation

Users

nim-libp2p is used by:

  • Nimbus, an Ethereum client
  • nwaku, a decentralized messaging application
  • nim-codex, a decentralized storage application
  • (open a pull request if you want to be included here)

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

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

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

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.