What is Double Spending & How Does Bitcoin Handle It?

Bitcoin is gaining rapid popularity and adoption across the globe. It is redefining the way we use the money by being the world’s first fully functional digital currency.

You might be surprised to know that even before Bitcoin, there were attempts to create a sustainable digital monetary system. But all those attempts failed because an obvious problem with digital money is that transactions can be copied and spent twice.

Let me simply the concept…

Bitcoin has been able to survive and thrive because it solves the “double spending” problem.

What Does Double Spending Mean?

What Does Bitcoin Double Spending Mean

Double spending means spending the same money twice.

Let’s consider this example:

You go to Starbucks and order a cappuccino worth $10. You pay in cash. Now that $10 in cash is in the cash vault of Starbucks. By all means, you simply cannot spend the same $10 somewhere else to make another purchase.

Unless you steal it…!!!

As you paid with your $10 bill, the service provider at Starbucks instantly confirmed that you have paid, and you received your coffee in exchange for the money.

But Bitcoin is digital money, not physical cash. Hence, Bitcoin transactions have a possibility of being copied and rebroadcasted. This opens up the possibility that the same BTC could be spent twice by its owner.

How?

In our Starbucks example, you paid cash, so the payment was confirmed and verified instantly by another human. But with digital currency like BTC, if this verification mechanism is missing, it can lead to double spending.

Anyone can just copy that digital money and pay somewhere else.

And here is where the unique invention lies…

Bitcoin, although being a digital currency, solves the problem of being copied and getting spent twice.

How Bitcoin Handles The Double Spending Problem

How Bitcoin Handles The Double Spending Problem

Bitcoin manages the double spending problem by implementing a confirmation mechanism and maintaining a universal ledger (called “blockchain“), similar to the traditional cash monetary system.

Bitcoin’s blockchain maintains a chronologically-ordered, time-stamped transaction ledger from the very start of its operation in 2009.

Every 10 mins, a block (i.e. a group of transactions) is added to the ledger. And all the nodes on the Bitcoin network keep a copy of this global ledger (the blockchain).

Let’s see how the Bitcoin network prevents double spending:

Let’s suppose you have 1 BTC which you try to spend twice.

You made the 1 BTC transaction to a merchant. Now, you again sign and send the same 1 BTC on another Bitcoin address to try and trick the merchant.

Both transactions go into the unconfirmed pool of transactions. But only your first transaction got confirmations and was verified by miners in the next block. Your second transaction could not get enough confirmations because the miners judged it as invalid, so it was pulled from the network.

But wait… what if both the transactions are taken simultaneously by the miners?

When miners pull the transactions simultaneously from the pool, then whichever transaction gets the maximum number of confirmations from the network will be included in the blockchain, and the other one will be discarded.

You might say that this is unfair for the merchant, as the transaction might fail in getting confirmations. Yeah, this can happen!!!

That’s why it is recommended for merchants to wait for a minimum of 6 confirmations.

Here, “6 confirmations” simply means that after a transaction was added to the blockchain, 6 more blocks containing several other transactions were added after it.

“Confirmations” are nothing but more blocks containing more transactions being added to the blockchain. Each transaction and blocks are mathematically related to the previous one.

All these confirmations and transactions are time-stamped on the blockchain, making them irreversible and impossible to tamper with.

So if a merchant receives his/her minimum number of confirmations, he/she can be positive it was not a double spend by the sender.

Why can the merchant be assured?

Because to be able to double spend that coin, the sender has to go back and reverse all transactions in the 6 blocks that have been added after their transaction, which is computationally impossible.

How Double-Spend Attacks Can Happen

  • Attack 51% 

If somehow an attacker captures 51% of the hash power of the network, double spending can happen.

“Hash power” means the computational power which verifies transactions and blocks. If an attacker has this control, he/she can reverse any transaction and make a private blockchain which everyone will consider as real.

But so far, no such attack has happened because controlling 51% of the network is highly cost intensive. It depends on the present difficulty of mining, the hardware price, and the electricity cost, all of which is infeasible to acquire.

  • Race Attack

When an attacker sends the same coin in rapid succession to two different addresses, the obvious outcome is that only one of them will get included.

Now, if you as a merchant don’t wait for confirmations of payment, then in a case like this, there’s a 50% chance you got the double spent coin (and you won’t receive that money).

Let’s see how…

Your customer can trick you if he/she sends the same coins again to his/her address.

Once the customer does both transactions, both transactions go to an unconfirmed pool of transactions. Whichever transaction gets verified first and gets 6 confirmations will be accepted, and the other will be discarded.

As a merchant, you might get the 6 confirmations first, but if the attacker gets the confirmations first, then you won’t receive your funds. That’s why it is said to wait for a minimum of 6 confirmations.

So far, in the 8-year history of Bitcoin, no such attack has been successful. The Bitcoin mechanism of maintaining a universal transaction ledger based on confirmations has yet to be tricked.

I hope this knowledge about Bitcoin will help you use it safely.

Let me know your thoughts and feedback in the comments section below.

