Agreeing on history without a referee
A blockchain's hardest problem is not cryptography, it is consensus: getting thousands of mutually distrusting computers scattered across the internet to agree on a single, shared order of transactions, with no central authority allowed to just declare the answer. Proof-of-Work solves this by making it expensive, in real computational effort, to propose the next block, and by letting the network follow a simple, mechanical rule -- the longest chain (more precisely, the chain with the most accumulated work) is the valid one -- rather than any vote or committee.
Mining a block means repeatedly hashing the block's contents together with a changing number called a nonce until the resulting hash falls below a target value -- a number with enough leading zero bits to make it statistically rare. Because a cryptographic hash function is unpredictable, there is no shortcut: finding a valid hash requires, on average, trying about 2^d different nonces for a target requiring d bits of leading zeros, and the only strategy is brute-force search.
find nonce such that: SHA256(SHA256(block_header || nonce)) < target expected tries ≈ 2^difficulty_bits (pure brute force, no shortcut exists)
Difficulty retargeting keeps the clock steady
As more miners join the network, the combined hash rate rises and blocks would be found faster than the protocol's target interval (10 minutes for Bitcoin) purely by chance. Every fixed number of blocks, the network recalculates the target and adjusts difficulty up or down so that, given the hash rate observed over the last retargeting period, blocks are expected to keep arriving at the same steady interval. This is a self-correcting feedback loop with no external input: it is why Bitcoin's block time has stayed close to 10 minutes for over a decade despite total network hash rate rising by many orders of magnitude.
Forks resolve themselves, given enough time
Because block propagation across a global network takes real time, two miners can occasionally find valid blocks at nearly the same moment, both extending the same parent -- a temporary fork. Different nodes will initially see different tips as the current best chain. The rule that resolves this without any vote is simply: whichever branch accumulates more total proof-of-work first is the one everyone eventually converges on, and blocks on the abandoned branch are discarded (their transactions return to the pending pool unless also included in the winning chain). This is why a transaction is not considered final the instant it appears in a block -- it needs several subsequent blocks (confirmations) piled on top before the chance of that block being on a losing fork becomes negligible.
The 51% attack: buying the ability to rewrite history
If a single actor controls more than half the network's total hash rate, they can, in principle, mine a private alternative chain faster than the honest network extends the public one, then release it -- and because the rule is simply 'longest accumulated work wins', the network will switch to the attacker's chain, discarding transactions that were previously considered confirmed. This lets the attacker double-spend coins they already spent honestly, but critically it does not let them forge transactions from other users' wallets or create coins from nothing -- cryptographic signatures still protect those. The attack's cost scales directly with the honest network's total hash rate, which is exactly why proof-of-work's security is often summarised as 'security proportional to electricity spent': for a large, established chain the hardware and energy cost of sustaining 51% of global hash rate is enormous, while a small chain with little mining power is comparatively cheap to attack.
What proof-of-work is actually buying
The elegant part of the design is that the same computational cost that makes mining expensive also makes rewriting history expensive in exactly the same currency. An attacker cannot cheaply forge a fake chain with more accumulated work than the real one, because accumulated work is, by construction, a real, unforgeable, physically-grounded cost. That trade -- real-world energy for tamper-evidence -- is what proof-of-work consensus actually sells, and it is also its most criticised feature, since the same energy is spent whether or not any attack is ever attempted.
Frequently asked questions
What exactly are miners doing when they 'mine' a block?
They are repeatedly hashing the proposed block's contents together with a changing nonce value, searching for a nonce that produces a hash below a target threshold. Because hash outputs are unpredictable, this requires brute-force trial and error, and finding one is proof that a real amount of computational work was spent.
Why does Bitcoin's block time stay close to 10 minutes even as total mining power grows?
The network periodically recalculates the difficulty target based on how fast recent blocks were actually found. If blocks came faster than the target interval, difficulty rises; if slower, it falls -- a self-correcting feedback loop that keeps the average interval steady regardless of how much total hash power joins or leaves.
What can and can't a 51% attacker actually do?
A majority-hash-rate attacker can rewrite recent transaction history to double-spend coins they already spent, by secretly mining a longer alternative chain. They cannot forge other users' signatures, steal coins from wallets they do not control, or create new coins outside the protocol's rules -- cryptographic signatures still protect those.
Try it live
Everything above runs in your browser — open Blockchain Consensus and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Blockchain Consensus simulation