What is Double Spending ?

Last updated on March 18th, 2015 at 10:43 am

Since Bitcoin is basically a digital file it’s easier to duplicate than actual money – this means some people can manipulate their way to paying more than once with the same bitcoin. This is what is known as “double spending”…so how can this be avoided ?

Let’s say I have only 1 Bitcoin and I decide to send it to you. This transaction (let’s call it transaction A) goes into the unconfirmed transactions pool and is waiting to be confirmed.

At the same time I send 1 Bitcoin to Bob, this transaction (let’s call it transaction B) also goes into the unconfirmed transactions pool. So I sent out one Bitcoin twice – once to you and once to Bob.

When the transactions are taken out of the unconfirmed transactions pool and put into the blockchain they are checked for their validity. So let’s say transaction A is pulled out of the pool. It seems to be valid (since I have one Bitcoin) and it is inserted into the blockchain.

Now transaction B is pulled out of the pool. It is invalid since I don’t have anymore Bitcoins to spend and it does not get confirmed.

But what if the validation process of A and B happened simultaneously ? Meaning both transaction will show that I have the money needed. Well in this case we will have 2 branches of the blockchain and a race will begin – the first one to achieves the next block of confirmations will win.

If they reach the next block simultaneously as well, we will have another race and so on.

This is why it’s recommended to wait until 6 confirmation before considering a transaction complete – Since it’s highly unlikely (like super highly unlikely) that this race will happen more than 6 times. So in the end we will have a clear winner and only one transaction will be confirmed. Until this race is resolved both transactions are in risk of getting canceled.

Now you know what double spending is and how to avoid it’s risks…

 

Ofir Beigel

Owner at 99 Coins ltd.
Blogger and owner of 99Bitcoins. I've been dealing with Bitcoin since the beginning of 2013 and it taught me a lesson in finance that I couldn't get anywhere else on the planet. I'm not a techie, I don't understand "Hashes" and "Protocols", I designed this website with people like myself in mind. My expertise is online marketing and I've dedicated a large portion of 99Bitcoins to Bitcoin marketing.

Leave a Reply

12 Comments on "What is Double Spending ?"

Notify of
avatar
 
Sort by:   newest | oldest | most voted
neeraj gupta
Guest
Member
neeraj gupta

HI, My transaction is not yet confirmed since 5 days.
Please suggest what can i do to reverse it or cancel it.

https://blockchain.info/tx/ebbff7df40c4db1ff5ee5cb0d335c57ce109b33915a2d914d8578d31cd84a166

Zsofia Elek
Admin
Member
Zsofia Elek

Hi Neeraj, this transaction fee is just too small, it might never get confirmed. You can use a transaction accelerator to have it confirmed for an extra fee.

Romil Jain
Guest
Member
Romil Jain
I got an idea of double spending in Bitcoin-Blockchain but i have a scenario Scenario – Let say Alice has only 10 BTC to spend and buys a merchandise of 10 BTC from Bob and initiate the payment in Bitcoin. Merchandise doesn’t wait for the payment to confirm and send the merchandise to Alice. But At the same time Alice initiate the same 10 BTC payment to her own account (having different BTC address) and tricked the network. This is the same case as of double spending. I know only one transaction would be confirmed by the network but if… Read more »
Zsofia Elek
Admin
Member
Zsofia Elek

Hi Romil, you are right, Bob should have waited until the transaction in confirmed before shipping. As per the article as well, this is why it is recommended to wait until 6 confirmations before considering a transaction completed. The confirmation time depends on the transaction fee, you can read more about this here: https://99bitcoins.com/why-bitcoin-transaction-pending-bitcoin-fees/

OkwaIfugo
Guest
Member
OkwaIfugo
Hello, tnx i have a problem. someone sent me $2679 and it did not confirm then i sent it out $2794 to my client lbc wallet. i had $110 sent to me which did not confirm. then later i sent out $135 to a bitpie wallet. after some hrs someone sent me $6 it confirmed well. then also someone sent me $1000 which confirmed as well. but the issue here is this, the $2679 after two days of no confirmation vanished from my wallet history, the $2794 i sent to my client lb wallet also vanished. then the $135 i… Read more »
Zsofia Elek
Admin
Member
Zsofia Elek

Hi, you cannot resend a Bitcoin until it has been confirmed on the blockchain, otherwise it will be double spending as it just happened. He will be able to send once the first transaction has been confirmed, it might take couple of days if the fees were low if that was not already a double spending. Otherwise eventually the transaction will be cancelled once the transaction is dropped off by all miners and will be rejected on the blockchain, but also needs time. At this point I don’t think so that you have much choice, just wait.

Fabiano
Guest
Member
Fabiano

Hi, I had an issue two days ago sending BTC from green address wallet to another wallet. The transacition was doubled in the receiving wallet, one was confirmed and the another is pending. I’m just starting with cryptocoins and after readind this article I understand that it was my fault for not waiting fot all confirmation. And what can I do about that pending transaction in the another wallet, will it be eventually cancelled and how long does it takes? Thanks you very much for your help.

Zsofia Elek
Admin
Member
Zsofia Elek

Hi Fabiano, indeed, you have to wait until the transaction is confiremed, otherwise it will be double spending. The transactions are cancelled within couple of days. Here is a post that could be also useful for you about sending Bitcoins: https://99bitcoins.com/why-bitcoin-transaction-pending-bitcoin-fees/

Saagt
Guest
Member
Saagt

Hello for my first payment (usin Electrum wallet) I set a very low fee because I didn’t know better (like 1 satoshi/B), after a few hours of waiting and reading I eventually modified it on Electrum (upped it to 40 sat/B) and after doing that it tells me on Blockexplorer that I made it a double spending. Did I do something wrong while modifying the fee? Or is that normal process with Electrum? Thank you

Zsofia Elek
Admin
Member
Zsofia Elek

Hi, you should wait until the first transaction gets cancelled before resend it with a higher fee, otherwise it will result in double spending as happened.

Rodolfo
Guest
Member
Rodolfo

Hi, this is a nice explanation about double spending. You can try a simulator of double spending problem here: https://thewalnut.io/visualizer/visualize/1802/396/

Maybe is a little more technical visualization for a beginner, but it let you play with the simulation to try different approach of the problem.

Ofir one
Member
Member
Ofir one

This looks pretty cool. I’ll taker a deeper look later on. Thanks for sharing!

wpDiscuz