The mechanics of Bitcoin- Blocks, chains and double-spending

Blog 6

Dr. Neeraj Oak continues his examination of why Bitcoin is designed the way it is. In this post, he looks at the concept of blocks and block chains, and why these security features stop fraudsters from spending the same money twice.

Let’s look at another major design feature of Bitcoin- the ‘blockchain’. Why did the designers opt to use this mechanism?

When a user makes a payment to another Bitcoin wallet, the transaction is not immediately executed. Instead, it is put together with many others into what is known as a block, ready to be processed. Processing a block involves verifying that all the transactions within it are valid and consistent, and that no Bitcoins have been spent twice.

Double-spending is a potentially fatal problem for a cryptocurrency; what stops someone from spending the same money twice? Ordinarily, the first person to be promised money should be entitled to it, but if nobody is tracking the history of promises, it is possible to promise the same money to two people, and then indefinitely defer payments by pointing to conflicting transactions in the ledger.

Once a block has been successfully processed or mined, the person who mined it announces the solution of the block. ‘Solving’ a block involves deciphering a mathematical problem that is partly a function of all the transactions in the block, but also contains a random element. This means that the miner must perform a lot of computational work to properly process it. But the beauty of the system is that, once processed, it is easy for someone else to verify that a solution is correct. A good analogy would be trying to open a combination lock. You might successfully guess the combination on your first try, or it might take you all day. But once you know the combination, you can tell someone else, and all they would have to do to check if your combination is correct is to try it on the lock and see if it opens. As such, finding a solution is far harder than checking it.

clip_image002clip_image004clip_image006

If a block is solved, it is placed after a previous block in chronological order; this is called a chain. In the rare situation that two people solve the same block simultaneously (but with different solutions- remember that the problem is partly random), both blocks are initially considered to be valid but parallel solutions. The tie is broken when someone solves the next block, which is necessarily built upon the solution of one of the previous blocks. It is even more unlikely that two people will solve this next block simultaneously for each of the parallel block chains, but if this happens, both continue in parallel until a block is solved for one but not the other. At this point, the longer chain always wins, and the parallel track is discarded. The discarded blocks are said to be orphaned.

The block chain method is a fairly efficient way of solving the double spend problem and spotting fraudulent transactions, but it also has one more feature that helps it frustrate potential attackers.

If someone was very keen on putting through a fraudulent transaction, what stops them from falsifying an entire block in order to cover their tracks? Firstly, it’s a great deal of work, but the system also rather cleverly pits such attackers against the entire mining community in a race they are bound to lose. To see how this works, let’s imagine the attacker wants to falsify a transaction that happened a few blocks ago. The attacker would have to not only falsify the block that transaction’s block, but every subsequent block, as his version of history will only be accepted if it is the longest block chain. The problem is, other miners are solving blocks at the same time, so the attacker would need to solve blocks faster than every other miner put together in order to eventually overtake the size of the largest block chain. This is the equivalent of a 51% attack, and as we’ve seen earlier, this is usually more expensive to perform than the rewards it yields.

Join me for my next post, in which I consider why the designers of Bitcoin chose to reward the people who verify transactions with ‘mined’ Bitcoins.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.