What does double-spending exactly mean, and how does a blockchain deal with this possible leakage? It could affect any blockchain or cryptocurrency and has specifically involved both Ethereum and Ethereum Classic in the past. Let us understand it using the example of Bitcoin, the most popular of all blockchains.
What is double-spending?
Double spending refers to an incident when a person deliberately spends a unit of a cryptocurrency more than once, creating a disparity between the spending record and the amount of cryptocurrency available. In some cases, they may manage to reverse the transaction after getting the delivery of goods/services and use the same unit of currency for another transaction.
What happens under the hood?
When a person transacts on a blockchain, the system broadcasts the message to all nodes to confirm the transaction. For double-spending, they manage to copy the transaction and rebroadcast it (spend it twice) before it is confirmed.
Unscrupulous users and, in many cases, hackers somehow get hold of the transaction and attempt to spend it before confirmation. In smaller blockchains, they might manage to get control of validator nodes, ‘erase’ the transaction by orphaning the confirmation block and creating a new chain of blocks containing the false transaction.
Bitcoin’s blockchain implements a consensus mechanism known as proof-of-work (PoW) to prevent the problem of double-spend. The mechanism is executed by a decentralized network of miners who are responsible for securing the fidelity of the past transactions on the blockchain’s ledger.
PoW is designed to make the cost of reversing a transaction simply too high to discourage any such attempt. You know that PoW miners require special equipment such as ASIC machines and huge amounts of electricity. Anyone who tries to reverse a blockchain will have to arrange for the equipment and pay for the electricity to ‘overpower’ honest miners. Given the huge number of miners in a decentralized ecosystem like Bitcoin, it is simply not going to happen.
Double-spending is thus effectively prevented in Bitcoin.