Introduction
A minimal, caller-driven libp2p implementation for Rust applications that want QUIC, clear control flow, and no async runtime.
minip2p establishes authenticated QUIC connections with a synchronous
Endpoint. Your application drives progress with poll and next_event —
there is no async runtime. Optional features layer on NAT traversal, pubsub,
and peer discovery without changing the base API.
use minip2p::{Deadline, Endpoint};
fn main() -> Result<(), minip2p::Error> {
let mut node = Endpoint::builder()
.agent_version("my-app/0.1.0")
.bind_quic("127.0.0.1:0")?;
println!("listen={}", node.listen()?);
while let Some(event) = node.next_event(Deadline::NEVER)? {
println!("{event:?}");
}
Ok(())
}
Get started
learn by doing
Install
Add the Git dependency and pick nat, pubsub, or discovery features.
Connect two peers
In about 10 minutes, print a dialable PeerAddr and a Ping RTT.
Understand
understand this
Concepts
Endpoint, PeerId, PeerAddr, PeerReady, and dial versus connect.
Identity
Ephemeral keys, persistent Ed25519 identity, and address shapes.
Do next
do this specific thing
Register a protocol
Negotiate streams, exchange bytes, and half-close or abandon cleanly.
Traverse NAT
Race direct dials against a relay and upgrade with DCUtR.
Publish with pubsub
Subscribe, publish signed gossipsub messages, or select floodsub.
Discover peers
Signed presence beacons and automatic dialing over pubsub + NAT.
Look up
look this up
Feature matrix
Compiled APIs versus builder-activated drivers.
Glossary
PeerId, Multiaddr, PeerReady, Path, Sans-I/O, and more.
Troubleshooting
Symptom → cause → fix for common connection failures.
Constraints
| pre-1.0 | APIs may change; crates are not on crates.io yet. |
| QUIC only | TCP, WebSocket, and WebTransport are out of scope. |
| Rust 1.88+ | Workspace MSRV. |
| Caller-driven | No executor or hidden async task drives the node. |
| Relay client | Bring a Circuit Relay v2 server when a relayed path is required. |