IndexCrypto
Educational only. Not financial, tax or legal advice, and nothing here is a recommendation to buy anything.

How Proof of Work Secures a Blockchain

How proof of work turns hashing into a cost: the nonce search, difficulty retargets, cumulative work and the majority-hash-power attack. No prices, no forecasts.

Proof of work is the rule that makes adding a block to a blockchain expensive. A miner repeatedly hashes a block header, changing one field each time, until the output is numerically small enough to satisfy the network’s current target. Because the hash function is unpredictable, there is no shortcut: the only way to find a qualifying output is to try candidates until one lands. The cost of that search, paid in electricity and hardware, is what a proof-of-work chain converts into resistance to rewriting history.

What the miner is actually hashing

A block header is a small, fixed-layout record. It contains the hash of the previous block, a Merkle root summarising the transactions in the block, a timestamp, the current difficulty target, and a 32-bit field called the nonce. The miner’s job is to find a nonce, or some other variation of the header, such that the double-SHA-256 hash of the whole header, read as a number, is less than the target.

Nothing about the transactions changes during this search. The miner is not solving anything about the payments; the header is simply a fixed input with one adjustable field. The first candidate that hashes below the target is broadcast with the block. Every other node recomputes the hash once and accepts or rejects it immediately. Verification is cheap; production is not. That asymmetry is the whole design.

Why the target, not the hash, sets the work

The target is a number. A lower target means fewer hashes qualify, so more attempts are needed on average. Miners do not choose the target; the protocol sets it and adjusts it on a fixed schedule, typically every 2016 blocks in Bitcoin-style designs, aiming for a steady average interval between blocks.

If blocks are arriving faster than the schedule intends, the target is lowered and mining becomes harder. If they are arriving slower, the target rises and mining becomes easier. This is mining difficulty, and it is a property of the whole network, not of any one machine. A miner with more hash power earns a larger share of block rewards at the same difficulty; it does not change the difficulty itself.

Difficulty also means the energy cost of a block is not fixed. As more hash power joins, the same block interval requires more total hashing, and the network’s electricity draw rises with it. The protocol does not cap that draw. It only keeps the block interval steady.

Cumulative work and which chain counts

A node does not simply follow the longest chain by block count. It follows the chain with the most cumulative proof of work, the sum of the difficulty of every block from genesis to the tip. In most cases the two coincide, because each block carries roughly the same work at a given difficulty. They diverge when difficulty has changed, or when two competing chains have different histories.

When two miners find valid blocks at nearly the same height, nodes may briefly hold different tips. The next block resolves it: whichever branch gains the next valid block accumulates more work, and nodes reorganise onto it. Transactions in the abandoned block return to the mempool if they are still valid. This is normal and is why exchanges and payment processors wait for several confirmations before treating a deposit as settled.

The majority-hash-power attack

Because the valid chain is the one with the most work, an attacker who controls more than half of the network’s hash rate can, in principle, outpace the honest chain. Such an attacker can mine a private branch, extend it faster than the public one, and then publish it. The network follows the heavier chain, and the attacker’s branch replaces the public history from the fork point onward.

What this does and does not buy is worth stating precisely. It allows double-spending of the attacker’s own coins: spend on the public chain, then replace that history with a branch where the coins were never spent. It does not let the attacker spend other people’s coins, because signatures still have to be valid. It does not let them mint coins out of nothing, because the block reward rules still apply. It is expensive and conspicuous, and it is the reason very large proof-of-work networks are considered costly to attack rather than impossible to attack.

Energy use, described without a figure

Proof of work consumes electricity because the search is deliberately wasteful: every nonce that fails is discarded. The work is not useful computation in any ordinary sense; its only product is the proof that the work was done. Whether that expenditure is justified is a policy question, not a protocol one, and the protocol has no mechanism to reduce it beyond the difficulty adjustment keeping the block interval steady.

Mining economics push miners toward cheap power, which in practice means stranded hydro, flare gas, or off-peak grid capacity in some regions, and ordinary grid power in others. The mix varies by location and by season and is not something a protocol rule determines.

Proof of work against proof of stake

The contrast is about what the security budget is denominated in. Under proof of work, a miner’s influence is proportional to hash rate, and the cost of acquiring it is hardware and energy. Under proof of stake, a validator’s influence is proportional to the stake it has locked, and the cost of misbehaving is the loss of that stake through slashing.

