Exercises: Mining and Proof of Work

Conceptual Exercises

Exercise 7.1 — The Mining Puzzle (Bloom: Understand)

Explain in your own words why Bitcoin uses a brute-force search (trying random nonces) rather than solving a mathematical equation to create new blocks. What property of SHA-256 makes a more efficient approach impossible?

Exercise 7.2 — Double Hashing (Bloom: Understand)

Bitcoin uses SHA-256 applied twice (SHA-256d) rather than once. Describe the length extension attack that this defends against. Under what circumstances would a single application of SHA-256 be vulnerable?

Exercise 7.3 — Sybil Resistance (Bloom: Analyze)

A student proposes the following alternative to Proof of Work: "Instead of mining, just let every node on the network vote on which transactions to include. Majority wins." Explain why this approach fails in a permissionless (open-membership) network. What specific attack does it enable?

Exercise 7.4 — Difficulty Adjustment Rationale (Bloom: Analyze)

Explain why the difficulty adjustment is clamped to a maximum factor of 4 in either direction. What could happen without this constraint if 75% of the network's hashrate suddenly went offline?

Exercise 7.5 — The Off-by-One (Bloom: Understand)

Bitcoin's difficulty adjustment calculates the time elapsed for 2,016 blocks using the timestamps of block N and block N-2016, measuring 2,015 intervals rather than 2,016. Calculate the cumulative effect of this bug over Bitcoin's first 800,000 blocks. How many "extra" blocks were produced compared to the nominal 10-minute schedule?


Calculation Exercises

Exercise 7.6 — Probability of Finding a Block (Bloom: Apply)

At a network difficulty of 80 trillion: 1. Calculate the target value (in terms of leading zero bits, approximately). 2. Calculate the probability that a single SHA-256d hash attempt produces a valid block. 3. If a miner has a hashrate of 200 TH/s, how long on average will it take to find a block? 4. What is the probability that this miner finds at least one block in a 24-hour period?

Exercise 7.7 — Mining Revenue (Bloom: Apply)

A mining operation runs 500 Antminer S21 units, each rated at 200 TH/s and consuming 3,500 watts. The electricity price is $0.06/kWh. The network hashrate is 700 EH/s, the block reward is 3.125 BTC, average transaction fees are 0.4 BTC per block, and the BTC price is $85,000.

  1. Calculate the operation's total hashrate.
  2. Calculate the expected number of blocks found per day.
  3. Calculate daily revenue in USD.
  4. Calculate daily electricity cost.
  5. Calculate daily profit (before hardware amortization).
  6. If each ASIC costs $5,000 and has a 3-year operational lifespan, what is the daily hardware amortization cost? What is the net daily profit?

Exercise 7.8 — Breakeven Electricity Price (Bloom: Apply)

Using the parameters from Exercise 7.7 (but varying the electricity price): 1. Derive the formula for the breakeven electricity price. 2. Calculate the breakeven price per kWh (ignoring hardware costs). 3. Calculate the breakeven price per kWh including hardware amortization. 4. How does the breakeven price change if BTC price drops to $50,000?

Exercise 7.9 — Halving Impact (Bloom: Analyze)

After the fifth halving (block reward drops from 3.125 to 1.5625 BTC), assuming BTC price and network hashrate remain constant: 1. Calculate the new daily revenue per TH/s. 2. Calculate the new breakeven electricity price for a miner running S21-class hardware (15 J/TH). 3. What percentage of current miners would become unprofitable if the average electricity cost is $0.07/kWh? (Hint: you need to compare the new breakeven to the distribution of electricity costs.) 4. What would need to happen to transaction fees or BTC price to maintain current mining profitability levels?

Exercise 7.10 — Difficulty Adjustment Simulation (Bloom: Apply)

The current difficulty is 100 trillion. In the most recent 2,016-block period, the elapsed time was 12 days instead of the expected 14 days. 1. Calculate the new difficulty after adjustment. 2. What does this adjustment imply about hashrate changes during the period? 3. If in the next period the hashrate remains at the new higher level, what would you expect the elapsed time to be? 4. After three consecutive adjustment periods at this hashrate, what would the difficulty be?


Analysis Exercises

Exercise 7.11 — Pool Centralization (Bloom: Evaluate)

As of 2026, Foundry USA controls approximately 30% of Bitcoin's hashrate. Analyze the following scenarios: 1. What specific actions could Foundry take with 30% hashrate that it could not take with 10%? 2. If Foundry merged with the next-largest pool to control 48% of hashrate, what attacks would become feasible? What would remain infeasible? 3. Evaluate the argument that "pool operators don't own the hashrate, so pool concentration doesn't matter." Under what conditions does this argument hold? Under what conditions does it fail?

