What Is Double Spending?

BeginnerJan 13, 2023
Double Spending contributes to the flock of digital money manipulations.
What Is Double Spending?

In a nutshell, double-spending means using the same fund for two or more transactions. The advent of online payment ensures that authorities put measures in place to prevent this problem from occurring.
The existence of intermediaries in the traditional payment systems between the sender and receiver, such as banks and credit card companies, makes it easy to validate transactions. These third parties are trusted to ensure the sender has enough balance to carry out a transaction, and he/she is not sending two or more transactions that only count as one against his balance.
The absence of an intermediary in cryptocurrency requires that a measure is put in place to prevent such risk that can compromise the system. Bitcoin is the first successful digital currency to come up with this measure through its proof-of-work mechanism.

The Concept of Double Spending

Let us look at an example to further illustrate double-spending. If Janet pays $30 as physical cash for a pair of shoes, she can not spend the same money again because she no longer has it. She has given it to the clerk at the store. To double spend, in her case, means to use the same $30 cash that she gave to the clerk to purchase another item. This is highly unlikely with physical cash.
The challenge when it comes to using digital currencies is how to guard against such a situation where Janet could potentially copy the $30 and spend it again and again. Let us say Janet decides to pay for a pair of shoes using digital currency like Bitcoin. It will take some time for the transaction to be validated. If the clerk accepts the payment before the transaction is confirmed, Janet can decide to send the same fund to her wallet with a higher fee.
The store will become a victim of double-spending if the second transfer made by Janet is accepted and therefore invalidates the one sent in payment for the shoe after she might have left. Accepting an unconfirmed transaction is one of the ways to fall victim to double-spending.

How Double-Spending Is Prevented in Traditional Payment Systems

Double spending is prevented in the traditional payment systems through what is known as ACID database properties. ACID is short for:

1 Atomicity:

This implies that there is no such situation where a user’s balance is unknown as a result of an incomplete transaction. The transaction is either completed, or it fails. In the case of a point-of-sale transaction, the operation either fails and shows a message on the point-of-sale machine, or it goes through and prints a receipt.

2 Consistency:

Consistency guarantees that transactions happen one after another correctly and that the state of your account will be valid after a transaction. Consistency always ensures the correct balance after a debited amount on your account.

3 Isolation:

Isolation means transactions must be treated one after the other, even if you have many transactions going through at once. The system must leave the account valid as if the multiple transactions happen one after the other. Isolation means that one transaction is treated separately from other system activity. Once you have completed the transaction, it leaves your account in the correct state.

4 Durability:

Durability is the property that the database should be indestructible. Hence, it should not be possible to tamper with the results of transactions for as long as the system is in production mode. It means the databases must be protected against data loss, compromise, or other dangers.

Double Spending in Cryptocurrency

The blockchain, which is the technology behind cryptocurrencies, records transactions in a decentralized ledger and works on collective consensus among participants. This technology creates a safe and strong means of storing and recording information and digital transactions. The unique feature of the blockchain is that it involves interconnected devices or computers without a central server, albeit no single computer finalizes processes or transactions. This system allows for checks and balances, cross-validating records, and ensuring no one can single-handedly reverse transactions to double spend. Guarding against the duplication of a particular unit of cryptocurrency is crucial to sustaining the trust and viability of the system.

Since digital currencies run on computer codes, the information may be relatively easy to copy and duplicate by unscrupulous individuals with the technical knowledge of the network.
Double spending in crypto is when the network is disrupted and the fund is effectively stolen. The perpetrator will send a copy of the transaction to make it appear genuine or even delete the transaction entirely to make it appear as if it had never happened.

Without appropriate mechanisms to prevent such a problem, the entire transaction will be fundamentally destabilized and undermined. It would, therefore, mean that there is no protocol in place to ensure that the funds received are not being spent elsewhere. As a result, strict mechanisms preventing this type of behaviour are required for a digital currency to function reliably.

How Double spending is Prevented in Cryptocurrency

The problem of double spending in the blockchain is often illustrated using the analogy of ‘The Problem of the Byzantine Generals’. This analogy points to the difficulty many parties face when they do not trust each other and must participate in a joint venture that requires cooperation to succeed. It explains how disagreement occurs in a decentralized system.

In the problem of Byzantine Generals, victory is achieved when all generals lead a coordinated attack with their armies. However, if a general fails or attacks another general, the entire battle, like a blockchain, is jeopardized and eventually lost. This conundrum gave rise to the principle that cryptocurrencies’ protocols must include Byzantine Fault Tolerance (BFT).

The fault tolerance in the case of the blockchain means that a network must continue to function satisfactorily in the face of errors, breakdowns, or participants acting contrary to the designated plans. Blockchain technology prevents double-spending through peer-to-peer file-sharing technology, coupled with public-key cryptography.

Transactions in most blockchains are openly recorded and secured at the same time on thousands of nodes around the world. All participants are able to see them and verify transactions that have already been concluded. The verification process depends on the consensus mechanism. In the case of Bitcoin, the consensus algorithm, known as Proof of Work (PoW), warrants that miners can only validate a new block of transactions if all network nodes mutually agree on the correctness of the block hash provided by the miner.

Double Spending Attack (51% attack)

Despite the measures in blockchain to prevent double-spending, such an attack is still a possibility even though the chances are low. One of the ways double-spending attacks can occur is through what is known as Majority Attack or 51% attack. This attack occurs when a single individual or organization controls the majority of the hash rate, potentially disrupting the network. When this occurs, the so-called ‘attacker’ gains enough mining power to intentionally omit or alter the sequence in which transactions are carried out. In the case of a 51 percent attack, the attacker may reverse transactions made during this time, resulting in double-spending. An instance of this is the attack on Bitcoin Gold, a fork of Bitcoin in 2018 and 2020.


Source: Atomic Wallet

Conclusion

Double spending means using the same fund two times or more. It takes place when a payment system is compromised, allowing such dubious transactions. Traditional payment systems utilize atomic, consistency, isolation, and durable database properties to guard against double-spending.
The first successful digital currency, Bitcoin, was able to survive because it incorporates these properties too, allowing the network to be trusted. However, there is a slim chance of a majority attack because it requires a huge cost in terms of computing power to achieve blockchains using the proof-of-work mechanism. In the case of the blockchains using proof-of-stake, the risk involves losing the collateral deposit required for network validation.

作者: Mayowa
译者: Yuanyuan
文章审校: Matheus, Hugo, Joyce, Ashley
* 投资有风险,入市须谨慎。本文不作为Gate.io提供的投资理财建议或其他任何类型的建议。
* 在未提及Gate.io的情况下,复制、传播或抄袭本文将违反《版权法》,Gate.io有权追究其法律责任。
即刻开始交易
注册并交易即可获得
$100
和价值
$5500
理财体验金奖励!
立即注册