Before inventing Bitcoin, many enthusiasts tried to create a decentralized means of payment, but all of them rested on the inability to prevent double spending within the system. A solution to this problem was found only years later.
What is double spending and how developers solved this problem? Find out in the article below.
Double Spending Problem and Cryptocurrencies
The main problem in creating a stable system of decentralized payments was the ability to copy payment transactions, which causes the risk of re-spending funds. Centralized payment systems prevent the re-transfer of funds by the presence of a monitoring server that checks all transactions using a specific mechanism.
Double spending is a kind of re-spending. Often double spending in decentralized systems happens at the moment when one sender sends the same amount of funds to several recipients in the time interval before the first transaction is included in the block.
Let’s say in real life a person decided to buy a cup of coffee for $1 in a cafe. When paying, the money is transferred to the cash desk of the cafe and it is impossible to spend it again. Digital currencies are distinguished by the fact that they are not physically transferred. So, before the transaction is verified and executed, the funds remain in the wallet. It means that in the interval between sending the transaction and the fact of its completion after verification, a re-payment is possible.
In real life, there may also be a double spend. For example, realtors can repeatedly sell one property. This opportunity is created due to the fact that re-registration for a new owner can take a lot of time, but until the right of ownership is registered to the buyer, the property remains in the possession of the previous owner.
How to Prevent Double Spending
Payment method operating on the blockchain has two systems for preventing double spending:
open transaction register;
special verification mechanism.
Blockchain keeps a chronological registration of all payment registrations and each new block contains information about all previous transactions, starting from the moment of its creation. All transactions are assigned the time of the operation. It helps to find out which of the transactions is the main and which is copied.
For example, the sender wants to make double spending of funds, having 1 BTC on the account. He sends this coin to the first seller and taking advantage of the fact that the funds have not yet been debited, he wants to deceive the second seller and sends him the same coin again.
Both transactions are translated into the pool of unconfirmed transactions and are checked, while only the first transaction will be executed and the second transaction will be considered false because it will not collect the required number of confirmations.
Therefore, the seller sends goods only after receiving confirmation from the network, and not the fact of sending the payment from the buyer. Transactions with 6 confirmations are considered to be safe before double spending.
Double spending of digital coins is possible when the transaction is confirmed and the funds remain in the account of the sender. At the same time, the creation of decentralized payment systems became possible due to the fact that only transactions with more confirmations are recorded in the blocks, and the second branch with repeated spending is recognized as incorrect and rejected.
Nevertheless, the blockchain remains an opportunity to make double spending, but this requires quite high power. Without them, the seller can be deceived only if he sends the goods on payments with no confirmation.