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 strives to be a modular stack with secure defaults and useful protocols, while remaining open and extensible. This is a native Nim implementation, using chronos for asynchronous execution. It's used in production by a few projects
Learn more about libp2p at libp2p.io and follow libp2p's documentation docs.libp2p.io.
The currently supported Nim versions are 2.0 and 2.2.
You'll find the nim-libp2p documentation here. See examples for simple usage patterns.
Try out the chat example. For this you'll need to have go-libp2p-daemon
running. Full code can be found here:
nim c -r --threads:on examples/directchat.nim
This will output a peer ID such as QmbmHfVvouKammmQDJck4hz33WvVktNEe7pasxz2HgseRu
which you can use in another instance to connect to it.
./examples/directchat /connect QmbmHfVvouKammmQDJck4hz33WvVktNEe7pasxz2HgseRu # change this hash by the hash you were given
You can now chat between the instances!
Clone the repository and install the dependencies:
git clone https://github.com/vacp2p/nim-libp2p cd nim-libp2p nimble install -dy
You can use nix develop
to start a shell with Nim and Nimble.
nimble 0.20.1 is required for running testnative
. At time of writing, this is not available in nixpkgs: If using nix develop
, follow up with nimble install nimble
, and use that (typically ~/.nimble/bin/nimble
).
Run unit tests:
# run all the unit tests nimble test
Obs: Running all tests requires the go-libp2p-daemon
to be installed and running.
If you only want to run tests that don't require go-libp2p-daemon
, use:
For a list of all available test suites, use:
The libp2p implementation in Nim is a work in progress. We welcome contributors to help out! Specifically, you can:
Enable quic transport support
nim c -d:libp2p_quic_support some_file.nim
Enable autotls support
nim c -d:libp2p_autotls_support some_file.nim
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
List of packages modules implemented in nim-libp2p:
nim-libp2p is used by:
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:
.public.
, they will remain compatible during each MAJOR
versionMINOR
version (but remain compatible for each new PATCH
)We aim to be compatible at all time with at least 2 Nim MINOR
versions, currently 2.0 & 2.2
Licensed and distributed under either of
or
at your option. These files may not be copied, modified, or distributed except according to those terms.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4