PropertyProof of workProof of stakeWhere the distinction does not matter
Resource that buys influenceHash rate, paid for in hardware and electricityLocked stake, paid for in the staked assetBoth make a block expensive to produce relative to verifying it
Penalty for misbehaviourWasted expenditure; the attacker’s branch may be orphanedSlashing: part of the stake is destroyedNeither prevents a well-resourced attacker, only prices them out
FinalityProbabilistic; a block is safer with each confirmationOften explicit finality after a checkpointBoth require waiting before treating a payment as settled
Energy profileContinuous electricity draw from the hash searchNo hash search; energy use is far lowerBoth depend on the honesty of the majority of the securing resource
Entry costBuy and run mining hardwareAcquire and lock the staked assetBoth have concentration risk among large participants

Neither mechanism makes a chain safe in absolute terms. Proof of stake substitutes an economic penalty inside the protocol for an external cost, and it introduces its own risks, including lock-up periods and slashing conditions that can apply to honest validators who misconfigure their setup. Proof of work has no slashing, but it has no in-protocol penalty either: a miner who wastes energy on an orphaned block simply loses the spend.

Reading a block explorer for work, not price

A block explorer shows the fields that matter here. The difficulty and cumulative chain work figures tell you how much hashing stands behind the tip. The nonce and the block hash let you confirm that the header meets the target. The confirmation count tells you how many blocks have been built on top of a transaction. If you run a node or wallet on your own machine, the same care for who can read those files applies to the accounts holding your keys, which is what this guide to diagnosing access denied through effective permissions walks through.

For inspecting a header directly, Foundry’s cast tool can decode and query on-chain data. The commands below are illustrative of the tool’s interface; substitute a real transaction hash and RPC endpoint.

cast decode-calldata "transfer(address,uint256)" 0x...

This prints the function name and arguments encoded in a calldata blob, which is how a transaction’s intent is read without trusting a front end.

cast 4byte 0xa9059cbb

This looks up a four-byte selector and prints candidate signatures, useful when a transaction calls a function you do not recognise.

Source: https://getfoundry.sh/cast/reference/decode-calldata (Foundry Book: cast decode-calldata) Source: https://getfoundry.sh/cast/reference/4byte (Foundry Book: cast 4byte)

What proof of work does not protect against

Proof of work secures the ordering of blocks. It does not secure the keys that authorise transactions. A signed transaction is valid regardless of how the chain was mined, so a stolen private key or a malicious signature request drains funds on a proof-of-work chain exactly as it would on any other. The mining mechanism is irrelevant to that failure.

It also does not protect against a chain with too little hash rate. A small proof-of-work network can be attacked by rented hash power at a cost that is low relative to the value it secures. The mechanism is sound; the security budget may not be. That is a property of the specific chain, not of proof of work in general, and it is the reason the size of the hash rate matters when assessing any individual network.

Common questions

What is proof of work in simple terms?

It is a rule that requires a miner to find a block header hash below a target number before a block is accepted. Because hashes cannot be predicted, the only way to find one is to try many candidates, which costs electricity. That cost is what makes rewriting past blocks expensive.

How does mining difficulty adjust?

The protocol compares how fast blocks have been found against a target interval and moves the target up or down on a fixed schedule, usually every 2016 blocks in Bitcoin-style designs. Faster blocks lower the target and make mining harder; slower blocks raise it. Difficulty is a network-wide property, not a setting on your machine.

What is a 51% attack and what can it actually do?

An attacker with more than half the hash rate can mine a private branch faster than the public chain and replace recent history. That allows double-spending their own coins. It does not allow spending other people's coins or creating coins outside the reward rules, because signatures and issuance rules still apply.

Is proof of work safer than proof of stake?

They price security differently rather than one being safe and the other not. Proof of work charges attackers in hardware and energy; proof of stake charges them by slashing locked stake. Each has failure modes, and neither makes a chain impossible to attack.

Why do exchanges wait for confirmations?

Because a block can be replaced by a heavier competing branch, a transaction is only as settled as the work built on top of it. Each additional block makes replacement more expensive. Waiting for several confirmations reduces the chance that a deposit is reversed by a reorganisation.

Read next