libp2p is a modular system of protocols, specifications, and libraries for building peer-to-peer applications. Its components cover transport, identity, security, peer discovery, peer routing, content discovery, and messaging. section 11.2 section 11.5
A libp2p node combines several networking responsibilities:
- Transport sends and receives data between peer nodes. section 11.2
- Identity derives a stable, verifiable peer ID from a public-key identity. section 11.2 section 11.2.1
- Security authenticates messages and upgrades connections to encrypted channels. section 11.2
- Peer discovery finds reachable peers, while peer routing, content discovery, and messaging support communication and information exchange. section 11.2
The component diagram provides a compact map of libp2p’s modular architecture. section 11.2
Rust peer discovery with mDNS
A Rust node generates an Ed25519 key pair, derives a PeerId, creates a development transport and mDNS behaviour, then runs a Swarm listening on a local multiaddress. Multiple nodes discover one another automatically with cargo run --bin iter4. section 11.2.1 section 11.4 section 11.5
A peer ID identifies a node, while a multiaddress describes its network location over TCP, websockets, QUIC, or another protocol. This separates stable identity from changing reachability. section 11.2.1 section 11.5
