Proof of Work and Mining
See how miners compete to add blocks, why difficulty adjusts, how halvings cap Bitcoin's supply near 21 million, and what a 51% attack can and cannot do.
Welcome back!
Step 1 of 13Learn
A lottery you enter by doing work
Thousands of nodes hold copies of the ledger. But who gets to add the next block? If anyone could add blocks freely, attackers could flood the network with fake histories. Bitcoin's answer is proof of work: the right to add a block goes to whoever first solves a puzzle that takes enormous computing effort to solve but seconds to check.
Here's the puzzle. A miner builds a candidate block and hashes it. To be valid, the block's hash must be below a target number, which in practice means it has to start with a long run of zeros. Because hashes are unpredictable, there's no shortcut: the miner changes the nonce (and other small details) and hashes again, and again, trillions of times per second, until one hash happens to fall below the target.
It's like a lottery where each ticket is one hash. Miners with more powerful hardware buy more tickets per second, so they win more often, but anyone could win any given block.
When a miner finds a valid hash, it broadcasts the block. Other nodes check it instantly: one hash to verify, versus trillions to find. The winning miner earns a block reward: newly created bitcoin plus the fees from transactions in the block.
Today, Bitcoin mining is done with specialized machines called ASICs, built only for SHA-256 hashing and often run in large facilities near cheap electricity.
Step 2 of 13Practice · Diagram
The mining loop
Which step does a miner repeat to get a brand-new, unpredictable hash?
Tap the shape that answers the question, then press Check.
- Build a candidate block
Pending transactions + previous block's hash + a nonce.
- Hash the block
- Is the hash below the target?
Almost always no. A valid hash must start with a long run of zeros.
- Change the nonce
Bump the number and try again. There's no shortcut.
Step 3 of 13Practice · Work it out
Suppose a valid hash must start with 4 zeros in hexadecimal, where each character has 16 equally likely values. On average, how many hashes must a miner try to find one valid hash?
Step 4 of 13Learn
Difficulty and the 10-minute rhythm
What if more miners join and the network gets twice as fast at hashing? Blocks would come twice as fast, and coins would be issued faster than planned. Bitcoin prevents this with the difficulty adjustment.
Every 2,016 blocks, about two weeks, every node looks at how long those blocks actually took. If they came faster than 10 minutes on average, the target gets harder (fewer valid hashes); if slower, it gets easier. The result: no matter how much computing power joins or leaves, Bitcoin produces a block roughly every 10 minutes over time.
This self-correcting rhythm is why mining is a competitive business with thin margins. When the price of bitcoin rises, more miners join, difficulty rises and profits shrink back toward the cost of electricity and hardware. When the price falls, the least efficient miners shut off, difficulty falls and the network keeps running.
The total computing power of the network is called the hash rate. A higher hash rate makes the network more expensive to attack, because an attacker must compete with all of it.
Proof of work has a well-known cost: electricity. Bitcoin mining uses an amount of energy that estimates often compare to that of a mid-sized country. Supporters argue that this energy secures a global monetary network and increasingly comes from stranded or renewable sources; critics argue it's a large environmental cost for what the network delivers. Both points shape how governments and investors view proof of work.
Step 5 of 13Practice · True or false
If miners add much more computing power, Bitcoin blocks will permanently start arriving every few minutes instead of about every 10.
Step 6 of 13Learn
Halvings and the 21 million cap
Bitcoin's supply follows a fixed schedule written into its code. The block reward started at 50 BTC per block in 2009. Every 210,000 blocks, roughly every four years, the reward is cut in half in an event called the halving:
- 2009: 50 BTC
- 2012: 25 BTC
- 2016: 12.5 BTC
- 2020: 6.25 BTC
- 2024: 3.125 BTC
Because each period issues half as many coins as the one before, the total approaches a limit: 210,000 × 50 × (1 + ½ + ¼ + …) = 210,000 × 50 × 2 = 21 million. The last fraction of a bitcoin is expected to be mined around the year 2140. Most of the supply already exists: over 90% of all bitcoin that will ever exist has been mined.
Each bitcoin is divisible into 100 million units called satoshis, so the fixed number of coins doesn't limit how small payments can be.
This fixed, predictable supply is central to the case for bitcoin as "digital gold": no central bank can create more. Critics point out that a fixed supply doesn't guarantee value; demand can collapse, and the price has fallen by more than 70% several times.
There's also a long-term question. As the block reward shrinks toward zero, miners will depend more and more on transaction fees. Whether fees alone can pay for enough security is an open debate.
Step 7 of 13Chart
Bitcoin block reward after each halving
Every 210,000 blocks the reward halves. That's why the supply curve on the next step flattens toward 21 million.
Step 8 of 13Explore
Bitcoin supply over time (smooth approximation)
The curve approaches 21 million coins as each four-year period issues half as many coins as the one before. Real issuance falls in steps at each halving; this smooth curve approximates it.
- Approximate supply after t years (millions)
- 19.69 million
- Share of the 21 million cap issued
- 93.8 %
Step 9 of 13Try the calculator
Block reward calculator
Bitcoin produces about 144 blocks a day (24 hours × 6 per hour). Enter how many halvings have happened.
- Block reward
- 3.125 BTC
- New bitcoin issued per day
- 450 BTC
- New bitcoin issued per year
- 164,250 BTC
Step 10 of 13Practice · Work it out
After 4 halvings the block reward is 3.125 BTC. At about 144 blocks a day, how many new bitcoins are created per day?
Step 11 of 13Learn
What a 51% attack can and can't do
Proof of work is secure as long as no single party controls most of the network's hash rate. If an attacker controlled more than half, a so-called 51% attack, they could produce blocks faster than everyone else combined.
What could they do with that power?
- Double-spend their own coins. Send coins to an exchange, trade them for something, then secretly mine a longer alternative chain where that payment never happened. When they release it, the network follows the longer chain and the original payment disappears.
- Censor transactions by refusing to include them in their blocks.
What they couldn't do:
- Steal coins from other people's addresses, because that requires their private keys.
- Create coins beyond the rules, because nodes would reject invalid blocks.
- Change old history cheaply; the deeper a transaction is buried, the more work it would take to undo.
On Bitcoin, acquiring that much hash rate would cost billions in hardware and electricity, and a visible attack would likely crash the value of the coins the attacker holds. Smaller proof-of-work coins with little hash rate have suffered real 51% attacks.
This is why recipients wait for confirmations: each new block on top of a transaction makes reversing it exponentially harder. For large Bitcoin payments, waiting for about six confirmations, roughly an hour, is a common convention.
Step 12 of 13Practice · Select all that apply
An attacker gains more than half of a proof-of-work network's hash rate. Which of these could they do? Select all that apply.
Select all that apply.
Step 13 of 13Practice · Choose one
Why do merchants accepting a large bitcoin payment often wait for several confirmations?
Lesson complete!