And don’t forget to share this post with your friends on Facebook and Twitter!

Also, read:

Was this helpful?

Thanks for your feedback!

20 thoughts on “What is Double Spending & How Does Bitcoin Handle It?”

  1. Teddy

    That’s very informative. Thanks

    1. DJ AFINO

      this is why Bitcoin Cash is NOT plausible! 51% attacks are much more possible with BCASH having a much smaller number of nodes, and mining hash power being distributed evenly to only 4 or 5 large mining pools.. only 4 or 5 of them need to collude with one another to perform 51% attacks on the network – BCASH is not a true representation of decentralization – support Bitcoin Core – run a full node, and hodl Litecoin while you’re at it too

  2. Ioni Appelberg

    Thanks for the article! I’m struggling to understand how it could be possible to double spend even without the blockchain. Why aren’t your funds simply subtracted from your wallet when you make a payment? It’s not like you could double spend via your Jaxx, Copay or mycelium wallet, so how would you go about copying your own transaction and sending the same bitcoin somewhere else again? Why is the double spend problem even a problem?

    1. luki

      In November 2013 it was discovered that the GHash.io mining pool appeared to be engaging in repeated payment fraud against BetCoin Dice, a gambling site [https://bitcointalk.org/index.php?topic=327767.0] . Dice sites use one transaction per bet and don’t wait for confirmations. GHash.io claimed they had investigated and found a rogue employee who had been doing the double spending, who was fired. However no evidence supporting this was provided and the incident left a permanent cloud hanging over the pool. Regardless, it didn’t seem to hurt their market share much: most miners probably never heard about the incident at all.

    2. Palash

      Then why use bitcoin at all? Banks are doing the same. You are trusting a third party, and now it totally depends on jaxx and copay to handle your funds in whatever way you want. There is no decentralization

  3. Juan

    Well I believe I was tricked by an attaker like you say. I tried the doubler.block-chains.me to get double my investment of 0.01 Bitcoin that supposedly I would receive in 24 hrs. And never happened. Does anyone else got ripped off by this method in blockchain too. Please help me understand I’m pissed.

    1. Lucas

      No, that is not a 51% attack. You just sent your bitcoin to a scammer, and they took it obviously.

  4. M3kw

    How does one judge the second spend isn’t valid after he first is spent.

    1. Sudhir Khatwani

      You will not be asked for judging that Blockahin will do that. Whichever transactions get added first to the longest blockchain version is the valid one.

  5. Marquimarc

    Hello. On 6th od December I bought bitcoins in Bit2me.com company. I already bought before and I had to problem. But the thing is that on 6th I sent them two bank transaction with the same value 10.000 euro each. I bought them with 4 minutes difference. But they sent the same bitcoins amount at the same time to my wallet. Now I cannot do anything because they say they sent the bitcoins to my wallet but was busted as double spent. They told me to wait but I am very worry because it is a lot of money. 🙁 I dont know what to do. Do you think I will loose all my money or it is just wait and I will receive it all?
    Any help will be appreciated.

    1. Sudhir Khatwani

      when both the addresses are yours you should not worry.

      1. Carol c

        Thank you for your info!! I am in a deep trouble and confusion and need you advise urgently please! Someone gave me an wallet address/barcodes to send 10 Btc to. He told me to send 0.01 btc first and he got it and a min after I realized that the remaining btc was transferred to an “unknown wallet address” simultaneously?! How could this happened?? I need your professional advise please, thank you!!!

        1. Sudhir Khatwani

          That’s impossible unless you showed that person your seed or private keys!!

    2. burak

      Hi, I have just found this :

      there is a way to save a broked transmission. A restart of the wallet and some patience typically fixes the issue.

      How to stop/reverse a Bitcoin transaction without confirmations:

      Run bitcoind and with -zapwallettxes.
      This makes the wallet “forget” any unconfirmed transactions, thus enabling you to reuse their inputs.
      Create a new transaction to make your payment and add an appropriate fee this time.
      The unconfirmed transaction is still valid and may still be floating around in the network, so be sure to spend its inputs to yourself, or the transaction may be confirmed at a later time and you’ll end up double-paying.
      The simplest way is to send all your bitcoins to yourself. Don’t forget an appropriate fee. 😉

      Hope you can get your coins back

  6. Jim S.

    This article appears to assume that any double-spending attempt is going to involve trying to send the same Bitcoin to TWO (2) different addresses. But what do you know about alleged double-spending attempts that were sent to the SAME address more than once?

    In my case here just very recently, I attempted to “sweep” a paper wallet containing 0.5 BTC on it and send the full amount to my Coinbase account. I used the Mycelium Android wallet for this sweep attempt and have actually used the Mycelium wallet for this same purpose dozens of times in the past without any problems. However, this time was different; and when I did a secondary scanning, as well as third scanning, of the private key for the paper wallet into the Mycelium sweep utility, it did not register as having been swept, even though initially on both attempts a message appeared stating that the transaction had been “SENT” successfully.

    In fact, though, it could not have been sent successfully for three (3) very good reasons:

    1) Blockchain.INFO was still showing the funds fully available in the paper wallet.
    2) Neither of the two initial send attempts registered through my Coinbase account.
    3) And as noted above, the Mycelium wallet app was still showing the funds remaining.

    So with good reason to believe that the funds were never successfully swept from the paper wallet, I attempted yet a THIRD sweep of the wallet — and on the third attempt, it worked. Blockchain.INFO was showing the funds being sent and currently registering as an “UNCONFIRMED” transaction, of which the unconfirmed part did not surprise me.

    So about an hour later, I go back into my Coinbase account to see the status of the transaction. In this case, the Coinbase company uses the LIVE.BLOCKCYPHER.COM site as its choice of blockchain explorer, as opposed to using Blockchain.INFO or some of these other explorer sites. And when I clicked on the link into the explorer webpage, it gives the following ominous message:

    “WARNING: This transaction has been double-spent by d46fe0c4cb4bbb0c2691d44628064…, be extremely careful when accepting this transaction!”

    One point to clarify here is that in making the three attempts that I did at transferring the funds from the paper wallet to my Coinbase account, I definitely used ONLY ONE Bitcoin receiving address from my Coinbase account. I did not attempt to send the Bitcoin to more than one address on any of the three attempts made.

    So NOW where is the double-spend logic coming into play here, at least regarding this article? Although I may be wrong, it occurs to me that the author of this article is not particular savvy when it comes to this blockchain technology stuff, and so maybe there is not going to be a knowledgeable answer to this question coming from this forum.

    In any event, I am wondering if anybody knows the answer to the question about how, when or if these alleged double-spend attempts EVER end up correcting themselves on the blockchain…

    Is there any good reason for me to believe that this apparent technical problem created by the Mycelium Android wallet itself is ever going to be corrected over a period of time? Or do these sorts of alleged double-spend transactions end up getting FOREVER stuck and lost in the “blockchain limbo” never to be rectified?

    For one thing, my Coinbase account is continuing to show the transaction in a “PENDING” status. My guess is that beyond a certain period of time, whether it be a day, a week, a month or whatever the case, that my Coinbase account will end up effectively “timing out” on the transaction. If that ends up happening, then the other thing I know is that the only way for this situation to correct itself is for the 0.5 BTC to end up being deposited back into the original paper wallet address, where I could then presumably make another attempt at the sweep transaction.

    I mean, we are talking about 0.5 Bitcoin in this case — a full HALF of a Bitcoin! If it takes a week, a month, or even a year for it to correct itself, I guess that frankly I have the time to wait and I’m not in a particularly big hurry. Obviously this would be a big chunk of money to find out that I ended up LOSING due to some unbelievably RETARDED scheme built into this so-called “blockchain technology” stuff that is unable to identify “after the fact” the legitimacy of whether any given amount of Bitcoin was ever truly spent successfully from any given Bitcoin address.

    It will be interesting to see if and when I ever get access back to my half-a-Bitcoin. If like a month or two goes by or something like that and the funds are still locked into “blockchain limbo,” then I’m going to begin to largely assume the money is effectively irretrievable and irrevocably lost due to what would definitely amount to a VERY SERIOUS FLAW with this whole Bitcoin thing.

    So to otherwise touch on the basis of your article here generally, which is to suggest that Bitcoin is the first ever successful digital currency ONLY because it has succeeded in solving the “DOUBLE-SPENDING” problem, then that may very well be true… HOWEVER, solving the double-spending is one thing; BUT then finding out that by virtue of solving the one problem it ends up leading to an equally serious problem of effectively permanently “freezing the assets” of people would still prove to show that the entire Bitcoin protocol is massively flawed from a technological standpoint.

  7. Christof

    What if the two transactions (double spending) are picked from the pool to be included in the same block. What prevents this or what would happen then that mitigates double spending?

  8. Nadia Khan

    Hi Sudhir,

    I read Mastering Bitcoin but still doubts about Double Spending, after reading your article completely understood. Cheers

  9. Antika Eşya Alanlar

    What prevents this or what would happen then that mitigates double spending?

    1. Harsh Agrawal

      Wait for 6 or more confirmations, you will not face it then.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to stay updated

Learn Profitable Crypto Trading and receive our free resources to master automated bot 🤖 trading strategies.

(We respect your privacy.)

Coinsutra logo

CoinSutra provides general cryptocurrency and blockchain information for educational purposes only. Content on CoinSutra’s website and social media is not financial, investment, trading, or professional advice. Readers should conduct independent research and consult a licensed advisor before making investment decisions.

CoinSutra does not recommend or endorse specific cryptocurrencies, projects, platforms, products, exchanges, wallets, or other offerings. Opinions shared by CoinSutra writers are their personal views only and should not be relied upon for financial choices.

CoinSutra writers are not certified financial advisors or brokers. Cryptocurrency activities like purchasing, trading, holding, and selling have inherent risks. Readers should exercise due diligence before participating. CoinSutra and its writers are not responsible for any investment losses from acting on website or social media content. Visitors participate at their own risk.



Scroll to Top
76 Shares