Blockchain Double Spending Guide: How Bitcoin Solved the Riddle of the Unique Digital Money
The Problem of Double Spending: How did Bitcoin Solve it?
The idea of digital money has been around for a long period of time now, and it did not originate 10 years ago when Bitcoin first emerged. However, all previous attempts to come up with a product that we now know as cryptocurrencies have failed for one simple reason — double spending.
What Is Double Spending?
The name pretty much says it all, and double spending is the act of spending the same money twice. This is an issue that is crypto-specific, and it cannot affect traditional, physical money. Once you spend your physical money, it leaves your possession, and you simply can't use it again at another place, because you don't have it.
With digital currencies, the situation is different, as they are much easier to replicate and spend twice. This is one of the first issues that needed to be addressed by anyone who wanted to create a digital currency, and Satoshi Nakamoto, Bitcoin's creator, came up with a solution.
The Solution to Double Spending
To deal with the problem, Nakamoto employed a concept of a shared public ledger, which we now know as blockchain technology. This idea has been around for a while as well, but it only came to the realization in 2009, in pair with Bitcoin itself.
The process is rather simple — Bitcoin holder makes a transaction that is grouped with other transactions made by other people. This group is called a block, and in order to ensure that the merchant will get his money, as well as that double spending will not occur, transactions grouped in a block need to be verified.
One option to do this would be to have a centralized third party which would be able to conduct verifications, but if this were the case, they would be a liability, as any attack that manages to take down the service would have large consequences on the entire crypto monetary system.
Another option, which Bitcoin choose to employ, is to have a large group of individuals who would contribute to solving blocks (verifying transactions) separately, in exchange for rewards. That way, even if several of them fall victim to a hacking attack, the rest can still complete the process. After transactions are verified, they get stored onto the blockchain, which serves as a confirmation that the merchant is actually getting paid, and that the customers' coin is truly spent.
What if Someone Makes two Transactions at Once?
This possibility exists as well, and if someone were to make two transactions while using the same funds, the transaction that gets solved and stored first would be considered the valid one. In the meanwhile, the second one will not go through, and the merchant will not receive the funds. Considering that this might be damaging to the merchant, it is highly advisable that they do not ship their product until several blocks are solved (each one is created within 10 minutes).
Because of this, merchants are advised to wait for about an hour, so that 6 blocks can be solved. At this point, the merchant will know with certainty whether they are getting paid or scammed, and they can proceed according to the situation. Meanwhile, the customer has no way of going back and reversing the transaction, as doing so would take huge amounts of resources, knowledge, and control over the blockchain, which no single individual has.
Is Double-Spending Still Possible?
Unfortunately, there is a theoretical possibility of conducting a double-spend attack and managing to spend the same money twice. However, while possible in theory, this is extremely difficult to actually do, and there are no known cases of anyone ever pulling it off. There are several scenarios in which this might happen, however, as stated, this can only be pulled off in theory.
1. Race Attack
The first method is called race attack, and it occurs to those who accept BTC and other coins in exchange for goods at services. However, in order for this to happen, the merchants have to give up their goods immediately, without waiting for other confirmed blocks to appear on the blockchain. The scammer might use two transactions at the same time, and if the merchant decides not to wait for a confirmation, it is possible that the payment sent to someone else will be processed first.
2. Finney Attack
This type of attack is pretty similar to the race attack, except it is done by a miner who decides to try and scam a merchant. For example, if a miner owns two addresses, and one of them has Bitcoin, they might send BTC from one of their addresses to another. Then, they mine the block, but they do not broadcast the results, and so the transaction remains in a type of “limbo.” At this point, they might scam a merchant that chooses not to wait for additional blocks to be solved, and gives up their goods and services after receiving a double payment.
This is when the miner broadcasts the block which contains their original transaction, the one they sent to themselves. In this case, the transaction sent to the merchant would be solved by someone else, and it would not be valid since the same money is already sent to the miner's second address.
3. 51% attack
The third and final form of attack is a 51% attack, which can only be done by someone who gains control of more than half of the blockchain network's hash rate. This is also extremely difficult to pull off in theory, as no one has enough resources and computing power to compete with large groups of real miners who are doing their job.
In this scenario, they might make a private fork of the blockchain and make it seem like the dominant chain because it will get faster due to more blocks appearing as a result of higher hash rate. That way, they can trick merchants into thinking that the funds they received were not previously spent, while in reality, the attacker is performing a double-spend attack.