1

I am really struggling to understand this thing about the 51% attack. Usually whoever mines a block first wins. My understanding is that mining is like a race. In a race, an athlete does not need to be faster than 50% of all the athletes combined. He just needs to be the fastest.

It's not like the entire network is working together as a single unit to solve the puzzle. They are working as separate entities, so their computational power isn't being added up.

So, if there are miners M1, M2, ...Mn and mining Pools P1, P2, ..Pm in the network with Pi (1<=i<= m) having the highest hash power Hi, I as a dishonest miner (or pool) would need to have a mining power Hx > Hi to eventually mine blocks quicker than than the rest of the network if I were working on a sidechain privately. And when the time is apt, I can broadcast my sidechain which will became the main chain.

I understand my reasoning is flawed somehow, but I don't understand which part and why. Can someone please shed some light on it?

4 Answers 4

1

In a race, an athlete does not need to be faster than 50% of all the athletes combined. He just needs to be the fastest.

Mining is simply not analogous to a race. Racers make progress towards the finish line, with the fastest racer eventually winning. There is no progress in bitcoin mining though: with each attempt (hash) you either find a correct block, or not.

So bitcoin mining is more akin to a dice-rolling game, with a poisson-distributed random chance of success for each attempt. The more hashpower you have, the more attempts you can make per second.

If you want to reliably out-compete the rest of the network (ie, 51% attack), you will need to have more hashpower than the rest of the network (ie, you'll need to control >50% of the total hashpower pointed at the network).

So, if there are miners M1, M2, ...Mn and mining Pools P1, P2, ..Pm in the network with Pi (1<=i<= m) having the highest hash power Hi, I as a dishonest miner (or pool) would need to have a mining power Hx > Hi to eventually mine blocks quicker than than the rest of the network if I were working on a sidechain privately.

In order to 51% attack, Hx > ((H1 + H2 + H3 + ... + Hm) / 2).

Considering only if Hx > Hi is insufficient, since Hi is not the only other entity mining. Any miner with any amount of hashpower can win the next block (with a probability proportional to their share of the hashpower), so you need to consider all miners together in you calculation.

5
  • "Considering only if Hx > Hi is insufficient, since Hi is not the only other entity mining". I understand this when I am competing with the other miners on the original chain. But, would the statement also apply when I am mining on a secret sidechain? For the honest miners, the algorithm works that a block takes 10 minutes on an average to be mined. But, if I am working on a secret sidechain, I could take less than 10 minutes, and I will be the only one working on the sidechain, so I don't need to worry abt others. So, I can build up faster than others? I apologize if I am being thick Oct 10, 2022 at 8:58
  • 1
    Yes, the statement still applies. You can mine on your secret chain, but everyone else will be mining on the public chain, and if they collectively have more hashpower than you, then they will (on average) find more blocks per unit of time than you will on your secret chain. You could take less than ten minutes to find a secret block (or more), but so could they. Its a game of averages, and those averages are contingent upon the proportion of hashpower each miner controls.
    – chytrik
    Oct 10, 2022 at 9:13
  • I still don't get the concept of "collective hashpower". That would have made sense to me if mining was a parallel process. But it's not. As soon as a block is mined, all the work done(on finding that block) by the other miners is discarded. Only 1 miner's work wins..It is the mining power of THAT 1 miner that was eventually harnessed. So, I don't get it. Been reading lots on this, and still remain unclear on it. I guess, I will have to cram this 51% hashing power thing, and forego the quest of actually understanding the WHY of it. At least for now. Thnx for your help and @RedGrittyBrick Oct 10, 2022 at 9:51
  • Only one miner wins any given block, but that win only comes after all the miners have collectively attempted some number of hashes (on average). Failed attempts at finding a block are not 'wasted' work, they are not 'discarded', so to speak. See for example: bitcoin.stackexchange.com/a/113520/63872 , or this great article: grisha.org/blog/2018/01/23/explaining-proof-of-work (perhaps the "Difficulty is intergalactic" and subsequent sections in particular).
    – chytrik
    Oct 10, 2022 at 10:48
  • @chyrik. I think I understand it now. I will try to phrase it as a separate answer to see if I get it correct. Oct 11, 2022 at 13:16
3

My understanding is that mining is like a race.

This is the misunderstanding.

It is more like a sandy beach where someone scattered some small diamonds. The miners rush along the beach repeatedly picking up grains of sand to see if they are worthless quartz or valuable diamond. As soon as one diamond is found the beach is closed and all miners rush to a new beach. There are a fixed number of diamonds on the beach so the more miners, the less chance one miner has. A miner with a huge fleet of $100000 500 hp sand sifting machines has a big advantage over a miner that is one man with a magnifying glass and a pair of tweezers.

2
  • I hear you. My racing analogy was bad. What would be analogous to a miner working on a private sidechain in your each-diamond example? Oct 10, 2022 at 9:04
  • Analogies always break down somewhere. Bitcoin mining is a unique game with unique characteristics. I could apply my imagination to the challenge but the result would be increasingly bizarre. Oct 10, 2022 at 9:09
1

In short, you don't. But in order to have a probability approaching 1 at time infinity, you need 50% + epsilon. There is actually a table of calculations of the chain lenghth vs overtaking probability at the end of the original white paper. Check it out!

0

I read a lot of answers and articles to try to understand it. Thankfully, it was @chytrik's answer that clicked for me.

Going to post my understanding here.

Just for this discussion, say there are 1200 possible hashes. The fastest (also the dishonest one) miner produces 60 hashes per second. Say the others are at 20 hashes per second. Further, let's assume there are a total of 11 miners (including the dishonest/fastest one) in the network.

The dishonest miner working on a secret sidechain alone would need 20 (1200/60) seconds to try out all possible hashes. OTOH, the rest of the honest network is trying 200 (20*10) hashes per second. So, they would need only 6 seconds (1200/200) to try out all hashes.

[Sidenote] This is an oversimplified assumption though because not all of these hashes will be unique. BUT, not all of them would be identical either because one of the parameters (for generating hashes) is timestamp. And timestamps can and will be unique for a number of nodes, because a) not all miners start mining at the exact same moment b) timestamps are picked from the users' machines and can be changed c) in the real world, miners will have separate hashrate which means they will be trying the same nonce at different timestamps, resulting in different hashes.

So, even if all 200 hashes are not unique, many of them will still be unique, and hence even if the number of unique hashes produced by all the miners (even though working independently) might not be 200 (in the above example), they would still be much much more than the lone dishonest miner.

[/Sidenote]

In other words, the chances of one of the hashes produced by the honest miners being the right one are much higher than that of the dishonest miner being right.

For the dishonest miner to try out all the hashes before the rest of the network, they would have to produce more than 200 hashes per second i.e. (<= 200 + x) hashes/sec . With the upgrade in the capacity of the dishonest miner, the collective capacity of the network is 200 (from the 10 honest miners) + (200 + x) from the dishonest miner = 400 + x

50 percent of the network power = (400 + x)/2 = 200 + (x/2) And dishonest miner's hashing power = 200 + x > 200 + x/2 Hence, the term 51% attack

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.