Imagine you have 1$, and you go to a shop buy a candy just by showing this. Now, you go to another shop show this same 1$ and buy another one.
Isn’t that fascinating?
But if that becomes the case, everyone will survive with this technique.
And when that happens, there won’t be any real value linked to money. It will turn to be a piece of paper.
Same was the challenge when the digital currency was introduced initially, even before the bitcoin.
It struggled to tackle the problem of – Double spending
Digital currency is also termed electronic cash, which simply means it doesn’t have physical existence. You have to trust on the sender that specific amount of money got transferred to your account.
For that reason, you wait for your mobile phone to beep. Receiving SMS or email from your bank informing about your account getting credited. This confirmation message allows you to trust on the successful transaction for your payment.
So, without this confirmation mechanism, anyone can bluff and get you cheated through digital payment.
Double spending happens as a result of using the same set of money in more than one transaction.
Suppose you had a delicious food from a restaurant. And you are in a hurry to catch your bus, which will be leaving in some time.
Since you were in haste, while paying the bill through debit card. You failed to notice confirmation of successful transaction & to collect the bill.
Later, when you were on the bus. You realized that your transaction has failed.
Did you felt happy about it?
Because you got your money back.
However, this has led to the loss of restaurant.
When you pay the same money for another thing, it’s said to double spend.
But the matter of concern is, this activity will be considered as fraudulent.
Ideally, in this situation, you should have waited for some time till you receive confirmation about the transaction.
On the other part, the merchant should’ve been cautious enough to ensure confirmation of the transaction.
We know that anonymity is a key feature of Bitcoin. So, it’s nearly impossible to find the sender in case of transaction failure.
Though, Bitcoin is an electronic cash but it manages to solve this issue of double spending.
Bitcoins distinct ability to get irreversible & immutable transaction along with confirmation me
chanism over an open ledger (blockchain) allows it to resist such threats.
How Bitcoin challenges double spending?
You have probably heard how bitcoin is different from other digital cash. Or maybe you’ve heard someone saying bitcoin is one of a kind.
More than likely, though, you don’t really understand how blockchain technology contributes to bitcoin.
So here’s what you need to know.
- During a bitcoin transaction, your transaction enters into the unconfirmed pool of transactions.
- Miner verifies the legitimacy of the transaction and adds it to a block.
- Once the transaction is added, it’s nearly impossible to modify this record in the blockchain.
But there is a possibility of fraudsters manipulating the network to include the transaction which they want.
Let me explain the same with an example –
Suppose I try to double spend 1 btc.
Let’s say I use this 1 btc to transfer to you. This transaction (let’s call it transaction A) goes into the unconfirmed pool (Mempool) waiting for miners to confirm it and add into a block.
Simultaneously, while transaction A was waiting to be confirmed. I send same 1 btc to John (let’s call it transaction B) also goes into the unconfirmed pool of transactions.
This means I sent out the same Bitcoin twice – Once to you and once to John.
When transactions A & B are pulled out of the unconfirmed pool of transactions, they are checked for their validity. As of now, Let’s say transaction A was confirmed (since I have 1 btc) and it is put into a block.
However, that results in the invalidity of transaction B after it gets pulled from mempool. Since I don’t have any bitcoin to spend.
Although miners usually confirm the first transaction they receive, fraudsters can manipulate the network to enter their desired version of the transaction. Which means, there is 50-50 chance for validation of both transaction A & B before the 1st confirmation comes in.
So here’s what you need to do.
Wait for 10-15 minutes till you receive confirmation about the transaction.
Because every 10 minutes a set of transactions are added to the block. And these are stored in every node of the universal ledger (the blockchain).
Ideally, Its recommended for a trader to wait for minimum 6 confirmations.
What would happen if both transactions go simultaneously?
Ahaa!! That’s a tricky situation.
Well, I’m glad you asked.
What if miners pull both the transaction A & B simultaneously for validation? Right!!
In that case, we will have a race between the transactions in 2 different branches of blockchain – first one to get next block of confirmation will be accepted as a valid transaction.
If they reach the next block simultaneously, then they will have another race to successive block and so on, until we have a clear winner.
This is why it is recommended to wait for 6 confirmation because it is very unlikely to have a race through 6 blocks.
Here, “6 confirmation” means 6 blocks each containing a set of a transaction has been added after your transaction. Each set of a block is connected to its previous one through complex mathematical equations. Even a decent hacker need to invest a hell of a lot of hashing power to replace 6 blocks, which won’t be economically feasible (Though no such incident is ever reported).
Each transaction and confirmation have recorded time and date on it. Which makes it irreversible and resistant to any tampering.
So if a trader receives a minimum number of confirmation, he can be sure that the transaction he collected wasn’t double spent.
By receiving 1st confirmation, the risk of double spend decreases dramatically. On paying sufficient transaction fees, you may receive the first transaction within 10 minutes. Because in most cases, the duration of confirmation also depends on transaction fees paid.
Types of Double spending & ways to protect yourself –
- Race attack
When traders and merchants accept payment immediately after a transaction with 0 confirmation, their transaction is prone to reversal.
Now, if you as a trader don’t wait for confirmation of the transaction, you have 50% chance to receive double spend payment.
A fraud can attempt to cheat you by sending a transaction to merchant directly to the merchant and sends an opposite transaction to himself to the rest of the network. It is more probable that network may find the second transaction as genuine and valid.
Possible precautions you as a merchant can take are –
- Impair incoming connections
- Connection to well-connected nodes
- Finney attack
This attack also exposed to trader/merchant who accepts payment on 0 confirmation. But this needs the involvement of a miner with the wrong intention.
This involves some miner hash power.
You know how he can do that?
Suppose the fraud miner generates block occasionally. In each block, he includes his transaction from address A to address B.
Now, when he transfers your payment to your address C with his address A, he doesn’t broadcast his A to B transaction.
For some time, you wait for double spend. Since you didn’t get any such conflicting confirmation, you transfer the goods to him.
And this moment, he broadcasts his transaction which gets precedence over yours.
- Majority attack – 51% attack
Another attack is possible if an attacker captures 51% of hashing power, he/she can make a private blockchain and reverse transaction which everyone else will consider as real.
But so far, no such incident has been recorded because controlling 51% hash power needs huge investment in hardware price, electricity cost, which makes it so much cost intensive.
To draw a conclusion – There are no cases of double spending to date and I don’t think anything as such will happen because of the unreasonable cost associated with it. But being cryptocurrency enthusiasts and investor, we should be aware of technical know-how of bitcoin and blockchain.
I hope this information on double-spending helps you with bitcoin safety.
Let me know your feedback and thoughts in the comment section below.
Don’t forget to share this post with your friends and family on facebook and twitter.