✖

The 51% attack: can Bitcoin be spent twice?

A 51% attack is an attempt to rewrite the recent history of Bitcoin payments so that the attacker gets back money that has already been spent. Bitcoin writes its payments into a shared ledger, in bundles called blocks. Each block carries the hash of the previous one, a short “fingerprint” of its data: change the data and the hash comes out different. The blocks thus form a chain. The right to add a new block goes only to the winner of a computing lottery, and that is called mining.

What would anyone gain from it? Adam advertises a second-hand car for 1 BTC. Eva sends him the bitcoin, Adam waits a while for the payment to go through, and hands over the keys. Eva drives off. At home, though, she has computers that have been secretly mining a different version of the chain ever since the block just before her payment, a version in which no payment to Adam exists. If she gets that version accepted, she keeps both the car and the bitcoin. This is called double spending. Adam has handed over the car, the payment has vanished from history, and he has no money. That is why merchants wait for confirmations.

There is a very practical side to all this. Everyone who accepts Bitcoin asks themselves: how long should I wait before I can treat a payment as final? In short: whoever has the majority of the power can rewrite recent payments; whoever does not has a chance that shrinks quickly with every further confirmation, and we are going to work that out.

The longest chain wins

A copy of the ledger is held by thousands of computers scattered around the world, the so-called nodes. A new block is added on average once every ten minutes, and each carries the hash of the block before it: change one old block and nothing after it fits.

In the lottery, numbers are tried one after another until the hash of the block comes out small enough, and there is no way except trying. The computers that do this are called miners. Someone with a tenth of the computing power of the whole network wins every tenth block on average. Everything else follows from this simple rule: the chance of mining the next block equals your share of the power. What counts is the share of the power, not the number of computers.

It happens that two miners find a block almost at once, and the chain then forks for a while. The nodes have a simple rule for that: the chain with the most work behind it is the valid one, in practice the longest. As soon as one branch grows by another block, the other goes in the bin and its payments return to the waiting list.

A payment that gets into a block receives its first confirmation. Each block that follows adds another. Whoever wants to wipe a payment from history has to rewrite the block with it and every block above it, so Eva has to make up as many blocks as the payment has confirmations.

Double spending

The longest-chain rule tells her directly how to go about it: she only needs to produce a longer chain than the rest of the network has, and the nodes will obediently accept it.

A chain of blocks that forks. Three blocks form the common beginning. The upper, blue branch has a block with the payment E→A and two more blocks, above which a curly bracket marks z confirmations. The lower, red dashed branch begins with a block E→E and has one block more, an arrow showing that it keeps growing A chain of blocks that forks. Three blocks form the common beginning. The upper, blue branch has a block with the payment E→A and two more blocks, above which a curly bracket marks z confirmations. The lower, red dashed branch begins with a block E→E and has one block more, an arrow showing that it keeps growing

The payment to Adam (“E→A”) gets into a block on the public, blue branch. Adam waits for z confirmations and hands over the car. Meanwhile Eva mines her own secret branch, red in the picture, which continues from the block just before the payment. Its first block contains the same bitcoin sent elsewhere, to Eva’s second address (“E→E”). The two payments rule each other out, and no node will allow the same coin to be spent twice. As long as the secret branch is shorter, Eva shows it to nobody. As soon as it is longer, she publishes it. The nodes move over to the longer branch, throw away the blue blocks, and not a trace of the payment to Adam remains.

The trouble is that Eva has to mine faster than all the others put together. If she has more than half of the power, the secret branch grows faster on average and sooner or later overtakes the public one. That is why people speak of a 51% attack: “a little more than half” is enough. What is far more interesting is how Eva fares when she does not have half.

A race between two teams

The honest miners have a share p of the power, Eva has q, and together p + q = 1. Suppose Eva has thirty per cent, so q = 0.3 and p = 0.7. Each new block is like tossing a biased coin: with probability 0.7 the honest miners mine it and their branch grows, with probability 0.3 Eva mines it and hers grows.

A single number is enough to follow: how many blocks Eva is behind. At the start it is as many as the payment has confirmations, say two. When the honest miners mine a block, the deficit grows by one; when Eva does, it falls by one. The deficit thus wanders back and forth, and mathematicians call that a random walk. Eva wins at the moment the deficit falls to zero. (Strictly, she would have to be a block ahead to have a longer chain, not just an equally long one. We leave that one extra block aside, as did Satoshi Nakamoto, the creator of Bitcoin.)

We had a computer run such a race twenty times:

A graph of twenty simulated races. The horizontal axis is the number of blocks from 0 to 30, the vertical axis is Eva’s position against the honest miners, from −24 to 0. All the races start at the point −2. Four red lines climb within the first ten blocks to the orange dashed zero and end in an orange dot. The other sixteen blue lines slope down and after thirty blocks end between −6 and −22 A graph of twenty simulated races. The horizontal axis is the number of blocks from 0 to 30, the vertical axis is Eva’s position against the honest miners, from −24 to 0. All the races start at the point −2. Four red lines climb within the first ten blocks to the orange dashed zero and end in an orange dot. The other sixteen blue lines slope down and after thirty blocks end between −6 and −22

