BitcoinCrypto Learnings

Accidental Fork in Bitcoin Chain

Accidental Forks in Bitcoin Chain

In this chapter, we learn what is known as ‘Accidental Forks’ in bitcoin chain!

In our last lesson in Cryptoinstitution, we learned what is ‘Proof of Work’ in bitcoin chain and the importance of hash function in the bitcoin network.

Taking, a step further let’s hop onto this next chapter known as ‘Accidental Fork’ in bitcoin blockchain.

Miners Confirm Transactions

Any bitcoin transaction can be deemed as ‘successful’ or ‘confirmed’; only after miners provide confirmation on that transaction. How do miners confirm transactions? As seen earlier, miners verify that bitcoins used for that transactions have not been previously used, by a mechanism of ‘Proof of Work’. Transaction becomes legitimate after miners provide confirmation to it.

Two Transactions in Bitcoin Chain?

Hypothetically, let’s say Aman wants to buy coffee from a coffee shop, which accepts bitcoin payments. For this, Aman broadcasts a transaction message and shows it to the coffee shop owner. Now ideally this transaction is complete after the BTC are transferred to coffee owner’s wallet. However, the owner does not wait for this small amount. He views the transaction message that Aman sent to network and hands Aman his coffee. But what if Aman actually sent 2 transactions: One to the coffee shop owner’s wallet and other to himself at a different address?

Note: It is possible to store your bitcoins in as many wallets as you want. Hence, you can have more than one public key for each corresponding wallet. So, it is possible to store bitcoins (or your private keys) in different wallets by one person.

Accidental Fork in Bitcoin

Occasionally, more than one block is added to the bitcoin chain by miners at the same time. This creates an accidental fork in the chain. In this instance, nodes will always consider working with the largest chain. The shortest chain is abandoned. However, this does not imply that this abandoned block is invalid/discarded. Or that the transactions on the blocks are discarded. Instead, all transactions of that block are shunted back to mempool and verifications for these transactions will be carried out again.

Accidental Fork in Bitcoin Chain

Coming back to our question: What if Aman actually sent 2 transactions: One to the coffee shop owner’s wallet and other to himself at a different address? Supposedly, out of these two, the transaction of Aman sending these BTC to himself is the first one to be verified. Then the other transaction of Aman sending his BTC to the coffee shop will automatically be deemed as invalid. As these BTC have already been spent by Aman, by bitcoin protocol, he cannot spend it again. This way, Aman will get his coffee for free.

Note: It is recommended to wait for at least six blocks (approximately one hour as it takes 10 minutes to add one block), before considering the transaction complete.

2 thoughts on “Accidental Fork in Bitcoin Chain

Leave a Reply

Your email address will not be published. Required fields are marked *