I recently was thinking about the 51% attack and about full node.
Everybody, who e.g. uses Bitcoin Core has a full copy of the Blockchain on his PC. When I got the 51% attack right, it means that somebody has that much hashing power, so he could overrule the actual blockchain by making a longer chain(proof of work means, that the longest chain is true).
I was wondering:
What happens to all the local blockchains, when that happens? Do the blocks, that differ from the winning blockchain get deleted and replaced with the new ones? Can Bitcoin Core delete already downloaded blocks?
Good question, and I suspect that yes, the way the program is written, every time you connect to the internet the Bitcoin Core will automatically 'synch up' with the most recent blockchain, and if that blockchain is compromised, the old, 'real' blockchain will be deleted and/or modified.
BTW, not to change the thread too much, but what's wrong with a 51% attack? Unless the attacker was Al Qaeda, or North Korea, it would make more sense for the attacker to not rock the boat too much, and just slowly steal coins once in a while, but not too much, and post a notice saying: "I will randomly steal 1% of any bitcoin transaction from time to time, but I will not steal 100%, so please, bitcoin user, continue using bitcoin." And then, for PR effect, the 51% attacker can say: "I am taking 1% because I intend to give the money to a worthy charity and/or improve bitcoin, blah blah blah". Right?
You can not steal bitcoin with the 51% attack, you can just double spend(making two transactions with the "same" bitcoins, so, one of the supposed recivers don't get it.
But you reminded me of another question:
Can't you instead of double spending bitcoins, just reverse(/delete) a transaction?
Do the blocks, that differ from the winning blockchain get deleted and replaced with the new ones? Can Bitcoin Core delete already downloaded blocks?
Up to client. Current Bitcoin Core Client keeps these blocks in blk-files. Because there is a possibility to reorganize them back into the mainchain
So, I have a lot of unused blk-files, when I run Bitcoin Core for a while, or do these blk-files get cleaned up, after a while?