New to Bitcoin? Start at 1.1
2.4Lesson 4 of 7
How mining works
This lesson answers
- How does bitcoin mining work?
- What is mining difficulty?
- How much do bitcoin miners earn?
- What is a mining pool?
- Can I mine bitcoin at home?
Mining is how new blocks get added to the record. Miners run special machines that make trillions of guesses a second, looking for one number that makes a block valid. The first to find it adds the block and is paid in new bitcoin plus fees. Everyone else checks the answer in an instant.
- Guesses per second, all miners
- …exahashes: billions of billions
- Difficulty
- …
- Average time between blocks
- …since the last adjustment; the target is 10 min
- Next difficulty change
- …estimated
- Newest block added by
- …mining pool, from the block's own tag
- New bitcoin per block
- …plus fees
The next adjustment is expected around ….
See it on satoshis.watch →The guessing game
Every block has a fingerprint, called a hash: a long number worked out from everything inside it. Change one character and the fingerprint changes completely and unpredictably. A block only counts if its fingerprint is below a target set by the rules. Miners change a spare field in the block, recompute the fingerprint and check it, over and over, until one comes in under the target.
There is no shortcut. That is the point: the work, called proof of work, is what makes the record hard to rewrite. Changing an old block would mean redoing its work and the work of every block since, faster than everyone else is adding new ones.
Difficulty keeps the pace near ten minutes
The more machines join, the faster blocks would be found. So every 2,016 blocks, about two weeks, every node looks at how long those blocks took and moves the target. If they came too fast, finding a block gets harder; if too slow, easier. That is why blocks keep arriving about every ten minutes on average, whether mining grows or shrinks.
What miners are paid
The miner who finds a block pays itself the new bitcoin that block may create, currently 3.125, plus the fees of every payment inside it. The new-bitcoin part halves every 210,000 blocks; see how many bitcoin there are. Out of that, miners pay for machines and electricity, which is where most of their money goes.
Pools and the names in blocks
A single machine might wait years for a block, so most miners join a pool. The pool shares out the work, and when anyone in it finds a block, the reward is split by how much work each member did. The names you see on blocks, like the ones above, are pools, read from a tag the pool writes into its own blocks.
Can you mine at home?
A home computer can't compete: mining is done with machines built only for this, called ASICs. Even one such machine running alone, at about 200 trillion guesses a second, would expect to find a block roughly once a century at today's total. Whether joining a pool covers the electricity depends on the machine and the local power price. Offers of "cloud mining" with fixed daily returns are a common form of scam; see the common scams.
Check yourself
Practice, not a test. Think of your answer first, then reveal it.
1Why does finding a block take so much work?Reveal
A valid block needs a fingerprint below a target, and the only way to find one is to keep guessing. The work is what makes rewriting old blocks too expensive.
2What happens to difficulty if many new machines join?Reveal
Blocks start coming faster than every ten minutes, so at the next adjustment, every 2,016 blocks, difficulty goes up to bring the pace back.
3What is a miner paid for each block?Reveal
The new bitcoin the rules allow for that block, plus the fees of all the payments inside it.
Sources
- Satoshi Nakamoto, Bitcoin: A Peer-to-Peer Electronic Cash System (2008), section 4, Proof-of-Work.
- Bitcoin Core, pow.cpp and chainparams.cpp: the two-week difficulty adjustment and the ten-minute target.
- Hashrate, difficulty, the next adjustment and the newest block: read from a Bitcoin node.