-By Milly Bitcoin – October 27, 2013.
The Bitcoin “Blockchain” is the database of Bitcoin transactions. It is basically a ledger and all Bitcoin balances can be obtained from it. A section is added to the database about every 10 minutes on average. Each block on the end depends on all the blocks before it so you cannot just insert a new or changed block in the middle. If there is a conflict somewhere on the network, the longest chain with the most work will always “win.”
It is the chain with the most work rather than the number of blocks. As Bitcoin has grown the “difficulty” in finding the blocks increases. The “length” of the chain is measured by how much work it took to find each individual block. In the early days it was easy to find a block and people did it with laptops. A blockchain full of the low-work blocks would not replace the current blockchain even it had more blocks because the total work would be less.
One common scenario is that 2 miners solve a block at almost the same time. Let’s ay it is block number “5.” We now have block “5-A” from one miner and “5-B” from another miner in a different part of the world. There are now 2 different Blockchains floating around the network, both of height 5 and this causes a conflict.
Blockchain-A: Block1 – Block2 – Block3 -Block4-Block5A
Blockchain-B: Block1 – Block2 – Block3 -Block4-Block5B
Now the race begins for Block6 which is how the conflict gets resolved. Some Bitcoin miners will mine Block6 “on top of” Blockchain-A. Others will mine “on top of” Blockchain-B. The first miner to find Block6 resolved the conflict because they will have the longest chain. If they happen to have been mining on Blockchain-B then Block-5A is now “orphaned” and is no longer valid. The miner who found Block-5A will not get the block reward or transaction fees and the transactions will go back into the pool of transactions to be mined.
This system brings up a number of complex issues. For instance, a large miner could try to intentionally “orphan” blocks to get a large transaction fee or to push a smaller mining pool out of business.
A “51% attack” is where one entity creates a longer chain than the rest of the network. This can be used to either create a complex “double spend” in order to steal funds or to simply stall the network to prevent transactions from being processed. There are some estimates of how much a “51% attack” would cost
but these costs are often exaggerated as they depend on retail prices of Bitcoin miners. In reality an attacker would most likely develop their own equipment rather than purchase through retail vendors.