In most races nothing surprising happened: the blue lines slope downwards, because the honest miners mine 7 blocks out of ten on average and Eva only 3, so she loses roughly four more blocks for every ten. But four times out of twenty Eva celebrated. What matters is when: right at the start, while she was still close. In the white paper, the original description of Bitcoin from 2008, Satoshi put it roughly like this: if Eva does not make a lucky dash right at the beginning, her chances fade as the deficit grows.

Four out of twenty is 20%. Is that chance, or a law? In a hundred thousand races Eva made up a deficit of two blocks in 18.5% of cases. That is a number we can try to work out.

Eva’s chances

Let x be the probability that Eva ever makes up a deficit of one block. Whoever wants to make up three blocks has to make up one, then another, and finally one more. Each step is the same independent race, so the chances multiply, as with three throws of a die: Eva makes up a deficit of two blocks with probability x · x = x2, of three blocks with x3, and of z blocks in general with xz.

How do we find x? We only need to look at the first block of the race. With probability q Eva mines it and it is over: she has caught up. With probability p the honest miners mine it and Eva is suddenly two blocks behind, from where she catches up with probability x2. Together:

x=q+p⋅x2.

That is a quadratic equation and it has two solutions, x = 1 and x=qp. The solution equal to one is visible at a glance (q + p = 1); we check the second by substitution:

q+p⋅q2p2=q+q2p=q⋅(p+q)p=qp.

So both satisfy the equation. Which is the right one? When Eva is stronger, qp comes out above one, and a probability cannot exceed one, so x = 1 remains: she catches up for certain. When she is weaker, the solution equal to one would mean that she certainly makes up even a huge deficit, say a million blocks. But whoever loses ground on average almost certainly never recovers from a large deficit. The smaller solution is the only one that shrinks with distance, and so it is the one that applies. We arrive at the formula from Satoshi’s white paper (section 11): Eva, who is z blocks behind and has less power than the honest miners, catches up with them at some point with probability

(qp)z.

The problem is an old one: since the 17th century mathematicians have known it as gambler’s ruin: a gambler who is losing, and playing against a casino in a game stacked against them, tries to get back to zero. In the white paper Satoshi compares the attack to it.

Let us try our two blocks and q = 0.3. Substituting:

(0.30.7)2=(37)2=949≈0.184.

The formula gives 18.4%, the simulation 18.5%: the agreement is excellent.

Every further block of waiting thus multiplies the chance by the fraction qp. With q = 0.3 that is 37: a deficit of one block 42.9%, of two 18.4%, of six only 0.62%. Eva with a tenth of the power is much worse off, because 0.10.9=19: one block 11.1%, two 1.2% and six about 0.0002%. Repeatedly multiplying by the same fraction smaller than one is exponential decay, just in the other direction.

A graph of the chance that Eva makes up a deficit of z blocks, for z from 0 to 10. The vertical axis is logarithmic: 100%, 10%, 1%, 0.1%, 0.01% and 0.001%, each step down is a chance ten times smaller. Four straight lines fall from 100%: orange for q = 45% almost horizontally to 13%, red for q = 30% to 0.02%, blue for q = 20% and green for q = 10% steeply, the green one leaving the graph already at five blocks. A grey dashed horizontal line marks 0.1% A graph of the chance that Eva makes up a deficit of z blocks, for z from 0 to 10. The vertical axis is logarithmic: 100%, 10%, 1%, 0.1%, 0.01% and 0.001%, each step down is a chance ten times smaller. Four straight lines fall from 100%: orange for q = 45% almost horizontally to 13%, red for q = 30% to 0.02%, blue for q = 20% and green for q = 10% steeply, the green one leaving the graph already at five blocks. A grey dashed horizontal line marks 0.1%

On the vertical axis of the graph each step is ten times smaller than the one above it, and that is why repeated multiplication gives straight lines. The steeper the line, the faster waiting finishes Eva off. For Eva with 45% the line is almost horizontal: even after ten blocks her chance is still above 13%.

But do not be misled by the name: “51% attack” does not mean that someone with 49% is harmless. With 49%, Eva’s chance of making up six blocks is (49/51)6, about 79%. The 50% threshold merely separates “catches up for certain” from “may catch up”.

Why six confirmations

Our formula has one simplification. It assumes that at the moment Adam hands over the car, Eva is behind by all z blocks. But Eva does not sit idle. While the honest miners were adding blocks above the payment to Adam, she was mining too: with thirty per cent of the power, she has finished about two and a half blocks of her own for every six honest ones, on average. So she is not behind by six but more like three or four, and with luck she may already be ahead.

