Skip to main content

P2P | Bitcoin Glossary | Mapping Bitcoin

P2P

Protocolo

Also known as: peer-to-peer

Peer-to-peer, a network architecture where participants communicate directly with each other without a central server. Bitcoin's P2P network allows nodes to exchange transactions and blocks, ensuring the protocol operates without any single point of failure.

Overview

Bitcoin's peer-to-peer network is the communication backbone that connects nodes across the globe without relying on any central server or coordinator. Each node in the network is both a client and a server, capable of requesting data from peers and serving data to others. This architecture is fundamental to Bitcoin's censorship resistance and resilience.

How the P2P Network Operates

When a Bitcoin node starts, it connects to a set of peers discovered through DNS seeds or hardcoded addresses. Once connected, nodes exchange information about other peers, building a mesh topology.

Traditional Client-Server:        Bitcoin P2P Network:

    ┌────────┐                    ┌──┐   ┌──┐
    │ Server │                    │N1│───│N2│
    └───┬────┘                    └┬─┘   └─┬┘
   ┌────┼────┐                    │ ╲   ╱  │
   │    │    │                   ┌┴─┐ ╲╱ ┌─┴┐
  [C1] [C2] [C3]                │N3│──X──│N4│
                                └┬─┘ ╱╲ └─┬┘
  Single point of failure        │ ╱   ╲  │
                                ┌┴─┐   ┌─┴┐
                                │N5│───│N6│
                                └──┘   └──┘
                                No single point of failure

Key P2P Messages

Nodes communicate using a defined set of messages:

  • version/verack — Handshake to establish a connection
  • inv — Announce new transactions or blocks
  • getdata — Request specific transactions or blocks
  • tx/block — Deliver transaction or block data
  • addr — Share known peer addresses

Transaction and Block Propagation

When a user broadcasts a transaction, their node sends it to connected peers, who validate it and relay it further. This gossip protocol ensures that transactions reach miners and that new blocks propagate quickly across the network, typically reaching most nodes within seconds.

Privacy Considerations

Because P2P connections reveal the IP address of each node, privacy-conscious users often run their nodes over Tor or I2P. Bitcoin Core has built-in support for Tor, allowing nodes to participate in the network without exposing their physical location.