Bitcoin Double Spending – Everything You Need to Know About It
According to the Bitcoin Glossary, a Double Spend is a transaction that uses the same input as an already broadcast transaction.
In simple day to day terms, it means spending the same amount of money twice.
Double spending is a phenomenon that’s not directly related to Bitcoin, but to all digital monetary systems. In fact, Bitcoin is what it is today because it managed to solve the double spending issue, a feat that all other digital monetary systems before it weren’t capable of doing.
Because Bitcoin is a digital currency (it doesn’t have a physical form), the transactions could, at least in theory, be copied and rebroadcast.
How does Bitcoin solve the double spending problem?
To protect itself and its users against this dishonest action, Bitcoin uses a universal ledger called blockchain. The blockchain is somewhat similar to a traditional cash monetary system.
However, Bitcoin’s blockchain keeps a record (on an immutable ledger) of all the transactions that occurred since its launch in 2009. It maintains a unique time-stamped and chronologically-ordered transaction ledger, making the transactions irreversible and nearly impossible to meddle with. This is the main reason why Bitcoin as a cryptocurrency has become viable.
Bitcoin defends against this by confirming which transaction is included in the block first. A block is nothing more than a group of transactions, and it is added to the ledger once every 10 minutes.
A good example of this is if someone sends a sum of BTC to a merchant and then tries to send the same BTC to another Bitcoin address. In this situation, both transactions have the same rank in the network as they are “placed” in the pool of unconfirmed transactions. There are very few chances that the transactions will get pulled from the pool simultaneously.
Even if that happens, only the transaction with the most confirmations will be included in the blockchain and, evidently, the other one will be discarded.
That is why merchants or anybody trading Bitcoin should wait for a minimum of 6 confirmations before being sure that the transaction was added to the blockchain and that it was not a double spend by the sender.
The six confirmations represent the number of blocks containing other transactions (the transaction in question included) that have been added to the blockchain. As mentioned before, all the confirmations and transactions are time-stamped and directly related to the previous ones meaning that they are impossible to tamper with.
What about Double-Spend Attacks?
To conclude, if two transactions are sent in the network using the same private key with the same funds, but to different addresses, only the one that is first included in a block will be added to the blockchain.
For an attacker to be able to spend the same amount of BTC twice, he or she would have to basically tamper with all six blocks with confirmed transactions, a feat that is pretty close to impossible considering Bitcoin’s decentralized nature.
In theory, there are two types of attacks that could happen: a 51% attack and a race attack.
This type of attack implies that the attacker can capture 51% of the hash power of the network. Up to this point in time, no such attack has occurred mainly because the Bitcoin network is so huge that controlling more than half of the network would be extremely cost intensive.
As previously discussed, if an attacker were to swiftly send the same amount of BTC to two different addresses, this would result in only one of them being included in the blockchain. However, if the merchant doesn’t wait for the confirmations of payment (the creation of the six blocks), it risks not getting the money.
Before the minimum number of 6 confirmations, the attacker could very well send the same coins again back to his/her address. Therefore, if the attacker gets the six confirmations before the merchant, the other transactions will be discarded.
We hope this guide helped you gain a bit more knowledge about one of the fundamental aspects that make Bitcoin the thriving and incredible cryptocurrency it is today.