Technical Explainer

How Proof-of-Work Mining Actually Works: From Hash Puzzles to Block Rewards

A beginner-friendly explanation of SHA-256 mining, difficulty adjustment, and why Bitcoin uses more electricity than some countries.

block-creation-expensive">The Core Insight: Making Block Creation Expensive

Bitcoin's fundamental innovation was solving the double-spend problem in a trustless, decentralized way. The solution Satoshi Nakamoto devised was elegantly indirect: instead of preventing fraud through trusted intermediaries, make it so expensive to rewrite history that no rational attacker would try. Proof of work is the mechanism that makes history expensive to rewrite.

The basic principle is that to add a new block to the blockchain, miners must perform a large amount of computation — "work" in the mathematical sense. This work is easy for the rest of the network to verify, but hard to perform. The asymmetry between verification and production is what gives the system its security properties.

sha-256-puzzle">The SHA-256 Puzzle

What Miners Are Actually Doing

When a miner attempts to add a block, they are essentially solving a puzzle. The puzzle involves a cryptographic hash function called SHA-256 (Secure Hash Algorithm 256-bit). A hash function takes any input and produces a fixed-size output — in SHA-256's case, a 256-bit number typically displayed as a 64-character hexadecimal string.

Hash functions have several important properties for this application. They are deterministic: the same input always produces the same output. They are fast to compute but not reversible: given an output, you cannot work backward to find the input without guessing. And they are highly sensitive to input changes: changing even a single character in the input produces a completely different, unpredictable output.

A block header contains several pieces of data: the hash of the previous block (linking it to the chain), a timestamp, a summary of the transactions in the block (the Merkle root), and a field called the nonce. The miner's task is to find a nonce value such that when the entire block header is hashed with SHA-256, the resulting hash starts with a certain number of leading zeros.

For example, a valid hash might look like: 00000000000000000003a7e8c9b1f2d4e5.... The number of leading zeros required — the "target" — is what determines how difficult the puzzle is.

Nonce Searching: Trial and Error at Scale

There is no clever shortcut to finding a valid nonce. The only method is brute force: try one nonce value, hash the header, check if the result meets the target, and if not, increment the nonce and try again. Over and over, billions of times per second.

With a 32-bit nonce field, a miner can try about 4.3 billion nonce values before running out. If none of them produce a valid hash (which is common at high difficulty levels), miners can also vary other parts of the block header — such as the timestamp — to get a fresh set of nonce space to search.

The expected number of attempts required to find a valid hash can be calculated from the target. If the target requires 72 leading zeros (in bits), the probability of any single hash meeting the target is roughly 1 in 2^72 — a number so large that even with machines performing trillions of hashes per second, finding a valid hash takes roughly ten minutes on average across the entire Bitcoin network.

Difficulty Adjustment

Keeping the 10-Minute Average

Bitcoin's protocol is designed to produce blocks at an average rate of one every 10 minutes. But the total computational power directed at Bitcoin mining — the "hashrate" — changes constantly as miners enter or leave the network, upgrade their hardware, or respond to price movements.

If hashrate doubles, miners would find valid blocks twice as fast without adjustment — about every 5 minutes instead of 10. If hashrate drops by half, it would take 20 minutes on average. Neither situation is desirable. Faster blocks increase the orphan rate (two blocks found simultaneously, creating temporary forks). Slower blocks reduce transaction throughput and can delay confirmations.

To maintain the 10-minute target, Bitcoin's protocol automatically adjusts the difficulty every 2,016 blocks — approximately every two weeks. If the previous 2,016 blocks were found in less than two weeks (faster than the 10-minute average), difficulty increases. If they took more than two weeks, difficulty decreases. The adjustment is proportional: if blocks were found twice as fast, difficulty doubles.

This self-adjusting mechanism means Bitcoin is remarkably resilient to changes in mining participation. When China banned Bitcoin mining in 2021, a large fraction of the network's hashrate went offline simultaneously. Difficulty dropped significantly in the following adjustment, making it easier for the remaining miners to find blocks — and within months, mining had largely relocated elsewhere and hashrate recovered to previous levels.

Block Rewards and the Incentive Structure

Why Miners Mine

Miners expend real resources — electricity, hardware, cooling infrastructure — to perform proof of work. They do this because they receive a reward for each block they successfully add to the chain. The block reward has two components: the block subsidy (newly minted Bitcoin) and transaction fees paid by users whose transactions are included in the block.

When Bitcoin launched in 2009, the block subsidy was 50 BTC per block. Bitcoin's protocol specifies that this subsidy halves every 210,000 blocks — approximately every four years — in an event called the halving. By 2024, the subsidy was 3.125 BTC per block, and it will continue halving until it reaches zero, which will occur around the year 2140.

The halving mechanism creates a predictable, decreasing supply schedule that is embedded in the protocol itself. No central authority decides when or whether to reduce issuance — it happens automatically at the specified block count. This predictability is one of Bitcoin's core value propositions as a monetary asset.

As the block subsidy decreases, transaction fees become an increasingly important component of miner revenue. Whether fees alone will provide sufficient incentive to secure the network when the subsidy approaches zero is an open research question in the Bitcoin community.

Energy Consumption and Environmental Debate

Why Mining Uses So Much Power

Proof of work's security properties are directly proportional to the energy expended. This is not an accident or inefficiency — it is the mechanism. The "cost" of performing work is what makes history expensive to rewrite. An attacker who wanted to alter past transactions would need to redo all the work that has been done since those transactions were included, which means matching or exceeding the total cumulative computational work of the honest network.

As Bitcoin's price rose over the years, the potential rewards for mining increased, attracting more miners and more hardware. More hardware means more total energy consumed. By various estimates, Bitcoin's annual energy consumption has grown to rival that of mid-sized countries.

This energy consumption is controversial. Critics argue that using massive amounts of electricity to run a lottery for block rewards is wasteful compared to the social value provided. Supporters counter that Bitcoin mining disproportionately uses stranded or excess energy — electricity that would otherwise be wasted because it was generated in a location or at a time when other demand was low. They also argue that the energy expenditure provides genuine security value that cannot be obtained more cheaply through other means.

Mining Pools

The Variance Problem and the Pool Solution

A miner with 1% of the network's hashrate would, on average, find 1% of blocks. But averages don't pay electricity bills. For smaller miners, the variance in solo mining is prohibitive: you might go months or years without finding a single block, even if your long-run average would be profitable. This is like holding a lottery ticket with excellent expected value but a payment schedule of zero income for years followed by a single large payment.

Mining pools solve the variance problem. Miners in a pool combine their hashrate and share block rewards proportionally to the work each contributor performed. Instead of rare large payouts, pool members receive frequent small payouts that closely track their average expected earnings.

Pools use a system of "shares" — partial proofs of work that are easier than the full difficulty target. A miner submits these shares to the pool, demonstrating that they are genuinely searching for valid blocks. When any pool member finds a valid block, the reward is distributed to all members in proportion to the shares they submitted.

The tradeoff is that pool operators collect a fee (typically 1-2%), and miners cede some control to the pool operator, who decides which transactions to include in candidate blocks. The concentration of hashrate into large mining pools has been a persistent centralization concern: if a few pools controlled more than half the network's hashrate, they could theoretically collude to manipulate transaction ordering or censor specific transactions, even without the ability to rewrite past history.

Proof of work's security model depends on the assumption that mining power is distributed widely enough that no single entity can accumulate majority control without facing prohibitive economic costs. The ongoing tension between this theoretical requirement and the practical economics that drive hashrate concentration remains one of the central debates in Bitcoin's development.

Related Stories