Sezga
English
Sign in

Blockchain technology · · 6 min read

Bitcoin mining and proof of work (PoW) explained

Mining is the process of gathering pending transactions into a block and adding that block to the blockchain. Proof of Work (PoW) is the rule that decides who gets to add the next block by requiring a large amount of computation: doing that work is expensive, but checking the result is almost free for anyone.

Bitcoin's ability to run without a central administrator rests on this asymmetry. Nobody needs to be trusted; anyone can verify on their own computer that real work stands behind each block.

What a miner actually does

A miner's job breaks down into a few steps:

  1. Select transactions. Transactions that have been broadcast but not yet included in a block wait in an area called the mempool. Miners usually prioritize transactions that pay higher fees.
  2. Build the block header. The header contains the previous block's fingerprint (its hash), a single value summarizing all the transactions in the block (the Merkle root), a timestamp, the current difficulty target and a number called the nonce.
  3. Run the header through a hash function. A hash function turns any data into an output of fixed length that cannot be predicted in advance. Bitcoin applies the SHA-256 function twice in a row.
  4. Compare the result with the target. If the resulting number is below the target set by the network, the block is valid. If not, the miner changes the nonce or another small field in the block and tries again.

The miner who finds a valid hash broadcasts the block. Other nodes check it, add it to their copy of the chain if it follows the rules, and everyone starts racing for the next block.

Why the puzzle is hard and verification is easy

A hash function's output cannot be predicted. Change a single character of the input and the output changes completely. So there is no shortcut to finding a result below the target; the only method is trial and error.

Think of it as a lottery with billions of tickets. Each hash attempt is a ticket, and winning tickets are very rare. A miner making more attempts per second has a better chance of winning, but the outcome is never certain. The total number of attempts that all miners on the network make per second is called the hash rate.

Verification, on the other hand, is a single operation. A node receiving the block hashes the header once and checks whether the result is below the target. A solution found through billions of attempts is checked in an instant.

Difficulty adjustment: the 10-minute rhythm

Bitcoin is designed to produce a block every 10 minutes on average. But the computing power joining the network changes constantly. That is why difficulty is recalculated every 2,016 blocks, roughly every two weeks:

  • If the last 2,016 blocks came in faster than the 10-minute average, difficulty rises and the target shrinks.
  • If they came in slower, difficulty falls and the target grows.

A hypothetical example: suppose the computing power on the network doubles in a short time. Until the next adjustment, blocks arrive roughly every 5 minutes. At the adjustment, difficulty roughly doubles and the rhythm returns to 10 minutes. The reverse also holds: if some miners leave, blocks slow down and difficulty drops after the adjustment.

This mechanism keeps the pace at which new bitcoin enters circulation close to a predetermined schedule, no matter how many miners there are.

Why miners do it

Mining is costly. In return, there are two kinds of income:

Income sourceDescription
Block subsidyNewly created bitcoin in each block. It halves every 210,000 blocks, roughly every four years (the halving).
Transaction feesFees paid by users for the transactions included in the block.

On the cost side are specialized machines called ASICs, built solely for this task, plus electricity, cooling and maintenance. Whether a miner makes a profit depends on the bitcoin price, the total hash rate, fee levels and the cost of electricity.

For a small miner working alone, luck plays an enormous role. A miner with one millionth of the network's total power will, on average, find one block in a million; with 10-minute blocks, that works out to about 19 years. To reduce this uncertainty, miners join mining pools. They combine their power, and when the pool finds a block, the reward is shared in proportion to each participant's contribution. Income becomes smaller but far more regular.

Security: the chain with the most work

Nodes follow the valid chain with the most cumulative work, a rule often simplified to "the longest chain". Anyone wanting to alter a past block would have to redo the work for that block and every block after it, and also overtake the new blocks the honest network keeps producing. The further back you go, the faster this cost grows. That is why a transaction is considered safer as more blocks are added on top of it.

The 51% attack is the known weak spot of this model. A party controlling more than half the network's hash rate could try to reverse its own payments and spend the same coins again (a double spend), or prevent certain transactions from getting into blocks. However, it cannot spend coins in other people's wallets without their signatures, and it cannot create new coins against the rules, because nodes reject invalid blocks. On a large network, the hardware and energy cost of such an attack is very high; on smaller PoW networks, the risk is more concrete.

The debated sides of proof of work

The strength of PoW is that it ties security to a physical cost. Criticism tends to fall under three headings:

  • Energy use: security is directly linked to the electricity spent; this is a separate and lengthy debate.
  • Concentration: hash power gathering in a few large pools is a risk watched closely from a decentralization standpoint.
  • Alternatives: models such as Proof of Stake use locked coins as collateral instead of computation; each model has its own trade-offs.

Key takeaways

  • Mining means gathering transactions into blocks and adding them to the chain; proof of work requires costly computation to do so.
  • A miner hashes the block header over and over until the result falls below the target; verifying it takes a single operation.
  • Difficulty adjusts every 2,016 blocks and keeps the block time near a 10-minute average.
  • Miners earn the block subsidy and transaction fees; pools smooth out the swings in income.
  • Rewriting history requires redoing the work of every later block; the 51% attack is the known limit of this model.

The Sezga terminal

Live prices, liquidation feed, multilingual news, the Fed calendar, event memory and a paper-trading account on one screen. Access is by invitation.

Sign in

Related articles