Double-spending is a potential problem in which the same digital currency can be spent more than once. This is a flaw that is unique to digital currencies because digital information is something that can be reproduced rather easily. Digital currencies such as Bitcoin, can be thought of as being a digital file. If, for example, Bob has a file that has been saved locally to his computer. There is nothing preventing Bob from simply copying this file as many times as he wants and sharing the file with multiple individuals. This same principle can be applied to digital currencies. It is not ideal for the same digital currency to be spendable more than once, because it can result in inflation and a loss of trust in that currency, making it effectively worthless.
Physical currencies do not have the same double-spending issue that is faced by digital currencies, because everyone involved in the exchange of a physical currency has immediate visual access to that original physical currency. For example, Alice visits her local coffee shop in order to buy a $5 cup of coffee. In purchasing her coffee, Alice hands over a physical $5 bill to the service provider at the shop. The service provider, in accepting Alice’s $5 bill, can instantly and physically confirm that Alice has paid the correct amount for her coffee. Alice cannot now spend that same $5 bill elsewhere to make another purchase.
The prevention of a double-spend can usually be dealt with in one of two ways: centralized or decentralized. With a centralized solution, a central and trusted third party will normally be responsible for verifying that a digital currency has not been double-spent. However, this method is faced with one significant drawback, that being the fact that it leaves behind a single point of failure. A centralized third party can be comprised by a malicious actor, which may then lead to the same digital currency being spent more than once.
A breakthrough in solving the double-spend problem came in the form of Bitcoin. The decentralized nature of Bitcoin meant that the issues concerning the centralized method mentioned above, such as a single point of failure, and having to trust that a third party was correctly preventing double-spends, were no longer present.
Bitcoin uses a consensus mechanism known as proof-of-work to avoid the need for a centralized party. Instead of requiring a trusted third party to verify that transactions are not double-spends, a decentralized group of individuals known as miners perform this task. All Bitcoin transactions are also included in a shared public ledger known as a blockchain, which ensures that it can be proven that any party wishing to spend bitcoins really is in possession of those bitcoins. A transaction is regarded as valid once it has been grouped into a block and included in the blockchain. As more blocks are added to the blockchain, it becomes increasingly more difficult to go back and double-spend a transaction. This is because for a block to be added to the blockchain, a tremendous amount of computational power is required. Thus, going back to a previous block, in order to double-spend a transaction, would require the same enormous amount of computing power to be used.
However, it is theoretically possible in certain instances for a double-spend transaction to occur. One such scenario would be that of a 51% attack, of which an explanation can be found here.