Chapter 8 Exercises: Bitcoin Network: Nodes, Propagation, and the Peer-to-Peer Architecture

Conceptual Questions

Exercise 8.1 — Node Type Comparison

Compare and contrast the following node types along the dimensions of (a) data stored, (b) validation performed, (c) trust assumptions, (d) resource requirements, and (e) contribution to network health: - Full archival node - Pruned full node - SPV / light node - Mining node

Present your answer as a table with these five dimensions as rows and the four node types as columns. For each cell, provide a concise but specific description (not just "high/medium/low").

Exercise 8.2 — The Gossip Protocol

A Bitcoin node has 8 outbound connections. When it receives a new valid transaction, it announces the transaction hash to all 8 peers. Each of those peers, in turn, announces to their own 8 outbound peers (minus the node that sent it to them, so effectively 7 new peers each).

(a) Assuming no overlap in peer connections, how many nodes have learned about the transaction after 1, 2, and 3 rounds of gossip?

(b) In reality, why does the calculation in (a) vastly overestimate the propagation speed? Identify at least three factors that slow propagation compared to this idealized model.

(c) Despite these factors, why does Bitcoin's gossip protocol still work well enough for a system targeting 10-minute block intervals?

Exercise 8.3 — Fee Market Analysis

Suppose the Bitcoin mempool currently contains the following transactions (simplified):

Transaction Size (vB) Fee (sats) Fee Rate (sat/vB)
A 250 5,000 20.0
B 500 7,500 15.0
C 140 4,200 30.0
D 300 3,000 10.0
E 200 8,000 40.0
F 180 1,800 10.0
G 350 14,000 40.0
H 400 2,000 5.0

(a) A miner is constructing a block with a maximum capacity of 1,000 vB (artificially small for this exercise). Which transactions should the miner include to maximize fee revenue? What is the total fee collected?

(b) Now suppose Transaction B is a child of Transaction D (B spends an output of D). D is unconfirmed. Recalculate the optimal block given this dependency. Does the miner's revenue change?

(c) Transaction H's sender wants to use CPFP to get H confirmed. They create Transaction I, spending an output of H, with a size of 150 vB. What minimum fee must Transaction I pay so that the combined ancestor fee rate of the (H, I) package exceeds 20 sat/vB?

Exercise 8.4 — SPV Security Analysis

Alice runs an SPV wallet on her phone. She receives a payment of 2 BTC from Bob, and her wallet shows the transaction has 1 confirmation.

(a) What exactly has Alice's wallet verified? List the specific cryptographic checks performed.

(b) What has Alice's wallet not verified? List at least four properties that a full node would check but an SPV node does not.

(c) Under what conditions could Alice be deceived by a fake transaction with 1 confirmation? How realistic are these conditions?

(d) If Alice waited for 6 confirmations instead of 1, how does this change the cost of deceiving her? Be specific about the resources an attacker would need.

Exercise 8.5 — Censorship Resistance Scenarios

For each of the following censorship scenarios, explain (a) how the censorship would be implemented, (b) what defenses exist, and (c) how effective the censorship would be:

  1. A national government blocks TCP port 8333 at all ISPs in the country.
  2. A mining pool controlling 40% of hash power refuses to include transactions from a specific Bitcoin address.
  3. An attacker with 10,000 nodes attempts to Eclipse-attack a specific Bitcoin merchant.
  4. OFAC adds a new Bitcoin address to its sanctions list, and all U.S.-based mining pools (controlling 35% of global hash power) comply by excluding transactions involving that address.

Technical Exercises

Exercise 8.6 — Merkle Proof Verification

Given a block with 8 transactions (T0 through T7), construct the full Merkle tree. Then:

(a) Write the Merkle proof needed to verify T5. Which hashes must be included?

(b) How many hashes are in the proof? How does this compare to the total number of transactions?

(c) If the block had 1,024 transactions, how many hashes would be in the proof? Express this as a function of n (number of transactions).

(d) Why is this logarithmic scaling crucial for SPV to be practical?

Exercise 8.7 — Propagation Simulation

Using the companion code file network_topology.py, or writing your own simulation:

(a) Create a network of 100 nodes with random connections (each node connected to 8 random peers). Simulate the propagation of a single message using the gossip protocol. Measure how many rounds it takes for the message to reach all nodes.

(b) Repeat the simulation 1,000 times and plot the distribution of propagation times (measured in rounds).

(c) Now simulate the same network but remove the 5 most connected nodes (simulating a targeted attack). How does propagation time change?

(d) Add 20 nodes that are connected only to each other (a "clique"). How does this affect propagation to and from the clique?

Exercise 8.8 — Mempool Analysis

Using the companion code file mempool_analyzer.py (or a public API like mempool.space), analyze the current Bitcoin mempool:

(a) What is the current mempool size (in MB and number of transactions)?

(b) Plot the fee rate distribution of transactions currently in the mempool. What is the median fee rate? What fee rate would guarantee inclusion in the next block?

