Familiarity with the concept of "Double Spending"

Familiarity with the concept of "Double Spending"

By ... | World of Crypto | 19 May 2020

The phrase "double spending" is a potential problem in digital financial payment systems, in other words, it is the source of where a budget is allocated to the recipient at a single time. But any protocol will be gradually weakened without any reciprocal action if it fails to solve its problem, such as users who have no way to verify their funds if they have been spent elsewhere. Ever since this phenomenon, that is, spending twice as much, entered the digital currency industry, it has become particularly important to ensure that the units we reproduce do not reproduce. Imagine a person named "Alice" can get 10 units and copy them 10 times to increase to 100 units, or the same 10 initial units simultaneously for two users named "Bob" and "Carol". »Send. Therefore, it is clear that the performance of such a system will be damaged. Therefore, in order to apply digital transactions, there must be a mechanism to prevent this phenomenon.

How to avoid spending twice

A) Focused Approach: Definitely easier to implement a centralized path than a decentralized one. This typically includes an observer to manage the system and control the release of units. eCash, a form of electronic liquidity, is a good example of a centralized solution to the problem of double spending. The banking system uses encrypted signatures for users with digital assets backed by cash (with the ability to exchange peer-to-peer and anonymous). As the famous cryptographer David Chaum introduced in a 1982 article, the encrypted signature for unknown or inaccessible payments.

In such a situation, a user (whose name is Dan) if he wants to receive $ 100 in digital money, must first notify the bank, provided that he has a balance sheet, and then make random numbers. Assuming he has created 5 random numbers, each number will receive $ 20. To prevent bank tracking, Dan disrupts random numbers by adding an encrypted factor. He then transfers the data to a bank that owes his account $ 100, and confirms a $ 20 receipt for each of these data. He can now spend the budget issued by the bank.

He goes to Erim Restaurant and orders a meal for $ 40. Dan can remove the encryption factor to reveal the random number of each digital face, which is called a bill, and each bill acts with unique identifiers (very similar to the serial number) for each unit. He published two of these bills he made to buy from Erim, which Erim quickly took to the bank and redeemed to prevent them from being used again by another person. By checking the signature, the bank will find out the validity of everything, and if there is no problem, it will give the Erim account $ 40 credit. The used bills have already been burned and if Erim wants to spend the same amount, more bills will have to be issued. Setting up eCash can be useful for certain transfers, but it always fails in flexibility. An invoice issued by itself is worthless because its value depends solely on the bank's willingness to exchange it for cash. In today's world, customers of any bank must trust the goodwill of the bank to work with their money, and this is exactly the problem that cryptocurrencies are trying to solve.

B) Decentralized approach: It is very difficult to ensure that the budget cannot be spent twice in an ecosystem without supervision. Users must be careful to comply with the rules that prevent fraud and have an honest and equal approach to other users. The biggest innovation in Bitcoin is offering a solution to the problem of double spending. Although no such problem has been mentioned in the past, Satoshi introduced a structure known today as blockchain. A blockchain is actually a database with unique features. By using a dedicated software, network users align their database copies with others, which results in the ability to network audits from the history of all block transactions since its inception. Therefore, with networks such as blockchain, it is very easy to detect and prevent criminal activities such as re-spending transactions.

When a user publishes a transaction, that transaction is not immediately added to the blockchain. It must first be placed in a mine block. In this way, the recipient does not consider the transaction valid until that block joins the blockchain chain, because the sender can still spend the same tokens elsewhere. But once the transaction is approved, the tokens cannot be redeemed because their ownership is assigned to a new user and the entire network can verify this. That is why it is often recommended to wait a few confirmations before accepting a payment. Each block sequence makes a significant effort to correct or rewrite the chain (which may occur during 51% of attacks).

Let's review the restaurant scenario again. Dan goes back to the restaurant and the bitcoin acceptance tag behind the glass catches his eye. Since he liked his last customized meal very much, he asked for it again and it cost 0.005 bitcoin. Erin gives him a public address to send him money. Dan has released a transaction that actually confirms a message that the 0.005 bitcoin that Dan had is now Erin's. Without going into too much detail, anyone can confirm by signing Dan's transaction that he or she actually owns the tokens and therefore has the authority to send them. As mentioned, the transaction is valid if the block is approved. Accepting a transaction without confirmation is similar to accepting a $ 40 ecash previous example. That is, it allows the sender to spend it elsewhere without immediately depositing it in the bank. Therefore, it is recommended that Erin wait at least 6 blocks before approving Dan payment (approximately one hour).

Spending twice on bitcoin

Bitcoins are carefully designed to prevent double-spending attacks. This is expected to happen at least when using this protocol. This means that if people are waiting for a transaction to be confirmed in a block, there is no way to send it again. In other words, it requires a reverse blockchain with a very strong hash rate, which is rare. However, there are a limited number of recurring attacks that have affected people who accept unconfirmed transactions. For example, for low-priced purchases, a transaction may not wait until the transaction is placed in the desired block. For a crowded restaurant, it is incomprehensible that the network wants to spend time on blockchain processing for every purchase. So that business is a good option for double-spending attacks. Someone may order a hamburger and pay for it, then immediately return the same amount to their address. With a higher cost, the new transaction will probably be approved first and then the first transaction will be void.

Three popular ways to spend twice are:

51% Attack: When an entity or organization is able to control more than 50% of the network's hash rate, it allows them to modify or delete transactions. Such attacks are almost impossible for the Bitcoin network, but they have happened for other networks.

Competitive attack: Occurs when an attacker creates two opposing transactions with the same funds. The first transaction is sent to the victim who accepts the payment and sends the product without waiting for initial confirmation. Meanwhile, with a contradictory transaction, it returns the same amount of digital currency to the attacker and validates the first transaction.

Finnish attack: It is possible for a transaction to be pre-extracted in a block and a similar transaction to be created before the block is deployed on the network. It therefore disables the second similar transaction. These attacks require a specific time sequence and depend on the recipient's acceptance of the unconfirmed transaction.

As it turned out, any other transaction, if you wait for the block to be approved, reduces the risk of being exposed to double-spending attacks.


Spending twice allows the user to play a role in the financial benefits of an electronic monetary system and use a certain budget more than once. In general, the lack of a sufficient solution to the problem is in the process of developing any process. Fortunately, however, the use of encrypted signatures provided an interesting solution for centralized financial schemes. Subsequently, the creation of the "proof of work" algorithm and blockchain technology created bitcoin as a powerful form of decentralized money, which in turn inspired thousands of other encryption projects.

How do you rate this article?



World of Crypto
World of Crypto

News about Crypto

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.