Skip to content
On this page

Lesson 4: Mining & Proof-of-Work - The Engine of Bitcoin

โ›๏ธ Intermediate โ€ข โฑ๏ธ 90-120 min โ€ข โš›๏ธ 400 Quarks

The Most Misunderstood Part of Bitcoin

Everyone's heard of Bitcoin mining. But most people think it's about "creating new coins" or "solving complex math problems." Both are wrong.

Bitcoin mining is actually about security. Miners are the guardians of the network, using massive amounts of energy to make Bitcoin virtually impossible to attack. The new coins? That's just the incentive to keep them honest.

In this lesson, you'll learn:

  • What Bitcoin mining actually does (it's not what you think)
  • How Proof-of-Work creates security through energy
  • Why mining difficulty adjusts every 2 weeks
  • The halving cycle and Bitcoin's fixed supply
  • Mining pools, ASICs, and the arms race
  • Environmental concerns and the truth about Bitcoin's energy use

Ready to understand the engine that powers Bitcoin? Let's dig in! โ›๏ธ

๐Ÿ“บ WATCH FIRST: How Bitcoin Mining Actually Works

๐Ÿ“บ 3Blue1Brown: But how does bitcoin actually work? (26 min - best explanation ever)

The Big Idea: Proof-of-Work

Bitcoin's security comes from Proof-of-Work (PoW)โ€”a system where miners compete to solve a computational puzzle. The winner gets to add the next block and earn the reward.

What Problem Are Miners Solving?

Miners are trying to find a nonce (number used once) that, when combined with the block data and hashed, produces a hash with a certain number of leading zeros.

Example:

Block Data: "Block #820000, Previous Hash: 0000000000..., Transactions: [...]"
Nonce: 1234567890
Hash: 7a8f3e2d1c... โŒ (no leading zeros)

Nonce: 1234567891
Hash: 9f2e8d7c3a... โŒ (no leading zeros)

Nonce: 1234567892
Hash: 0000001a2b... โœ“ (4 leading zeros! Valid!)
Block Data: "Block #820000, Previous Hash: 0000000000..., Transactions: [...]"
Nonce: 1234567890
Hash: 7a8f3e2d1c... โŒ (no leading zeros)

Nonce: 1234567891
Hash: 9f2e8d7c3a... โŒ (no leading zeros)

Nonce: 1234567892
Hash: 0000001a2b... โœ“ (4 leading zeros! Valid!)
1
2
3
4
5
6
7
8
9

The only way to find a valid nonce is brute forceโ€”trying billions of combinations until you get lucky.

Why This Creates Security

  1. It's expensive: Mining requires specialized hardware and massive electricity
  2. It's competitive: Thousands of miners compete for each block
  3. It's verifiable: Anyone can instantly check if a hash is valid
  4. It's irreversible: To change history, you'd need to redo all that work

Analogy: Imagine a lottery where tickets cost $1,000 each, but you can verify winning tickets instantly for free. That's Proof-of-Work.

How Mining Actually Works: Step-by-Step

Step 1: Collect Transactions

Miners listen to the network and collect unconfirmed transactions from the mempool.

Selection criteria:

  • Valid signatures (not forged)
  • Sufficient funds (no double-spending)
  • Highest fee rates (more profit)

Miners build a candidate block with ~2,500 transactions.

Step 2: Create the Block Header

The block header contains:

  • Version: Protocol version number
  • Previous Block Hash: Links to the last block (creates the chain)
  • Merkle Root: Hash of all transactions (proves they're included)
  • Timestamp: When the block was created
  • Difficulty Target: How many leading zeros required
  • Nonce: The number miners are trying to find

Step 3: Hash the Block Header

Miners take the block header and run it through SHA-256 twice:

SHA-256(SHA-256(Block Header)) = Block Hash
SHA-256(SHA-256(Block Header)) = Block Hash
1

If the hash has enough leading zeros โ†’ Valid block! If not โ†’ Change the nonce and try again.

Step 4: Broadcast the Block

The winning miner broadcasts the block to the network.

Other nodes verify:

  • โœ“ All transactions are valid
  • โœ“ Hash meets difficulty target
  • โœ“ Block reward is correct
  • โœ“ Previous block hash is correct

If everything checks out, nodes add the block to their blockchain and start mining the next one.

Step 5: Collect the Reward

The winning miner receives:

  1. Block subsidy: Currently 6.25 BTC (halves every 4 years)
  2. Transaction fees: All fees from included transactions

Total reward: ~6.25 BTC + 0.1-0.5 BTC in fees = ~$250,000 USD ๐Ÿ’ฐ

๐Ÿฐ DOWN THE RABBIT HOLE: The First Bitcoin Miner

Satoshi Nakamoto mined the very first Bitcoin block (Genesis Block) on January 3, 2009.

Block #0 Details:

  • Reward: 50 BTC (first block ever!)
  • Timestamp: 2009-01-03 18:15:05
  • Nonce: 2,083,236,893
  • Embedded message: "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"

Satoshi embedded a newspaper headline in the Genesis Block to:

  1. Prove Bitcoin didn't exist before that date
  2. Make a statement about the 2008 financial crisis
  3. Show Bitcoin as an alternative to the failing banking system

The 50 BTC reward from this block has never been spentโ€”many believe Satoshi intentionally made it unspendable as a symbolic gesture.

๐Ÿ”— View the Genesis Block โ†’

Mining Difficulty: The Self-Adjusting System

Bitcoin has a target block time of 10 minutes. But as more miners join (or leave), blocks would be found faster (or slower). So Bitcoin automatically adjusts difficulty.

How Difficulty Adjustment Works

Every 2,016 blocks (~2 weeks), Bitcoin recalculates difficulty:

New Difficulty = Old Difficulty ร— (2 weeks / Actual Time)
New Difficulty = Old Difficulty ร— (2 weeks / Actual Time)
1

Examples:

  • Blocks took 1 week โ†’ Difficulty doubles (too fast)
  • Blocks took 2 weeks โ†’ Difficulty stays same (perfect)
  • Blocks took 4 weeks โ†’ Difficulty halves (too slow)

Why This Matters

Without difficulty adjustment:

  • More miners join โ†’ Blocks found in 1 second โ†’ All 21M Bitcoin mined in a day โ†’ Game over

With difficulty adjustment:

  • More miners join โ†’ Difficulty increases โ†’ Blocks still take ~10 min โ†’ Bitcoin supply stays predictable

This is genius. No matter how much computing power joins the network, Bitcoin maintains its 10-minute block time and 4-year halving schedule.

Current Difficulty Stats

  • Current Difficulty: ~60 trillion (60,000,000,000,000)
  • Network Hash Rate: ~500 EH/s (500 quintillion hashes per second)
  • Next Adjustment: Every 2,016 blocks

To put this in perspective: If you tried to mine Bitcoin on your laptop (1 MH/s), you'd find a block once every 10 million years on average. ๐Ÿ˜…

๐Ÿ“บ Whiteboard Crypto: What is Bitcoin Mining? (11 min)

The Halving: Bitcoin's Deflationary Schedule

Every 210,000 blocks (~4 years), the block reward halves. This is hardcoded into Bitcoin's protocol.

Halving History

DateBlockRewardTotal BTC Mined
Jan 2009050 BTC0
Nov 2012210,00025 BTC10,500,000
Jul 2016420,00012.5 BTC15,750,000
May 2020630,0006.25 BTC18,375,000
Apr 2024840,0003.125 BTC19,687,500
20281,050,0001.5625 BTC20,343,750
2140~6,930,0000 BTC21,000,000

Why Halving Matters

  1. Fixed Supply: Only 21 million Bitcoin will ever exist
  2. Predictable Issuance: No central bank can "print more"
  3. Deflationary: Supply decreases over time (opposite of fiat)
  4. Price Impact: Historically, halvings precede bull markets

Supply Schedule:

  • 93% of all Bitcoin already mined (19.6M / 21M)
  • Last Bitcoin mined around year 2140
  • After 2140: Miners earn only transaction fees (no block subsidy)

๐Ÿฐ DOWN THE RABBIT HOLE: The Halving Cycle & Bull Markets

Historically, Bitcoin's price has followed a 4-year cycle tied to the halving:

Pattern:

  1. Halving occurs โ†’ Supply shock (new BTC issuance cut in half)
  2. 12-18 months later โ†’ Bull market peak (all-time high)
  3. Bear market โ†’ 80%+ crash from peak
  4. Accumulation phase โ†’ Slow recovery
  5. Repeat

Historical Examples:

  • 2012 Halving: $12 โ†’ $1,100 (2013 peak) โ†’ $200 (2015 bottom)
  • 2016 Halving: $650 โ†’ $19,000 (2017 peak) โ†’ $3,200 (2018 bottom)
  • 2020 Halving: $8,500 โ†’ $69,000 (2021 peak) โ†’ $15,500 (2022 bottom)
  • 2024 Halving: $65,000 โ†’ ??? (2025 peak?)

Why this happens:

  • Supply shock: Fewer new coins entering market
  • Demand stays same or increases: More adoption
  • Price must rise: Basic supply/demand economics

Disclaimer: Past performance doesn't guarantee future results. But the pattern has held for 3 cycles so far...

Mining Hardware: The Arms Race

Bitcoin mining has evolved from hobbyist CPUs to industrial-scale operations.

Evolution of Mining Hardware

2009-2010: CPU Mining

  • Regular computer processors
  • Hash rate: ~1-10 MH/s
  • Anyone could mine from home
  • Satoshi mined on a laptop

2010-2011: GPU Mining

  • Graphics cards (gaming GPUs)
  • Hash rate: ~100-500 MH/s
  • 50-100x faster than CPUs
  • First "mining rigs" built

2011-2013: FPGA Mining

  • Field-Programmable Gate Arrays
  • Hash rate: ~1-25 GH/s
  • More efficient than GPUs
  • Expensive and complex

2013-Present: ASIC Mining

  • Application-Specific Integrated Circuits
  • Hash rate: 100+ TH/s (100 trillion hashes/sec)
  • Built only for Bitcoin mining
  • Industrial-scale operations

Modern ASIC Miners

Top miners (2024):

  • Antminer S19 XP: 140 TH/s, 3,010W
  • Whatsminer M50S: 130 TH/s, 3,276W
  • Antminer S21: 200 TH/s, 3,500W

Cost: $2,000-$10,000 per unit Profitability: Depends on electricity cost and Bitcoin price

Mining Profitability

Break-even electricity cost: ~$0.05-0.07 per kWh

Example calculation:

  • Miner: Antminer S19 (110 TH/s, 3,250W)
  • Electricity: $0.05/kWh
  • Daily cost: 3.25 kW ร— 24 hrs ร— $0.05 = $3.90/day
  • Daily revenue: ~$8-12 (varies with difficulty/price)
  • Profit: $4-8/day (~$120-240/month)

But this changes constantly based on:

  • Bitcoin price
  • Network difficulty
  • Electricity costs
  • Hardware efficiency

Mining Pools: Cooperation in Competition

Solo mining is like playing the lotteryโ€”you might never win. Mining pools let miners combine their hash power and share rewards.

How Mining Pools Work

  1. Join a pool: Connect your miner to pool's server
  2. Receive work: Pool assigns you block header variations to hash
  3. Submit shares: Send "near-valid" hashes as proof of work
  4. Pool finds block: Reward distributed based on shares contributed
  5. Get paid: Proportional to your hash rate contribution

Pool Reward Methods

PPS (Pay-Per-Share):

  • Fixed payment per share submitted
  • Guaranteed income
  • Pool takes risk

PPLNS (Pay-Per-Last-N-Shares):

  • Payment based on shares in last N shares before block found
  • Higher variance
  • Lower pool fees

FPPS (Full Pay-Per-Share):

  • PPS + transaction fees
  • Most predictable
  • Slightly higher fees

Top Mining Pools (2024)

  1. Foundry USA: ~30% of network hash rate
  2. AntPool: ~20%
  3. F2Pool: ~15%
  4. Binance Pool: ~10%
  5. ViaBTC: ~8%

Centralization concern: Top 5 pools control ~80% of hash rate. If they colluded, they could attack Bitcoin. But they'd destroy their own business, so it's unlikely.

๐Ÿฐ DOWN THE RABBIT HOLE: The 51% Attack

What is it? If someone controls 51% of Bitcoin's hash rate, they could:

  • Double-spend their own transactions
  • Prevent confirmations of specific transactions
  • Reverse recent transactions (up to a few blocks)

What they CAN'T do:

  • โŒ Steal Bitcoin from other addresses (need private keys)
  • โŒ Change the 21M supply cap (nodes would reject)
  • โŒ Create Bitcoin from nothing (invalid blocks rejected)
  • โŒ Reverse old transactions (too much work to redo)

Cost of 51% attack on Bitcoin:

  • Hash rate needed: ~250 EH/s
  • Hardware cost: ~$15 billion in ASICs
  • Electricity cost: ~$1 million per hour
  • Total cost: $15B+ upfront + $24M/day ongoing

Why it won't happen:

  1. Too expensive: Billions of dollars
  2. Destroys value: Attack would crash Bitcoin price
  3. Miners lose: Attackers destroy their own investment
  4. Network adapts: Community would change PoW algorithm

Smaller chains have been attacked (Bitcoin Gold, Ethereum Classic), but Bitcoin is too big and too expensive to attack.

Bitcoin's Energy Use: The Controversy

Fact: Bitcoin uses a lot of energyโ€”about 150 TWh/year (similar to Argentina).

But context matters:

Energy Use Comparisons

  • Bitcoin: 150 TWh/year
  • Gold mining: 240 TWh/year
  • Banking system: 260 TWh/year
  • Christmas lights (USA): 6.6 TWh/year
  • Always-on devices (USA): 1,375 TWh/year
  • Global energy use: 176,000 TWh/year (Bitcoin = 0.08%)

The Renewable Energy Angle

Miners seek cheap electricity, which often means:

  • Hydroelectric: 40%+ of Bitcoin mining
  • Stranded energy: Gas flares, excess renewable energy
  • Off-peak hours: Using otherwise wasted electricity

Bitcoin Mining Council estimates:

  • 59% of Bitcoin mining uses sustainable energy
  • Higher than most industries

The Security Argument

Bitcoin's energy use isn't wasteโ€”it's security:

  • Energy โ†’ Hash rate โ†’ Attack cost โ†’ Network security
  • More energy = more secure network
  • This is the entire point of Proof-of-Work

Analogy: Is the energy used to secure Fort Knox "wasteful"? Noโ€”it's the cost of security.

The Innovation Angle

Bitcoin mining drives:

  • Renewable energy development: Miners fund new solar/hydro projects
  • Grid stabilization: Miners can turn off instantly during peak demand
  • Methane reduction: Miners capture and burn waste gas from landfills/oil fields

Why Mining Matters for Bitcoin

Mining isn't just about creating new coins. It's the security mechanism that makes Bitcoin trustworthy:

  1. Prevents double-spending: Expensive to rewrite history
  2. Decentralizes control: No single entity controls the network
  3. Incentivizes honesty: Miners earn more by following rules
  4. Proves scarcity: Can't fake the work required
  5. Distributes coins: Fair launch, no pre-mine

Without mining, Bitcoin would just be a database anyone could edit. Mining makes it immutable.

The Future of Mining

After 2140 (when block subsidy ends):

  • Miners earn only transaction fees
  • Fees must be high enough to secure network
  • Lightning Network may reduce on-chain fees
  • Layer 2 solutions may change fee dynamics

Possible scenarios:

  1. High fees: On-chain transactions become expensive (like international wire transfers)
  2. Layer 2 dominance: Most transactions happen off-chain (Lightning, sidechains)
  3. Fee market evolution: New fee mechanisms emerge

The bet: By 2140, Bitcoin will be valuable enough that transaction fees alone provide sufficient security.

Key Takeaways

  • Mining = Security, not just coin creation
  • Proof-of-Work makes attacking Bitcoin prohibitively expensive
  • Difficulty adjusts every 2 weeks to maintain 10-min blocks
  • Halving every 4 years creates fixed 21M supply
  • ASICs dominate modern mining (100+ TH/s)
  • Mining pools let small miners earn consistent rewards
  • Energy use is the cost of security, increasingly renewable
  • 51% attack is theoretically possible but economically irrational

๐ŸŽฏ 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: Transactions & UTXOs | Next Lesson: Network & Nodes โ†’

Built with โค๏ธ for the Bitcoin community