Exercise 7.12 — 51% Attack Cost-Benefit (Bloom: Evaluate)

An attacker wants to double-spend $100 million in Bitcoin against major exchanges. 1. Estimate the cost of acquiring sufficient hashrate (consider both purchasing ASICs and renting hash power). 2. How many confirmations would exchanges likely require for a $100 million deposit? 3. Calculate how long the attacker would need to maintain majority hashrate to execute the attack. 4. Evaluate whether the attack is economically rational, considering that the attack would likely crash BTC price (reducing the value of the attacker's remaining holdings and hardware).

Exercise 7.13 — Selfish Mining Threshold (Bloom: Analyze)

In the Eyal-Sirer selfish mining model, the profitability threshold depends on the parameter gamma (the proportion of honest nodes that mine on the selfish miner's block during a tie). 1. When gamma = 0 (the selfish miner always loses ties), what is the minimum hashrate fraction for profitable selfish mining? 2. When gamma = 1 (the selfish miner always wins ties), what is the minimum hashrate fraction? 3. Explain why network connectivity gives the selfish miner an advantage (increasing gamma). 4. How does Stratum V2's decentralized block template construction affect the selfish mining dynamic?


Research and Discussion Exercises

Exercise 7.14 — Energy Debate Position Paper (Bloom: Evaluate)

Write a 500-word position paper on Bitcoin's energy consumption. You must: 1. Cite at least three specific data points from this chapter. 2. Acknowledge the strongest argument on the opposing side. 3. Address the "opportunity cost of renewables" argument specifically. 4. Conclude with a policy recommendation (e.g., carbon tax on mining, renewable mandates, no regulation, or something else).

Exercise 7.15 — Stranded Energy Investigation (Bloom: Evaluate)

Research two real companies that mine Bitcoin using stranded energy (e.g., Crusoe Energy, Great American Mining, or others). For each: 1. Describe the energy source they use. 2. Explain why this energy would otherwise be wasted. 3. Evaluate whether this model could scale to absorb a significant fraction of Bitcoin's total energy demand. 4. Identify any counterarguments to the claim that this energy is "free" from an environmental perspective.

Exercise 7.16 — Fee Transition Modeling (Bloom: Create)

Model Bitcoin's security budget over the next five halvings (through approximately 2048). Assume: - BTC price scenarios: $50K, $200K, $1M (constant in today's dollars). - Transaction fee scenarios: current levels (0.3-0.5 BTC/block), 2x current, 5x current. - Create a table or chart showing total annual miner revenue under each scenario combination. - At what combination does total miner revenue drop below $1 billion/year (a level some researchers consider the minimum for adequate security)?

Using data from blockchain.com, BTC.com pool distribution, or similar sources: 1. Chart the Herfindahl-Hirschman Index (HHI) of mining pool concentration over the past five years. 2. Is mining becoming more or less concentrated over time? 3. Identify three specific events or trends that have affected concentration. 4. Compare the current HHI to that of other industries (e.g., internet search engines, social media platforms, traditional banking).


Programming Exercises

Exercise 7.18 — Extend the Mining Simulator (Bloom: Create)

Modify code/mining_simulation.py to: 1. Track and display the distribution of nonce values that produce valid blocks (are they uniformly distributed?). 2. Simulate selfish mining: two miners (one honest, one selfish) competing over 1,000 blocks. Compare their revenue to their hashrate proportions. 3. Generate a histogram of block-finding times and compare it to the theoretical exponential distribution.

Exercise 7.19 — Difficulty Adjustment Visualizer (Bloom: Create)

Extend code/difficulty_adjustment.py to: 1. Simulate 100 difficulty adjustment periods with random hashrate fluctuations. 2. Reproduce the July 2021 scenario: a sudden 50% hashrate drop, then gradual recovery over six months. 3. Plot difficulty, hashrate, and average block time over your simulation. How many adjustment periods does it take for block times to return to 10 minutes after a 50% hashrate drop?

Exercise 7.20 — Pool Simulator (Bloom: Create)

Write a Python program that simulates a mining pool with 100 miners of varying hashrates. Implement: 1. PPS (Pay-Per-Share) and PPLNS (Pay-Per-Last-N-Shares) reward distribution. 2. Run the simulation for 10,000 blocks and compare the variance of payments under each scheme. 3. Introduce a "pool hopper" who switches between PPS and PPLNS pools to maximize revenue. Does pool hopping affect the honest miners' payouts?