# Proof of work - 51% attack

In the 51% attack on the Proof Of Work Consensus Mechanism, it's often said that you need more hashing power than the rest of the network combined. Though I can't understand why you need that much.

If we break the blockchain network down in Alice, Bob, Charlie and Eve, and they all currently are honest. They all have 1/4 of the total hashing power. From what I understand, they all compete against eachother to calculate the right hash of a block, and the one winning the race gets its block on the blockchain. This happens one time each 10 minutes. Since they're all competing, the hash-power used to create a block in 10 minutes, is 1/4 of the total hashing power.

Now eve decides to go rogue, and builds her own blockchain. The difference is now, that she don't compete with anyone. That means that she can generate a block every 10 minutes (ish) on her private blockchain, keeping up to speed with the rest of the network. Having just a bit more power, she can then build blocks faster than Alice, Bob and Charlie combined, since they are "competing". At some point Eve's blockchain grows larger than the others, and she broadcasts it, and Alice, Bob and Charlie will per the rules switch to Eve's blockchain.

In this scenario the network was compromised by only using 25%(+1) of the hashing power. So why would Eve need 51%? Doesn't she just need to be faster than the fastest honest miner?

Hope you can tell me why I'm wrong.

Since they're all competing, the hash-power used to create a block in 10 minutes, is 1/4 of the total hashing power.

That's not correct.

If the work effort is set to $$n$$, that is, it takes an expected $$2^n$$ hashes before someone finds a valid preimage. If Alice, Bob, Charlie and Eve are all working equally hard, then we would expect that each one would end up computing an average of $$2^n / 4$$ hashes before someone finds a preimage. It might be Alice, who has computed only $$2^n / 4$$ hashes, but still a total of $$2^n$$ hashes were computed.

So, if Eve goes off on her own, she'll need to compute her own $$2^n$$ hashes herself before she finds a preimage; in that time, Alice, Bob and Charlie will end up computing $$3 \cdot 2^n$$ hashes, enough to find an expected 3 links in the hash chain, before Eve can compute one - Eve cannot win this race in the long term.

(Note: this analysis rather assumes that when Alice finds the preimage, she instantly announces it, and the others immediately start searching based for the next preimage. This isn't precisely true; however that isn't nearly a large enough effect to give Eve an advantage when she has only 1/4 of the computing power)

• That is a really good explanation, thank you :) – Benjamin Larsen Apr 19 '19 at 11:48
• But what if Eve decides to go rogue not necessarily now, but simlpe the next time she is able to find a valid preimage unusually fast (say, within $\frac1{100}2^n$ hashes)? This is expected to happen within about 100 rounds, so may be worth waiting for – Hagen von Eitzen Apr 19 '19 at 14:58
• @HagenvonEitzen: however, that doesn't buy her much in the long term - she would get an early start initially, and might be able to find another hash quicker than Alice et al finds two, however in the long term, the greater resources of the honest miners will outrun Eve – poncho Apr 19 '19 at 16:13