Skip to content

vacp2p/nim-libp2p

nim-libp2p logo

The Nim implementation of the libp2p Networking Stack.

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 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.

Contribute

nim-libp2p is a great place to contribute. Your contribution will help drive thousands of decentralized nodes across networks worldwide.

The best part is that nim-libp2p has good first issues that are especially suited for newcomers. Your contributions will be guided by core maintainers, just like an internship experience but decentralized.

Jump into the contributing page to get started, nim-libp2p is expecting your contribution!

Install

The currently supported Nim versions are v2.0.16 and v2.2.6.

nimble install libp2p

You'll find the nim-libp2p documentation here. See examples for simple usage patterns.

Development

See the development guide to get started with the project and testing. For more details, refer to the documentation.

Contributors

Thanks to everyone who has contributed to nim-libp2p. Your support and efforts are greatly appreciated.

nim-libp2p contributors

Join the Conversation

Connect with other contributors in our community channel. Ask questions, share ideas, get support, and stay informed about the latest updates from the maintainers.

Users

nim-libp2p is used by:

  • Nimbus, an Ethereum client
  • logos-delivery, a decentralized messaging protocols
  • logos-storage, a decentralized storage protocols
  • (open a pull request if you want to be included here)

Stability

nim-libp2p has been used in production for many years 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)

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.

Modules

List of packages modules implemented in nim-libp2p:

Name Description
Libp2p
libp2p The core Switch orchestrating transports, connections, and protocols
builders SwitchBuilder fluent API for configuring and instantiating nodes
connmanager Connection manager
identify / push identify Identify protocol
ping Ping protocol
rendezvous Rendezvous peer discovery protocol
Transports
tcp TCP transport
ws WebSocket & WebSocket Secure transport
quic QUIC transport
tor Tor transport
memory In-memory transport for testing
Secure Channels
noise Noise secure channel
plaintext Plain text for development purposes
Stream Multiplexers
mplex MPlex multiplexer
yamux Yamux multiplexer
Data Types
peer-id Cryptographic peer identifiers
peer-store Address book of known peers
multiaddress Composable network addresses
signed-envelope Signed generic data container
routing-record Signed peer dialing information
discovery manager Discovery manager
Connectivity
autonat AutoNAT v1 - automatic NAT detection
autonat-v2 AutoNAT v2 - improved NAT detection
relay Circuit Relay v2 for NAT traversal
dcutr Direct Connection Upgrade through Relay (hole punching)
hole-punching service Hole punching service coordinating AutoNAT, Relay, and DCUTR
auto-relay service Automatic relay node discovery and management
Utilities
crypto Cryptographic backend (RSA, Ed25519, Secp256k1, ECDSA)
crypto-secp256k1 Secp256k1 elliptic curve
multistream-select Protocol negotiation
autotls Automatic TLS certificate provisioning via ACME
nameresolving DNS name resolver for multiaddresses
Pubsub
pubsub Pub-Sub generic interface
floodsub FloodSub implementation
gossipsub GossipSub implementation
DHT
kademlia Kademlia DHT for peer/value discovery
kademlia-discovery Kademlia-based peer discovery
Privacy
mix Mix network protocol with Sphinx packet format for anonymity
Performance
perf Perf protocol for benchmarking libp2p nodes