Satoshi accounted for this in the same section of the white paper: he allowed for the possibility that Eva had secretly mined a few extra blocks in the meantime, and used our formula for each possibility. The table shows, in per cent, the probability that Eva succeeds:

Eva has 6 confirmations, simplified 6 confirmations, Satoshi confirmations for a chance below 0.1%
10% 0.0002% 0.02% 5
20% 0.02% 1.4% 11
30% 0.6% 13% 24
45% 30% 77% 340

The last column is taken from the table in the white paper, and we recalculated the others using Satoshi’s method. The difference is greatest for a strong Eva.

This gave rise to the habit of six confirmations, roughly an hour of waiting. There is nothing special about six. It comes from the idea that nobody will have more than a tenth of the network’s power and that a risk below a tenth of a per cent is acceptable. According to the table five confirmations would do, and the sixth is a reserve. The original Bitcoin program showed a payment as unconfirmed until there were six blocks above it, and the habit stuck.

And if Adam had handed over the car right after the first confirmation, Eva with a tenth of the power would have, by Satoshi’s calculation, a chance of about 20%, not 11% as the simplified formula says. One confirmation is too few for a larger amount.

What an attacker with a majority can and cannot do

Let us assume the worst: Eva has the majority of the power, and for a long time. What can she do with it?

She can spend her own coins twice, as with Adam. She can censor: blocks with payments she dislikes can be thrown out, because her chain will always be the longer one. And she can win almost all the blocks, which takes the reward away from the other miners.

She cannot steal other people’s coins. A payment from somebody else’s address needs a signature with the owner’s private key, the secret number without which other people’s coins cannot be spent. Eva does not have it, however much power she has. Every node rejects a block with a payment without a valid signature, even if a hundred more blocks stood on top of it. She cannot create bitcoins out of nothing either, or raise the block reward: the nodes check the rules in every block, not just the length of the chain.

Satoshi summed it up tersely in the white paper: an attacker can only try to change one of their own payments, to take back money they recently spent. A 51% attack is therefore not “breaking Bitcoin”. It breaks no maths and never gets at the signatures or the hashes. It merely exploits the longest-chain rule.

How much an attack on Bitcoin would cost

As of December 2026 the whole Bitcoin network computes around 0.97 · 1021 hashes per second. For Eva to have more than half, she has to add more power on her own than the entire rest of the network has put together. One current mining machine, for instance the Antminer S21 XP from Bitmain from 2024, manages by the manufacturer’s figures 270 trillion hashes per second and draws 3,645 watts. We work out how many of them would be needed:

0.97⋅1021270⋅1012≈3.6⋅106.

Eva would need about 3.6 million such machines. Together they would draw

3.6⋅106⋅3645W≈13⋅109 W,

about 13 gigawatts. A large nuclear power station has an output of roughly 2,000 megawatts, so Eva would need the electricity of about six of them, and on top of that millions of machines. Borrowing that much power is not possible.

There is a catch, though. Miners band together in pools, which combine their power and share out the reward. In the month up to 5 December 2026 the two largest pools together found about 46% of the blocks (according to mempool.space). But they are organisers rather than owners: the machines belong to thousands of miners, and they can leave a pool that began to cheat whenever they like. Satoshi puts it in the white paper (section 6) this way: for a greedy attacker with a majority of the power it should be more profitable to play by the rules than to undermine the system and with it the value of their own holdings.

For small cryptocurrencies the picture is different. They have so little power that an attacker can get hold of it for a few hours, for instance by renting machines that otherwise mine another currency with the same kind of computation. 51% attacks have really happened there. On Ethereum Classic there were, by its own blog, two attacks in January 2019 and three in August 2020. In May 2018 someone attacked Bitcoin Gold after taking control of more than half of its power, and robbed exchanges by double spending. Further attacks on that network came in January 2020. The victims were mainly exchanges, because they credit deposits automatically and the attacker has time to withdraw the money before anyone notices the fraud. A 51% attack on Bitcoin itself has never taken place as of December 2026.

What about proof of stake

Some networks, Ethereum for example, have moved away from mining. What decides who adds the next block there is not computing power but the amount of coins a participant locks up as a deposit and stands to lose if they cheat. An attacker would then need the majority of the locked-up coins instead of the majority of the machines; how that works is covered in the part on Ethereum.

See also

Chapters: Bitcoin: what it is and how it works, The Bitcoin halving: why there are only 21 million bitcoins, Bitcoin mining: how proof of work works, Blockchain and the Merkle tree: how it works and why history cannot be rewritten, The Bitcoin address, private key and signature, Seed phrase: why nobody can guess the 12 words of a wallet, Ethereum: smart contracts and proof of stake, Is Bitcoin secure? What its cryptography rests on, The 51% attack: can Bitcoin be spent twice?, Quantum computers and Bitcoin: what if elliptic curves fell, Bitcoin and SHA-256: what if the hash function fell, Post-quantum Bitcoin: how Bitcoin would defend itself against quantum computers