Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · 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?
Vocabulary
- mining (noun)
- The process of using computing power to add new blocks to a blockchain and earn rewards.
Mining requires searching for a special number that makes a hash valid. - block header (noun)
- The summary information at the top of a block, including the data used for mining.
Miners repeatedly change the nonce in the block header while searching for a solution. - coinbase transaction (noun)
- The special first transaction in a block that pays the miner the block reward.
The coinbase transaction includes an extra nonce that can also be changed. - candidate block (noun)
- A tentative block a miner is trying to make valid before it is accepted by the network.
A miner assembles a candidate block from pending transactions. - ASIC (noun)
- A chip built to do one specific task, such as mining, extremely efficiently.
ASICs now dominate Bitcoin mining because they are far faster than general chips. - FPGA (noun)
- A programmable chip that can be configured for a specific task, faster than general software but slower than a custom chip.
FPGAs improved mining efficiency before ASICs took over. - Landauer's principle (noun)
- A physics principle stating that erasing information requires a minimum amount of energy.
Landauer's principle explains why mining must use some minimum energy. - hash rate (noun)
- The speed at which a miner or network can compute hash attempts.
Total network hash rate determines how quickly blocks are found. - mining pool (noun)
- A group of miners who combine their computing power and share the rewards.
Small miners join a mining pool to reduce the risk of earning nothing. - share (noun)
- A near-valid solution submitted to prove work was done, used to divide pool rewards fairly.
Each share a miner submits earns them a portion of the pool's reward. - variance (noun)
- How much an outcome tends to differ from the average over time.
Mining alone has high variance, so a miner might find nothing for a long time. - payout model (noun)
- The system a pool uses to decide how rewards are distributed among miners.
Pay-per-share is one common payout model used by mining pools. - fork (attack) (noun)
- Creating a competing version of the blockchain to try to rewrite recent history.
A forking attack lets a majority miner attempt to reverse a payment. - selfish mining (noun)
- A strategy of secretly withholding found blocks to gain an unfair advantage.
Selfish mining can be profitable even without majority hash power. - checkpointing (noun)
- Marking certain blocks as permanently accepted to prevent very deep chain rewrites.
Checkpointing defends against attacks that try to rewrite old history. - subsidy (noun)
- A payment given to support an activity, here the extra coins given to miners.
The mining subsidy shrinks over time as block rewards are halved. - target (mining) (noun)
- The maximum value a valid block hash is allowed to have.
A miner keeps trying nonces until the hash falls below the target. - leading zeros (phrase)
- A run of zero digits at the start of a number.
A valid hash must have enough leading zeros to count as a solved block. - arms race (phrase)
- A competition where each side keeps building stronger tools to beat the other.
The switch from CPUs to ASICs was a hardware arms race among miners. - general-purpose (adjective)
- Designed to do many different tasks, not just one.
General-purpose CPUs are far too slow for serious mining today. - obsolete (adjective)
- No longer useful because something newer and better has replaced it.
Older ASICs quickly become obsolete as faster models are released. - top-down (approach) (adjective)
- Starting from an overall total and working down to smaller details.
The top-down estimate converts total mining revenue into an energy figure. - bottom-up (approach) (adjective)
- Starting from small individual parts and adding them up to a total.
The bottom-up estimate multiplies hash rate by the energy per hash. - irreversible (adjective)
- Impossible to undo or reverse back to the original state.
SHA-256 is an irreversible computation, so it must cost energy. - Poisson distribution (noun)
- A pattern describing how often rare, random events happen in a fixed period.
A Poisson distribution shows the chance a small miner finds zero blocks in a year. - centralization risk (noun)
- The danger that too much power ends up controlled by one group.
A pool nearing 50% of hash power creates serious centralization risk. - bribe (verb)
- To pay someone to act dishonestly or against the rules.
An attacker could bribe other miners instead of buying more hardware. - blacklist (verb)
- To deliberately block or refuse a specific person or item.
Feather forking tries to blacklist transactions from one address. - in principle (phrase)
- Theoretically possible, even if it is difficult in practice.
In principle, a majority miner could rewrite recent blocks.
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 →
