Seyed Masoud Hosseini · Overview · Study log · Ideas · Transcript · RSS feed
Bitcoin & Cryptocurrency Technologies · Lecture 5 of 12 · 1:28:15
Lecture 5: Bitcoin Mining
Study guide
What this lecture covers
This lecture answers a basic question left open in earlier lectures: who are Bitcoin miners, and what do they actually do to earn block rewards? Coming after lectures on Bitcoin's data structures and mechanics, it walks through the mining process itself, the hardware history that turned mining into an industrial business, the energy debate that mining has triggered, the economics of mining pools, and the strategic choices miners can make beyond simply following the rules.
After watching, you should be able to explain what a miner does to find a valid block, why mining hardware evolved from CPUs to ASICs, how to reason about Bitcoin's energy consumption, why small miners join pools, and what a majority-hash-power miner could attempt if it wanted to cheat the system.
Key ideas
- Nonce search: mining means repeatedly hashing a block header with different nonce values (and an extra nonce in the coinbase transaction) until the SHA-256 hash falls below a target with enough leading zeros.
- Difficulty adjustment: every 2,016 blocks (about two weeks), the network resets the difficulty target so that blocks continue to be found roughly every 10 minutes on average.
- Hardware evolution: mining moved from general-purpose CPUs to GPUs, then FPGAs, then ASICs, each generation trading flexibility for raw hashing speed at lower cost per hash.
- Energy consumption: since SHA-256 is a non-reversible computation, Landauer's principle guarantees mining must use some energy; estimates put the whole network's draw somewhere between about 100 megawatts and under a gigawatt at the time of the lecture.
- Mining pools: pools let small miners combine hash power and get paid based on
shares(near-valid blocks) they submit, trading away some upside for steady income and lower variance. - Pay-per-share vs proportional payout: pay-per-share gives miners a guaranteed rate per share; proportional payout ties rewards to the pool actually finding blocks, which better aligns miner incentives.
- Forking attacks: a miner controlling more than half the network's hash power can, in principle, rewrite recent history and double-spend a payment by building a longer alternate chain.
- Selfish mining: withholding found blocks and releasing them strategically can be profitable for a miner with less than half the network's hash power, which contradicts the assumption that following the default protocol is always optimal.
Walkthrough
The task of Bitcoin miners (0:15)
The lecture opens by comparing Bitcoin mining to historical gold rushes, then lays out the six steps a miner follows: join the network, listen for and validate transactions and blocks, assemble a candidate block, search for a valid nonce, and hope the network accepts the resulting block. It explains why the nonce search is hard: miners try every value of a 32-bit nonce and, when that's exhausted, increment an extra nonce in the coinbase transaction, which forces the whole Merkle tree to be rebuilt. The difficulty target is described as roughly 2^66, adjusted every two weeks based on how fast the previous batch of blocks was found, to keep the average block interval near 10 minutes.
Mining hardware (10:17)
This section traces the hardware arms race. SHA-256, standardized in 2001, is described at a high level as a 32-bit-word-oriented function run over 80 rounds, computed twice per hash attempt in Bitcoin. CPU mining is shown to be hopeless at current difficulty (over 100,000 years to find a block). GPUs offered roughly a 10x speedup through parallelism but wasted most of their graphics-oriented hardware. FPGAs, programmed in Verilog, improved efficiency further but were hard to source and program. ASICs, chips built solely to mine Bitcoin, now dominate; the lecture uses a $6,000 ASIC as a case study, noting it would still take about 14 months to find a block, and that most profit in a rig's life comes in its first weeks before newer hardware makes it obsolete.
Energy consumption and ecology (33:38)
The lecture grounds energy use in Landauer's principle: irreversible computations like SHA-256 must consume a minimum amount of energy. It presents two estimation approaches: a top-down approach (converting the roughly $25/second in block rewards into equivalent electricity spend, about 900 megawatts) and a bottom-up approach (multiplying total network hash rate by the efficiency of good mining hardware, about 150 megawatts). It compares this to large power plants, discusses the "data furnace" idea of using mining rigs as heaters, and raises open questions about electricity subsidies and whether Bitcoin mining's energy use is any more "wasted" than the energy traditional payment systems consume.
Mining pools (50:16)
Because finding a block is a random, high-variance process (illustrated with a Poisson distribution showing over a 40% chance of finding zero blocks in a year with a modest rig), small miners face a lot of risk. Mining pools solve this the way mutual insurance solves risk for individual farmers: participants prove work via near-valid "shares," and a pool manager distributes revenue accordingly. The lecture compares pay-per-share, proportional, and balance-threshold payout models, and notes that pools introduce centralization risk, illustrated by the pool GHash.io briefly exceeding 50% of network hash power in 2014.
Mining incentives and strategies (1:04:29)
The final section covers what miners could do besides follow the default protocol. It introduces the forking (double-spend) attack possible with more than half the hash power, the idea of bribing other miners rather than acquiring hash power directly, checkpointing as a practical defense against deep forks, and selfish mining, where withholding blocks can be profitable even below 50% hash power if the miner can win block-announcement races. It also covers feather forking, a strategy for blacklisting transactions from a given address without needing majority hash power, and closes by noting that transaction fees will eventually replace the shrinking block subsidy as miners' main revenue source.
Before you watch
- Review the earlier lecture on Bitcoin's block and transaction data structures (blockchain, Merkle trees, coinbase transactions), since this lecture builds directly on the concept of a block header and its nonce field.
- Some familiarity with the idea of a cryptographic hash function and proof-of-work from prior lectures in the course will make the difficulty and nonce discussion easier to follow.
Check your understanding
- Why does changing the extra nonce in the coinbase transaction require far more recomputation than changing the nonce in the block header?
- How does the Bitcoin network keep the average block interval close to 10 minutes as total hash power changes over time?
- Why do the two energy-estimation approaches (top-down and bottom-up) give different results, and what does each ignore?
- What risk does a small individual miner accept by not joining a mining pool, and how does a pool reduce that risk?
- Under what condition does selfish mining become profitable even without a majority of network hash power?
Chapters
- 0:00 <Untitled Chapter 1>
- 0:15 The task of Bitcoin miners
- 10:17 Mining hardware
- 33:38 Energy consumption & ecology
- 50:16 Mining pools
- 1:04:29 Mining incentives and strategies
From the YouTube description
Fifth lecture of the Bitcoin and cryptocurrency technologies online course.
For the accompanying textbook, including the free draft version, see: http://bitcoinbook.cs.princeton.edu/
In this lecture (click the time to jump to the section):
* The task of Bitcoin miners 0:15
* Mining hardware 10:17
* Energy consumption & ecology 33:38
* Mining pools 50:16
* Mining incentives and strategies 1:04:29
← Lecture 4: How to Store and Use Bitcoins · Lecture 6: Bitcoin and Anonymity →
