Introduction
A minimal, caller-driven libp2p stack with QUIC, TCP, and no_std.
Install
cargo add minip2p-rsnpm install @minip2p/react-nativeminip2p opens authenticated QUIC and TCP connections from Rust and React
Native. On no_std + alloc, TCP runs through a pluggable provider and
Endpoint::portable. The Rust Endpoint is synchronous and caller-driven —
no async runtime. The React Native SDK owns the native driver and presents
typed events, cancellable Promises, and Stream handles to JavaScript.
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(())
}import {
Minip2p,
generateSecretKey,
} from "@minip2p/react-native";
const endpoint = Minip2p.create({
secretKey: generateSecretKey(),
});
console.log(endpoint.peerId(), endpoint.listenAddrs());
endpoint.close();Optional capabilities add custom streams, NAT traversal, pubsub, signed peer discovery, and local-link mDNS.
Get started
learn by doing
Install for Rust
Add minip2p-rs and choose the network features your endpoint needs.
Connect two peers
Connect two Rust processes and measure a Ping RTT.
Start with React Native
Own an endpoint with a hook, connect, and Ping from a native app.
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 or zero-configuration local-link mDNS.
Embedded devices
Portable TCP over smoltcp — you own I/O, time, and entropy.
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 before the first stable release. |
| QUIC and TCP | The dial address picks the transport. WebSocket and WebTransport are out of scope. |
| no_std + alloc | Protocols, orchestration, and TCP work without an OS; you supply I/O, time, and entropy. |
| QUIC-only punching | DCUtR hole punching needs QUIC; a TCP-only peer reaches NATed peers through a relay. |
| Rust 1.91+ | Workspace MSRV. |
| Caller-driven Rust | Rust applications drive progress; the React Native adapter owns its native driver. |
| Relay client | Bring a Circuit Relay v2 server when a relayed path is required. |