(c) Based on the current mempool, estimate the total fees a miner would earn from the next block (assuming they select optimally).

(d) Check the mempool at three different times of day. Do you observe the diurnal patterns described in Section 8.5? What time zone effects are visible?

Exercise 8.9 — RBF and CPFP Calculations

A user broadcasts a transaction with the following properties: - Size: 225 vB - Fee: 450 sats (fee rate: 2 sat/vB) - The transaction has one output paying 0.01 BTC to a recipient and one change output of 0.005 BTC

The current mempool minimum fee for next-block inclusion is 15 sat/vB.

(a) Calculate the fee the user needs to pay for next-block inclusion at 15 sat/vB. How much more than the original fee is this?

(b) If the user wants to RBF the transaction to achieve 15 sat/vB, what must the new fee be? (Remember, the replacement must also pay for its own relay cost.)

(c) If instead the recipient uses CPFP by spending their 0.01 BTC output in a new transaction of 150 vB, what fee must the child transaction pay so that the ancestor fee rate of the (parent, child) package is at least 15 sat/vB?

(d) In scenario (c), who pays the effective fee bump — the sender or the recipient? Why might this matter in a commercial context?

Applied Exercises

Exercise 8.10 — Running Your Own Node

Follow the practical guide in Section 8.9 to set up a Bitcoin Core node on testnet.

(a) Record the time it takes for initial block download (IBD) to complete. What was your hardware (CPU, RAM, disk type, internet speed)?

(b) After sync, run getpeerinfo and analyze your connections. How many peers do you have? Are any over Tor? How many unique /16 ranges are represented?

(c) Use a testnet faucet to send yourself some testnet BTC. Monitor the transaction through the mempool using getmempoolentry <txid> and then observe it being confirmed. Record the timestamps at each stage.

(d) Use getblock with verbosity 2 to examine a recent block. How many transactions does it contain? What is the range of fee rates? Does the block appear to be using optimal fee-rate selection?

Exercise 8.11 — Node Economics

The Bitcoin network relies on volunteers running full nodes (miners are compensated, but non-mining full nodes are not). Analyze the economics of running a full node:

(a) Estimate the monthly cost of running a Bitcoin full node on a cloud provider (compute, storage, bandwidth). Compare with running it on home hardware (Raspberry Pi + SSD, or a dedicated mini-PC).

(b) Who benefits from running a full node? List the different stakeholders and their incentives.

(c) Some proposals (like Utreexo) aim to reduce the storage requirements for full nodes. Research Utreexo and explain how it works in 2-3 paragraphs. What tradeoffs does it introduce?

(d) Discuss: Is Bitcoin's reliance on volunteer full nodes a vulnerability? What would happen if the full node count dropped to 1,000? To 100?

Exercise 8.12 — Network Partition Analysis

Suppose a catastrophic event (a major undersea cable cut, or a government firewall deployment) splits the Bitcoin network into two partitions of roughly equal hash power for 24 hours.

(a) What happens to block production in each partition during the 24 hours? How many blocks would each partition produce?

(b) When the partitions reconnect, what happens? Which chain "wins"? What happens to transactions that were confirmed in the losing chain?

(c) How would this event affect users who received payments during the partition? What if they already shipped goods based on a 6-confirmation payment that was in the losing chain?

(d) Has anything similar to this ever happened in Bitcoin's history? Research the March 2013 chain fork and describe what caused it and how it was resolved.

Critical Thinking

Exercise 8.13 — The Full Node Imperative

The Bitcoin community often emphasizes the importance of running your own full node with the phrase "not your node, not your rules." Critically evaluate this claim:

(a) What specific security properties does running a full node provide that using an SPV wallet does not?

(b) Is it realistic to expect all Bitcoin users to run full nodes? What fraction of users currently run full nodes (estimate based on node count vs. estimated user base)?

(c) If 99% of users use SPV wallets and only 1% run full nodes, does Bitcoin's security model still hold? Under what conditions might it break?

(d) Compare Bitcoin's "everyone should run a node" ethos with the design philosophy of other systems (e.g., Ethereum's plan for light clients, Solana's high hardware requirements). What are the tradeoffs?

Exercise 8.14 — Fee Market Ethics

Bitcoin's fee market means that users who can pay higher fees get faster confirmations, while those with smaller budgets must wait. Consider:

(a) Is this "pay-to-play" model fair? Compare it to other systems with tiered service (airline classes, express shipping, toll roads).

(b) During the 2023 fee spikes, some users reported that the fees for a single transaction exceeded the value being transferred. What are the implications for Bitcoin's use case as "money for the unbanked"?

(c) Proposals like the Lightning Network aim to move small transactions off-chain, reserving the main blockchain for larger settlements. Does this solve the fairness problem or merely relocate it?

(d) Should miners be obligated to include some minimum number of low-fee transactions in each block? What would be the consequences of implementing such a rule?