It is stated in the Bitcoin whitepaper that "The incentive may help encourage nodes to stay honest. If a greedy attacker is able to assemble more CPU power than all the honest nodes, he would have to choose between using it to defraud people by stealing back his payments, or using it to generate new coins. He ought to find it more profitable to play by the rules, such rules that favour him with more new coins than everyone else combined, than to undermine the system and the validity of his own wealth."
I want to know the explanation what can an attacker gain if he has more than 50% computing power and how it is outweighed by what he can gain if he plays by the rules.
Thanks in advance for the clarification.
The whitepaper was written at the time there was only cpu mining. At that time, if you had more than 51% of the network's cpu power, you had more than 51% of the networks hashrate (depending on your setup and the feature set of the cpu's).
Having more than 51% of the network's hashrate allows you to, statistically, find more blocks by yourself than all other miners pooled together. This would allow you to rewrite the last couple of blocks leaving out transactions that do no benefit you and still end up with the longest chain (the chain that required the most work).
Nowadays, you can no longer mine using your cpu/gpu (well, you *can* technically mine using cpu/gpu, but the odds of solving even a single share are extremely small, so for all practical implications, it's impossible to mine with a cpu/gpu), so the nodes no longer mine.
The theory is still valid tough: if you would own more than 51% of the network's hashrate, you could still do a 51% attack... However, nowadays, you could only gain 51% of thet networks hashrate by investing billions into latest gen ASIC's, this makes a 51% attack extremely costly, and since such an attack would probably decrease bitcoin's price, you'd invest billions and get very little in return (since the "stolen" btc would be worth a lot less). If the community ever discovered somebody was executing a 51% attack, they could *potentially* even decide to fork to a different POW algo, making the attacker's ASIC investment "worthless" (he could still use it to mine sha256d altcoins, but it would be way less profitable than mining BTC).