Lesson 5: Network & Nodes - Bitcoin's Immune System
๐ Intermediate โข โฑ๏ธ 90-120 min โข โ๏ธ 500 Quarks
The Decentralized Network That Never Sleeps
You've learned about mining securing the blockchain. But what keeps the network running? What stops governments from shutting Bitcoin down? The answer: thousands of independent nodes spread across the globe.
Bitcoin's peer-to-peer network is its immune systemโresilient, redundant, and unstoppable. No single point of failure. No CEO to arrest. No servers to seize.
In this lesson, you'll learn:
- How Bitcoin's peer-to-peer network works
- The difference between full nodes, mining nodes, and light clients
- Why running a node matters for decentralization
- How nodes validate transactions and blocks
- Network topology and the gossip protocol
- Attacks on the network and how Bitcoin defends itself
Ready to understand Bitcoin's nervous system? Let's connect! ๐
๐บ WATCH FIRST: Bitcoin's Peer-to-Peer Network
๐บ Andreas Antonopoulos: Bitcoin's Decentralized Network (15 min)
The Big Idea: Peer-to-Peer (P2P) Network
Bitcoin doesn't run on servers owned by a company. It runs on thousands of independent computers (nodes) run by volunteers, businesses, and enthusiasts worldwide.
What Makes It Peer-to-Peer?
Traditional Client-Server:
You โ Server (Facebook, Bank, etc.) โ Other Users
You โ Server (Facebook, Bank, etc.) โ Other Users
- Central point of control
- Can be shut down
- Can censor users
- Single point of failure
Bitcoin's P2P Network:
You โ Node โ Node โ Node โ Node โ Other Users
You โ Node โ Node โ Node โ Node โ Other Users
- No central authority
- Can't be shut down (would need to shut down ALL nodes)
- Can't censor (nodes are independent)
- Redundant (multiple paths for data)
Key principle: Every node is equal. No node is "special" or has more authority than others.
Types of Bitcoin Nodes
1. Full Nodes (Validators)
What they do:
- Store the entire blockchain (~600 GB as of 2024)
- Validate every transaction and every block
- Enforce Bitcoin's consensus rules
- Relay valid transactions and blocks to peers
Why they matter:
- Decentralization: More full nodes = harder to attack
- Validation: Don't trust, verify
- Privacy: Don't leak your addresses to third parties
- Voting: Full nodes enforce the rules (miners can't cheat)
Requirements:
- ~600 GB storage (SSD recommended)
- ~10 GB/month bandwidth
- Decent CPU (any modern computer works)
- 24/7 uptime preferred (but not required)
Popular software:
- Bitcoin Core: Official implementation
- Bitcoin Knots: Bitcoin Core with extra features
- btcd: Go implementation
2. Mining Nodes
What they do:
- Everything a full node does
- Plus: Attempt to mine new blocks
- Compete for block rewards
Requirements:
- Full node requirements
- Plus: ASIC mining hardware
- Cheap electricity
- Industrial-scale cooling
Note: Most miners join pools, so the pool runs the full node and miners just provide hash power.
3. Light Nodes (SPV Clients)
What they do:
- Store only block headers (~100 MB)
- Request transaction data from full nodes
- Verify transactions using Simplified Payment Verification (SPV)
Trade-offs:
- โ Much less storage (~100 MB vs ~600 GB)
- โ Faster sync time
- โ Works on mobile devices
- โ Less secure (trusts full nodes)
- โ Less privacy (reveals addresses to full nodes)
- โ Doesn't validate all rules
Popular SPV wallets:
- BlueWallet
- Electrum (connects to Electrum servers)
- BRD Wallet
4. Pruned Nodes
What they do:
- Validate the entire blockchain
- But: Delete old block data after validation
- Keep only recent blocks (~10 GB)
Trade-offs:
- โ Much less storage
- โ Still validates everything
- โ Can't serve full blockchain to new nodes
- โ Can't rescan old transactions
How Nodes Communicate: The Gossip Protocol
Bitcoin uses a gossip protocolโnodes share information with their neighbors, who share it with their neighbors, and so on.
Transaction Propagation
- You broadcast a transaction to your connected peers
- Each peer validates the transaction
- If valid, they relay it to their peers
- Process repeats until all nodes have it
- Miners include it in a block
Speed: A transaction reaches 95% of the network in ~3 seconds.
Block Propagation
- Miner finds a valid block
- Broadcasts to connected peers
- Peers validate the block
- If valid, relay to their peers
- Process repeats until all nodes have it
Speed: A block reaches 95% of the network in ~6 seconds.
Compact Block Relay
To speed up propagation, Bitcoin uses compact blocks:
- Instead of sending full block (1-2 MB)
- Send only block header + transaction IDs
- Nodes already have most transactions in mempool
- Saves ~95% bandwidth
๐ฐ DOWN THE RABBIT HOLE: The Great Firewall of China
Problem: China hosts ~65% of Bitcoin's mining power, but the Great Firewall slows down block propagation.
Impact:
- Chinese miners receive blocks slower
- More orphaned blocks (wasted work)
- Incentive to mine empty blocks (faster propagation)
Solutions:
- Fiber Network: High-speed relay network for blocks
- Compact Blocks: Reduce block size by 95%
- Mining pools outside China: Diversify geography
Why it matters: Network latency affects mining profitability and centralization. Faster block relay = more decentralized mining.
Node Discovery: Finding Peers
When you start a Bitcoin node, how does it find other nodes?
1. DNS Seeds
Hardcoded DNS servers that return IP addresses of active nodes:
seed.bitcoin.sipa.be
dnsseed.bluematt.me
seed.bitcoinstats.com
seed.bitcoin.sipa.be
dnsseed.bluematt.me
seed.bitcoinstats.com
2
3
2. Hardcoded Seed Nodes
Bitcoin Core includes a list of known stable nodes as backup.
3. Peer Exchange
Once connected, nodes share lists of other nodes they know about.
4. Manual Connection
You can manually specify nodes to connect to:
bitcoin-cli addnode "192.168.1.100:8333" "add"
bitcoin-cli addnode "192.168.1.100:8333" "add"
Typical node: Maintains 8 outbound and up to 125 inbound connections.
What Nodes Validate
Full nodes enforce Bitcoin's consensus rules. They reject:
Transaction Validation
โ Invalid signatures: Transaction not signed by private key owner โ Double-spends: Trying to spend same UTXO twice โ Insufficient funds: Outputs exceed inputs โ Invalid scripts: Malformed locking/unlocking scripts โ Non-standard transactions: Unusual transaction types
Block Validation
โ Invalid proof-of-work: Hash doesn't meet difficulty target โ Invalid block reward: Miner claims too much โ Invalid transactions: Block contains invalid transactions โ Wrong previous hash: Doesn't link to previous block โ Timestamp issues: Block timestamp too far in future/past โ Size limits: Block exceeds maximum size
Key point: Miners propose blocks, but nodes decide if they're valid. Miners can't force invalid blocks onto the network.
Why Running a Node Matters
1. Trustless Verification
"Don't trust, verify."
- SPV wallets trust full nodes
- Full nodes verify everything themselves
- Only way to be 100% sure rules are followed
2. Privacy
- SPV wallets reveal addresses to servers
- Full nodes don't leak information
- Connect your wallet to your own node = maximum privacy
3. Decentralization
More nodes = harder to attack:
- Can't shut down Bitcoin (would need to shut down all nodes)
- Can't censor transactions (nodes relay everything valid)
- Can't change rules (nodes reject invalid blocks)
4. Voting Power
Nodes enforce consensus rules:
- Miners propose blocks
- Nodes accept or reject them
- If miners try to cheat, nodes reject their blocks
Example: In 2017, miners wanted to increase block size. Nodes rejected it. Miners lost. This is user-activated soft fork (UASF).
๐ฐ DOWN THE RABBIT HOLE: The Blocksize War (2015-2017)
The conflict: Should Bitcoin increase block size from 1 MB to 2 MB (or more)?
Big blockers (miners, businesses):
- Larger blocks = more transactions
- Lower fees
- Better for payments
Small blockers (developers, node operators):
- Larger blocks = fewer people can run nodes
- Centralization risk
- Use Layer 2 (Lightning) for scaling
What happened:
- 2015: Debate begins
- 2017: Miners signal support for SegWit2x (2 MB blocks)
- Aug 2017: Bitcoin Cash forks off (8 MB blocks)
- Nov 2017: SegWit2x cancelled (nodes threatened to reject)
Result: Nodes won. Bitcoin kept 1 MB blocks (with SegWit optimization). Proved that users, not miners, control Bitcoin.
Lesson: Running a node gives you a vote in Bitcoin's future.
Network Topology
Bitcoin's network is a random mesh topology:
- No central hub
- Nodes connect to random peers
- Multiple paths between any two nodes
- Highly redundant
Benefits:
- Resilient: Losing nodes doesn't partition network
- Censorship-resistant: Can't block specific nodes
- Attack-resistant: No single point of failure
Drawbacks:
- Slower propagation: Information takes multiple hops
- Bandwidth overhead: Same data transmitted multiple times
Attacks on the Network
1. Sybil Attack
Attack: Create thousands of fake nodes to surround a target
Goal: Isolate victim, feed them false information
Defense:
- Nodes connect to diverse IP ranges
- Proof-of-work makes fake blocks expensive
- Outbound connections prevent complete isolation
2. Eclipse Attack
Attack: Control all of a node's connections
Goal: Feed victim a fake blockchain
Defense:
- Nodes remember previous peers
- Anchor connections to long-lived peers
- Diverse IP ranges
3. Denial of Service (DoS)
Attack: Flood nodes with junk data
Goal: Crash nodes or slow down network
Defense:
- Rate limiting
- Ban misbehaving peers
- Proof-of-work for certain messages
4. Partition Attack
Attack: Split network into isolated segments
Goal: Create two different blockchains
Defense:
- Highly connected mesh topology
- Nodes from different geographic regions
- Satellite and mesh network backups
Running Your Own Node
Why You Should
- Support the network: More nodes = more decentralization
- Verify transactions: Don't trust, verify
- Privacy: Don't leak addresses to third parties
- Learn: Best way to understand Bitcoin
Hardware Options
Budget Option (~$200):
- Raspberry Pi 4 (8 GB RAM)
- 1 TB SSD
- Power supply + case
- Software: Umbrel, RaspiBlitz, myNode
Mid-Range (~$500):
- Intel NUC or similar mini PC
- 1 TB NVMe SSD
- 16 GB RAM
- Software: Bitcoin Core + Electrum Server
High-End (~$1000+):
- Dedicated server
- 2 TB+ SSD
- 32 GB RAM
- Software: Bitcoin Core + Lightning + BTCPay Server
Software Setup
Easy Mode (plug-and-play):
- Umbrel: Beautiful UI, one-click apps
- RaspiBlitz: Feature-rich, Lightning-focused
- myNode: Premium features, community edition free
Advanced Mode (manual setup):
- Install Bitcoin Core
- Configure
bitcoin.conf - Sync blockchain (~1-7 days)
- Open port 8333 (optional, for inbound connections)
- Connect your wallet
The Future of Bitcoin's Network
Satellite Nodes
Blockstream Satellite: Broadcasts Bitcoin blockchain via satellite
- Receive blocks without internet
- Censorship-resistant
- Covers most of the world
Mesh Networks
goTenna, LoRa: Transmit Bitcoin transactions via radio
- Works without internet
- Useful in disaster scenarios
- Community-run infrastructure
Tor and I2P
Privacy networks: Hide your node's IP address
- Censorship-resistant
- Privacy-preserving
- ~30% of nodes use Tor
Key Takeaways
- Peer-to-peer network: No central servers, all nodes equal
- Full nodes: Validate everything, enforce rules
- Gossip protocol: Information spreads quickly through network
- Node diversity: More nodes = more decentralization
- Nodes > Miners: Nodes decide rules, miners just propose blocks
- Running a node: Supports network, verifies transactions, preserves privacy
- Network resilience: Highly redundant, censorship-resistant
๐ฏ Test Your Knowledge
โ ๏ธ ONE SHOT ONLY - STUDY UP!
You can only earn Quarks once per lesson. Take your time reviewing the material above before starting. You can retake the quiz as many times as needed, but Quarks are only awarded on your first perfect score!
โ Previous: Mining & Proof-of-Work | Next Lesson: Bitcoin L2 & Economics โ