A cryptocurrency can only be successful if they have solved the double-spending problem. This problem is a crucial challenge for any digital currency. If not dealt with effectively, it compromises integrity. In this article, we briefly explain what the double-spending problem is, and how it is solved.

What is double-spending and why is it a problem?

Double-spending means that the same amount of currency could be spent twice.

This is impossible with physical money: if I have a single €50 note, I cannot pay my neighbor and my cousin €50. For online banking, banks or other third parties usually check that money is sent and received properly.

For crypto, this is a bit more complicated. Put simply: I have exactly 0.1 BTC, and I promise to pay both my neighbor and my cousin 0.1 BTC. If that were to succeed, it would cause uncontrolled inflation and seriously damage trust in the system. Instead, the blockchain should be a database of all transactions ever, and all data should be immutable. These are core values or principles on which the first-ever blockchain was built.

Double-spending attacks

Sometimes, there will be attempts to abuse the blockchain through double-spending. One of the possible types of attack is a "race attack". In this case, a hacker sends two transactions in quick succession, after which only one is confirmed on the blockchain. The hacker then hopes to purchase something with an unconfirmed transaction and invalidate it before it does get confirmed. This only works if the recipient of the crypto accepts unconfirmed payments.

A Finney attack, which can only be done by miners on a Proof-of-Work blockchain, is also only possible if the recipient still accepts unconfirmed payments. So, not accepting unconfirmed payments solves a lot.

In theory, a malicious actor could also perform a double-spend attack if they control more than 50% of the total hashing power of the network. This is what we call a 51% attack. Due to the size of the Bitcoin network, the chances of this happening are near zero. For smaller blockchains, however, this is a realistic risk.

How is double-spending avoided?

As described above, it is quite difficult to perform a double-spending attack, especially with a large blockchain like Bitcoin's.

When a new block is created on the blockchain, it receives a "hash" containing a timestamp, information from the previous block in the chain, and the transactions it contains. The information in this block is verified and then confirmed. This information can now be accessed forever on the public ledger. And, this data is immutable.

The chance that a malicious person can inject a "wrong" block into the blockchain is extremely small because each new block has to be validated and accepted by the network. And this happens very quickly. So the wrong block will almost always be "too late".

Multiple confirmations

The fact that most parties such as exchanges wait for multiple confirmations further reduces the risk that someone could abuse double-spending.

For example, for Bitcoin, the norm is to have 2 to 6 confirmations (number of mined blocks) before it is accepted on a platform. So in the meantime, potentially incorrect transactions are not yet considered final.

The reason for this is that, by pure coincidence, two different miners may mine a block simultaneously, and each add one of the double-spend transactions in their block. Each of the blocks then has one confirmation and so the blockchain temporarily diverges. The system automatically fixes this when one of the chains creates a new block, by choosing the longest chain as the "main chain". At that point, the blocks of the other chain are undone: this is called orphaned blocks. Its transactions are placed back in the mempool for re-evaluation. The chances of two miners mining a new block at exactly the same time several times in a row are astronomically small.

Byzantine Fault Tolerance

With Byzantine Fault Tolerance (BFT) in a cryptocurrency's protocol, double-spending is further prevented. BFT means that a system must keep working even if there are a few kinks in the cable. So if a few computers in the network behave maliciously or faulty, the system should simply continue to be functional without them. This is crucial to ensure data integrity.

Conclusion

The double-spending problem is one of the biggest challenges within the world of cryptocurrency. For smaller blockchains, this problem is greater than for established blockchains such as Bitcoin. By using blockchain technology, cryptography, and Byzantine Fault Tolerance, cryptocurrencies can make double-spending near impossible. This helps the integrity and reliability of crypto.

The information provided in our articles is intended solely for general informational purposes and does not constitute (financial) advice.

Subscribe to our newsletter

Everything you need to know about crypto, straight to your inbox. Subscribe now for the latest from Blockrise.