Registry / networking / libp2p

libp2p

JSON →
library0.55.0rscratesunverified

Peer-to-peer networking library for building decentralized applications with modular transports, protocols, and discovery.

# Cargo.toml [dependencies] libp2p = "0.55.0"
INSTALL
IMPORT
SIG · LIBP2P
L
libp2p
networkingrustv0.55.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Swarm
use libp2p::Swarm;

Creates a libp2p swarm with a ping protocol and listens on a random TCP port.

use libp2p::Swarm; use libp2p::ping::{Ping, PingConfig}; let mut swarm = Swarm::new(libp2p::development_transport::build().unwrap(), Ping::new(PingConfig::new()), libp2p::identity::Keypair::generate_ed25519().public().to_peer_id()); swarm.listen_on("/ip4/0.0.0.0/tcp/0".parse().unwrap()).unwrap(); loop { swarm.next().await; }
Debug
Known issues
gotchalibp2p requires an async runtime like Tokio or async-std.
fix
Add tokio = { version = "1", features = ["full"] } and use #[tokio::main] or similar.
affects: >=0.50.0
Upgrade
Version history
0.55.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
libp2p — cargo add libp2p · libregistry