MSTR Cat

Blockchain/Level III · The network/3.1 Nodes/Lesson 2

Peer-to-peer gossip

The gossip protocol: how nodes find peers and spread data without a center

MaterialsA running Bitcoin Core nodeTerminal access with ‘bitcoin-cli’A text editor for logging peer information

Wonder

  1. How does a new node on an empty network find its first peer?
  2. How does a new block reach thousands of nodes within seconds without anyone coordinating it?
  3. What prevents an attacker from isolating a node from the rest of the network?

Explore

  1. Bitcoin operates as a decentralized peer-to-peer network where each full node maintains independent state. To join, a new node must establish TCP connections to existing peers. Mainnet uses port 8333 for these connections. Initial discovery relies on DNS seeds, run by long-standing community members and listed in the software, plus hard-coded fallback addresses. Once connected, a node can ask for addresses with ‘getaddr’ and receives them in ‘addr’ messages, allowing it to learn about other active participants and expand their peer set dynamically.
  2. Bitcoin Core manages a specific topology: 8 outbound full-relay connections for transaction and block propagation, plus 2 block-relay-only connections to reduce bandwidth usage. It allows up to 125 connections in total, inbound and outbound. This structure ensures redundancy; if one peer disconnects or becomes unresponsive, the node maintains connectivity through others. Block-relay-only connections carry no transactions or addresses, which makes it harder for an observer to map the network’s topology.
  3. Data propagation follows an announcement mechanism. When a node receives a new transaction, it announces it with an ‘inv’ (inventory) message containing the hash but not the data; new blocks are now usually announced by sending the header or a compact block directly. Peers receiving this announcement recognize they lack the object and send a ‘getdata’ request. The original holder then transmits the full payload. This two-step process prevents flooding the network with redundant large payloads before peers confirm their interest, ensuring efficient bandwidth usage across the distributed system.
  4. Compact blocks (BIP152), introduced in 2016, optimize this further. Since most transactions in a block are already known to peers via mempool propagation, sending the full block is wasteful. Instead, a node sends the block header plus short identifiers (6 bytes each) for its transactions, along with the coinbase; the receiver rebuilds the block from its own mempool and requests only the few transactions it lacks. This significantly reduces latency in block propagation, allowing the network to reach consensus faster even with high transaction volumes.
  5. Eclipse attacks demonstrate the fragility of peer diversity. Heilman et al. (2015) showed that an attacker who takes over all of a node’s connections can isolate it from the honest network, feeding it a false view of the chain. Bitcoin Core adopted their countermeasures from version 0.10.1, including feeler connections and more careful address-table eviction, and later added anchor connections that persist across restarts. Running only over Tor can make a node easier, not harder, to eclipse.
  6. Verify your node’s connectivity by running ‘bitcoin-cli getpeerinfo’ in a terminal connected to a local Bitcoin Core instance. The output lists each peer’s address, its ‘connection_type’ (for example outbound-full-relay or block-relay-only), its software version and how far it has synced (‘synced_headers’, ‘synced_blocks’). A healthy node shows about ten outbound connections: eight full-relay and two block-relay-only.

Key facts

  • Bitcoin mainnet uses TCP port 8333 for peer-to-peer communication.
  • New nodes bootstrap using DNS seeds and hard-coded addresses before learning peers via gossip.
  • Bitcoin Core defaults to 8 outbound full-relay connections, 2 block-relay-only connections, and a maximum of 125 total connections.
  • The ‘inv’ message announces data hashes; ‘getdata’ requests the actual payload from the peer holding it.
  • Compact blocks (BIP152) allow peers to rebuild blocks from local mempools, reducing wire traffic.
  • Eclipse attacks try to capture all of a node’s connections; Bitcoin Core has added several countermeasures since 2015.

Exercise nine, six, three, one

9CollectList 9 distinct components of the Bitcoin P2P bootstrap and propagation process (e.g., DNS seeds, ‘inv’ messages).
6ClusterGroup these 9 components into 6 categories based on their function: discovery, connection management, data announcement, data retrieval, optimization, or security.
3DistillReduce the 6 groups to 3 core principles that govern efficient and secure network propagation.
1CrystallizeWrite one sentence explaining why a node must maintain diverse outbound connections to resist eclipse attacks.

Fact check

Dates, figures and claims checked against the published sources listed below.

Open in the interactive academy →

PT ES ZH JA KO RU DE FR MS