Bitcoin Inventory and Block Relay: inv, getdata, headers, and Security
Bitcoin peers usually avoid sending every full object to every connection without coordination. Instead, nodes announce identifiers, request data they need, and validate what arrives. The result is a distributed relay system, not a guarantee that every node sees every transaction immediately.
Inventory announcements
The inv message can advertise identifiers for transactions or blocks. A receiver that needs an object may request it with getdata, subject to the protocol and the node's local policy. Peers may respond with the object, decline to serve it, or disconnect. An inventory announcement is only a claim that data may be available.
Headers-first synchronization
Nodes can use getheaders and headers to learn candidate block headers before downloading full blocks. Header checks establish a candidate proof-of-work chain, but headers alone do not validate transaction scripts, block contents, or the UTXO transitions. Full validation requires the necessary block data and contextual checks.
Efficient block relay
BIP152 compact blocks reduce redundant bandwidth by sending short transaction identifiers and selected transactions, allowing a receiver to reconstruct a block using transactions it already knows. Missing transactions may require additional requests. Compact relay is an efficiency technique, not a new consensus rule.
Transaction relay nuances
BIP339's wtxidrelay enables peers to announce transactions using witness transaction identifiers when negotiated. Mempool policies, feerates, ancestor limits, and peer behavior can prevent a transaction from propagating broadly even when it would be consensus-valid in a block.
Isolation and eclipse risks
If an attacker controls most of a node's view of the network, the node can receive delayed or selectively presented information. Diverse outbound connections, cautious peer management, and independent validation reduce some risks, but do not guarantee immunity. Transport encryption can protect communication contents against passive observers without proving the correctness of the peer's data.
Primary references
Bitcoin Developer Reference — P2P Network: https://developer.bitcoin.org/reference/p2p_networking.html
BIP152 — Compact Block Relay: https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki
BIP339 — WTXID-based Transaction Relay: https://github.com/bitcoin/bips/blob/master/bip-0339.mediawiki
BIP324 — Version 2 P2P Encrypted Transport Protocol: https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki
