Level 3 · Advanced
The peer-to-peer network
In short
Bitcoin nodes connect directly to each other, with no central server, and pass along new transactions and blocks. Each node checks everything it receives before relaying it, so invalid data stops at the first honest node.
06The peer-to-peer networkGossip, compact blocks, encrypted transport and eclipse resistance.7 min
- Nodes announce new data with
invmessages and fetch it withgetdata. Transactions are relayed with randomised delays to make tracing the origin harder. - Compact block relay (BIP 152) sends short transaction IDs, since peers usually already have the transactions in their mempools, so blocks propagate quickly.
- BIP 324 adds encrypted peer-to-peer transport. Bitcoin Core can also run over Tor and I2P.
- Eclipse attacks try to surround a node with attacker peers. Defences include many outbound connections, diverse peer selection and anchor connections kept across restarts.
- A new node syncs headers first, then downloads and validates blocks: the initial block download.
Learn Bitcoin with real people.
Find meetups and Bitcoiners in your city, and ask the questions you'd never post online. Free to download on iPhone and Android.