liveBook · Manning

Peer-to-peer network

As explained in Rust Servers, Services, and Apps

A peer-to-peer network is a distributed network in which nodes communicate and provide services directly without requiring a central coordinator.

A peer-to-peer (P2P) network is a distributed system where nodes, or peers, communicate directly to provide a shared service without a central coordinator. Each peer can request information or services and provide them to others, unlike a client/server system with dedicated servers. section 11.1 section 11.5

P2P networks can support:

  • Permissionless access, fault tolerance, and censorship resistance, supported by data and state replicated across nodes. section 11.1
  • Sharing computing resources such as storage, bandwidth, and processing power. section 11.0

Peers need to initiate connections to other nodes and accept incoming connections. Because peers may use different protocols, a network can support transports such as TCP and UDP, as well as higher-level protocols including HTTP and QUIC. section 11.1.1

A Rust libp2p node

A small node can generate a unique peer ID, represent its address with a multiaddress, exchange ping messages, and discover nearby peers using mDNS. The libp2p Swarm manages network behavior and events. section 11.5

Figure 11.1 Client/server vs. peer-to-peer computing

Compare the dedicated server in a client/server system with the direct communication between peers in a P2P system. section 11.1

How Rust Servers, Services, and Apps covers it

How deep it goes
Explains the client/server contrast, network properties, and transport needs, then demonstrates libp2p identity, ping, and peer discovery.
Examples
Uses IPFS, BitTorrent, Bitcoin, and Ethereum as examples, then demonstrates Rust libp2p ping messages and mDNS discovery.
What it assumes
Assumes familiarity with async Rust while introducing foundational peer-to-peer concepts in context.
What you can do after
Build a Rust libp2p node that identifies itself, exchanges ping messages, and discovers peers with mDNS.
How it connects
Connects peer-to-peer networking to client/server architecture, distributed systems, asynchronous programming, libp2p, and peer discovery.

Also explained in

Compare how 2 books explain peer-to-peer network →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.