ae67a9b3f6 | ||
---|---|---|
.assets | ||
.github | ||
examples | ||
libp2p | ||
scripts | ||
tests | ||
tools | ||
.appveyor.yml | ||
.gitignore | ||
.pinned | ||
LICENSE | ||
LICENSE-APACHEv2 | ||
LICENSE-MIT | ||
README.md | ||
codecov.yml | ||
config.nims | ||
libp2p.nim | ||
libp2p.nimble | ||
mkdocs.yml | ||
nimdoc.cfg |
README.md
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
nimble install libp2p
Getting Started
You'll find the nim-libp2p documentation here.
Go Daemon: Please find the installation and usage intructions in daemonapi.md.
Modules
List of packages modules implemented in nim-libp2p:
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 eachMAJOR
version - The rest of the procedures are considered internal, and can change at any
MINOR
version (but remain compatible for each newPATCH
)
We aim to be compatible at all time with at least 2 Nim MINOR
versions, currently 1.2 & 1.6
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
Core Maintainers
Tanguy (Menduist) |
Ludovic |
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
- MIT license: LICENSE-MIT or http://opensource.org/licenses/MIT
or
- Apache License, Version 2.0, (LICENSE-APACHEv2 or http://www.apache.org/licenses/LICENSE-2.0)
at your option. These files may not be copied, modified, or distributed except according to those terms.