Understanding How Blockchain Prevents Double Spending In Bitcoinby@samiranmondal
699 reads
699 reads

Understanding How Blockchain Prevents Double Spending In Bitcoin

by Samiran MondalAugust 17th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Double spending occurs when a person alters a blockchain network to reacquire a cryptocurrency.
featured image - Understanding How Blockchain Prevents Double Spending In Bitcoin
Samiran Mondal HackerNoon profile picture

The cryptocurrency space has been a tremendous game changer since its introduction. From digital money to decentralized finance, innovation has greatly shaped the future of finance. Despite having many benefits, the cryptocurrency market still has a few concerns, including scams, theft, and double-spending.

Earlier last year, Bitcoin tanked by about 15%, falling below the $30,00 mark due to false double spending rumors. The incident involved a user who tried to send an exact amount of bitcoin but failed to attach a sufficient transaction fee. Initially, miners ignored the transaction since there were no adequate funds to confirm the transaction. The user then proceeded to post the transaction again. This time one of the miners decided to accept the transaction. However, simultaneously, a different miner chose to process the original transaction creating what seemed to be a double spend.

What is Doubles Spending?

Double spending is when a person alters a blockchain network to reacquire a cryptocurrency. For instance, when a person makes a digital transaction, they broadcast the transaction to all nodes that need to receive and confirm it.

Double spending occurs in various ways, including the 51% attacks, Finney attacks, and race attacks. In these instances, hackers attempt to control the blockchain network and use the unconfirmed transaction or change the confirmed transactions. During a 51% attack, a bad actor takes control of more than 50% of the computing power, proceeding to modify the network's ledger. In the end, they transfer bitcoin to their digital wallets multiple times as if the original transaction had not occurred.

For double spending to occur, the individual decides to copy the transaction and rebroadcast it (spend it twice) before it is confirmed. Usually, bad actors attempt to exploit the Bitcoin network by slow10 minute block time. During this period, these actors sneak an extra transaction giving the illusion that the original bitcoin amount has not been spent, and remake blocks with fake transaction history to support the desired record.

Also, bad actors can attempt to reserve a transaction after receiving assets or services from counterparties. In turn, they end up keeping both the funds and the assets. To successfully perform this attack, actors send multiple units of data to the network and then reverse the transaction, giving the illusion that it never happens. In other instances, third parties, usually hackers, somehow get a hold of the transaction and try to spend it before it is confirmed. Notably, fiat currencies do not have this problem.

How Blockchain Provides the Solution

Bitcoin on its own cannot stop double-spending. Bitcoin relies on its mother technology, Blockchain, to prevent double spending on its network. Bitcoin posts transactions on Blockchain, where they are separately verified and confirmed. Bitcoin's Blockchain records chronologically time-stamped transactions. These records can be dated back to when bitcoin was first created.

Bitcoin transactions on Blockchain are irreversible. For an individual to double-spend their Bitcoin, they need to go back and reverse all transactions made in the six confirmed blocks that were added after their transaction. This process is deemed impossible unless the person somehow can control the network through the 51% attack.

Notably, the likelihood of a user inserting a secret block into the Blockchain is slim. This is because the new block needs to be accepted and verified by the network miners. Blockchain stops double-spending by recording the first transaction made or the one with the highest number of confirmations. The second transaction is then discarded, thus halting the currency from being spent twice. While this is an effective way to deal with the issue, the process could sometimes lead to bitcoin owners losing their assets to hackers.

Lastly, double spending can be prevented by reorganization. This rare occurrence involves removing recent blocks from the Blockchain if they are no longer part of the longest chain. This occurs after six confirmations have been completed. In this case, all transactions, including the removed block called an orphan block, are returned to the mempool to await confirmation again.