libp2p implementation in Nim https://status-im.github.io/nim-libp2p/docs/
Go to file
Álex Cabeza Romero aa4ebb0b3c
docs(general): Improve docs (#1021)
2024-02-15 16:14:26 +01:00
.assets Documentation (#716) 2022-07-01 20:19:57 +02:00
.github improvement(ci): improve ci daily workflows (#1002) 2023-12-18 20:14:33 +01:00
examples docs(general): Improve docs (#1021) 2024-02-15 16:14:26 +01:00
libp2p fix: yamux metrics (#1022) 2024-02-08 12:36:58 +01:00
scripts docs(general): Improve docs (#1021) 2024-02-15 16:14:26 +01:00
tests improvement: enhanced checkExpiring macro with custom timeout (#1023) 2024-02-09 11:51:27 +01:00
tools Happy new year! (#847) 2023-01-20 15:47:40 +01:00
.appveyor.yml Gossip one one (#240) 2020-09-21 11:16:29 +02:00
.gitignore tests(flaky): Increase check timeouts (#995) 2024-01-31 23:46:12 +00:00
.pinned Bump dependencies (#947) 2023-09-06 17:52:43 +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 docs(general): Improve docs (#1021) 2024-02-15 16:14:26 +01:00
codecov.yml Fix Codecov (#802) 2022-11-16 14:33:42 +01:00
config.nims Remove nim 1.2 support (#907) 2023-06-07 11:12:49 +00:00
libp2p.nim Less warnings (#813) 2023-05-18 10:24:17 +02:00
libp2p.nimble Remove unittest2 range (#986) 2023-11-17 08:20:02 +01:00
mkdocs.yml Fix website (#812) 2022-12-01 12:20:17 +01: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.

Table of Contents

Background

libp2p is a Peer-to-Peer networking stack, with implementations in multiple languages derived from the same specifications.

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's striving to be a modular stack, with sane and secure defaults, useful protocols, while remain open and extensible. This implementation in native Nim, relying on chronos for async. It's used in production by a few projects

Learn more about libp2p at libp2p.io and follow libp2p's documentation docs.libp2p.io.

Install

Prerequisite

The currently supported Nim version is 1.6.18.

nimble install libp2p

Getting Started

You'll find the nim-libp2p documentation here.

Testing

Remember you'll need to build the go-libp2p-daemon binary to run the nim-libp2p tests. To do so, please follow the installation instructions 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
libp2p-tor Tor 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
libp2p-yamux Yamux multiplexer
Data Types
peer-id Cryptographic identifiers
peer-store "Address book" of known peers
multiaddress Composable network addresses
signed envelope Signed generic data container
routing record Signed peer dialing informations
discovery manager Discovery Manager
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)

Stability

nim-libp2p has been used in production for over a year in high-stake scenarios, so its core is considered stable. Some modules are more recent and less stable.

The versioning follows semver, with some additions:

  • Some of libp2p procedures are marked as .public., they will remain compatible during each MAJOR version
  • The rest of the procedures are considered internal, and can change at any MINOR version (but remain compatible for each new PATCH)

We aim to be compatible at all time with at least 2 Nim MINOR versions, currently 1.6 & 2.0

Development

Clone and Install dependencies:

git clone https://github.com/status-im/nim-libp2p
cd nim-libp2p
# to use dependencies computed by nimble
nimble install -dy
# OR to install the dependencies versions used in CI
nimble install_pinned

Run unit tests:

# run all the unit tests
nimble test

This requires the go daemon to be available. To only run native tests, use nimble testnative. Or use nimble tasks to show all available tasks.

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.

Contributors

nim-libp2p contributors

Core Maintainers

Tanguy
Tanguy (Menduist)
Ludovic
Ludovic
Diego
Diego

Compile time flags

Enable expensive metrics (ie, metrics with per-peer cardinality):

nim c -d:libp2p_expensive_metrics some_file.nim

Set list of known libp2p agents for metrics:

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

Specify gossipsub specific topics to measure in the metrics:

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.