Double spending happens when the same funds are spent on two recipients at the same time within a digital cash system. A system that cannot rectify this issue is undermined since there is no way of verifying that the funds they receive have not already been spent elsewhere. With digital cash, it is vital to ensure that specific units are not duplicated.
Bitcoin requires all transactions to be included in the blockchain because this makes sure that the party spending the coins owns them and prevents double-counting among other fraudulent moves.
This problem can be tackled in two ways, centralized and decentralized approaches. A central and trusted third party is responsible for ensuring that a coin has not been double spent. The issue with this approach is that it leaves a single point of failure because a centralized third party may easily be compromised.
The solution in double-spending came about through Bitcoin. Its decentralized nature got rid of a single point of failure. Bitcoin’s consensus mechanism through Proof of Work does not need a centralized party. Rather than having a trusted third party verify transactions; a decentralized group of miners does this task. Furthermore, all Bitcoin transactions are contained in a public ledger called the blockchain, making sure that any person spending the coins owns them.
Attacks used in Double-spending
This can happen to guys who accept payment for goods or services with zero block confirmations on the transaction. Anyone can send two conflicting transactions with the same funds in quick succession on the network, but only one gets confirmed. The aim is to invalidate the payment by validating only the transaction that benefits him.
This can happen when payment for goods and services is accepted at 0 block confirmations. A miner may have already mined a block but not yet broadcast to the rest of the network. He then sends the same coins in another transaction and broadcasts his initially mined block, invalidating the payment.
This is also referred to as the majority attack, and it can happen when one controls more than half of a network’s hash rate. Since the attacker can generate blocks quicker than the rest of the network, they can mine a private fork of the blockchain to the point that it becomes longer than the blockchain built by the honest miners.
In a nutshell, the blockchain prevents double-spending by timestamping clusters of transactions and then broadcasting them to all the nodes within the Bitcoin network. This makes the transactions irreversible and tamper-proof.
Double spending allows one to fool the digital cash system for financial gain by using the same funds twice. In the past, the inadequate solution to the problem was a barrier to progress in the field. Bitcoin was the first invention to solve the double-spending issue.
Hackers have always tried to get around the Bitcoin verification system through double-spending but with little success. As a matter of fact, Bitcoin thefts so far have not been through double-spending but by guys storing their coins without proper security measures.