Bitcoin "Double Spend": To Be or Not To Be?

0 21
Avatar for the.hifi.crypto
2 years ago

Are you brand new to crypto and not sure where to begin to learn about it? Check out my intro to cryptocurrency and intro to blockchain posts or my cryptocurrency blog to learn more about this fascinating new technology!

The Bitcoin community was rocked in late January by the news that a dreaded “double spend” transaction had occurred on the blockchain. It was impossible. It wasn’t supposed to happen, not to Bitcoin anyway. But it did happen, or at least the media wanted everyone to believe that it had happened. And a lot of people seemingly believed the hype, as Bitcoin went on to lose nearly 20 percent of its value in the 24 hours following the transaction. But what is a “double spend” transaction? And did such a transaction really get processed?

Blockchain and Digital Scarcity

Bitcoin, and many other cryptocurrencies like it, runs on a software called a blockchain. In its simplest form, a blockchain groups transactions into a “block”, processes the transactions in that block, and then adds the block to a chain of other blocks.

At face value, perhaps that doesn’t sound like a big deal. After all, Visa, PayPal, and your local bank are great at processing transactions. But these companies and others like them extract a high price for their services. For example, Visa and PayPal charge about 3% to facilitate payments. Your bank on the other hand, charges you by paying little or no interest on your deposits and possibly by levying high account fees as well. These companies also have complete control over the money you leave with them. If they don’t want to process your transaction, or if a government tells them not to, they won’t, and you’ll suffer because of it.

The promise of blockchain is that anyone can access the network, regardless of who they are or what they do. But since no one controls the blockchain, proper verification of transactions is a whole different ball game. There needs to be a way for everyone to know without a doubt that no one is cheating the system.

The blockchain’s purpose, in the case of Bitcoin, is to prove digital scarcity. In other words, the Bitcoin blockchain helps ensure that no one can create additional bitcoin and that no one can effectively spend the same bitcoin twice. 

So How Does a “Double Spend” Transaction Work?

A “double spend” transaction has to do with the second problem that I mentioned above: spending the same bitcoin (or other cryptocurrency) more than once. The potential for this to be a problem is inherent to most digital assets due to the fact that digital content can usually be easily replicated. 

As an example, let’s say that I take a picture of Bernie Sanders hanging out, waiting for the presidential inauguration to begin. I send that picture to a friend of mine, who sends it to another friend, and so on. Eventually, someone decides to upload my picture to the internet, where it can now be downloaded by anyone in the world who has internet access. While I could argue that I have the original picture, that argument doesn’t really matter because every copy of my original picture is the exact same. The 100 millionth copy is the exact same as the original. And because it can be copied so easily, it loses its value. Even a copyright on my photo doesn’t actually keep people from being able to duplicate it.

This is in contrast to a physical painting. Let’s use the Mona Lisa as an example. Leonardo da Vinci, the painter, died over 500 years ago. He can’t paint any more Mona Lisas, and even if he could, the subsequent paintings wouldn’t be exact duplicates. The paint would have a slightly different composition. His strokes on the canvas would be different. In this hypothetical scenario, we would essentially have two original, albeit similar, versions of the Mona Lisa.

Just like a picture of Bernie Sanders that can be infinitely copied has little monetary value, a currency or asset that can be infinitely reproduced has or will have little monetary value. So if anyone were able to create an endless number of bitcoin, all bitcoin would soon lose their value. And if someone were able to spend the same bitcoin two, or three, or a hundred times, the end result would be the same: bitcoin and the Bitcoin network would be worthless.

What Really Happened? An “Orphan Block” Was Created.

So perhaps you’re starting to get a sense of why some people were so freaked out when it seemed like someone had spent their bitcoin twice. If it had really happened, and if this person or anyone could do it again, then pretty soon billions of dollars worth of bitcoin would almost immediately become worthless.

But did someone actually spend the same bitcoin twice? No, they did not. Well then, what really did happen?

Earlier we discussed that a blockchain operates by grouping transactions together into blocks and then linking the blocks together sequentially. The action of grouping those transactions together isn’t performed by the blockchain though. It’s performed by computers that are running the blockchain’s software. At any given time, there are tens of thousands of computers around the world that are running the software, and they are all competing against each other to be the first to confirm the block, or group, of transactions. Only one computer can actually win, confirm the block of transactions, and collect any transaction fees and the block subsidy

What happens if two different computers finish at the exact same time? Essentially, in this scenario, two different blockchains with the transaction are created. However, in the end, only one of the blockchains will be officially accepted by the rest of the Bitcoin network. The other blockchain will be discarded by the wayside. This is what happened in January. Two different computers somewhere in the world confirmed the same block at the same time. But when the subsequent block was confirmed by a different computer a few minutes later, that second computer chose to append its block to one, but not both, of the earlier blockchain “copies”. And the next computer after that did the same thing. The chain that didn’t get selected was ignored, and when one version of a blockchain gets ignored or “orphaned”, the transactions exclusive to that version effectively never actually happened. No extra bitcoin was created, and no bitcoin was spent twice.

How To Protect Yourself Against a Real Double Spend

So what is a real “double spend” transaction on a blockchain? Let’s pretend that someone, we’ll call her Alice, has one bitcoin. She’s in the market for a car and she finds two sellers, we’ll call them Jim and Paul, who are both willing to sell her their cars for her bitcoin. She only has one bitcoin, but what if she tries to send that one bitcoin to both Jim and Paul? She can initiate two transactions on the blockchain for her one bitcoin, and, as we explored above, two computers on the Bitcoin network might process the two transactions at the exact same time. So Jim and Paul both hand over the keys to their cars and both leave thinking that they’ve received Alice’s bitcoin as payment. But one of those transactions will be invalidated, perhaps as soon as the next block. Either Jim or Paul will eventually be left with nothing, while the other will be left with the original bitcoin. And Alice will have effectively “double spent” her bitcoin.

Spending your bitcoin twice seems pretty straightforward, so one could think that it would happen a lot. And, in reality, it does, either intentionally or unintentionally. But there’s an easy way to protect yourself from receiving a “double spend” bitcoin. Looking back at our earlier example, what if Jim and Paul had waited a bit longer after Alice initiated the transaction(s) before handing over the keys to their cars? A new block of transactions on the Bitcoin blockchain is typically processed every 10 minutes. Jim and Paul will know pretty quickly that one of them didn’t actually receive a bitcoin. Whoever didn’t get Alice’s bitcoin is going to tell her to get lost without handing over their car keys. And as word gets around that Alice is trying to “double spend” her bitcoin to steal people’s stuff, people are going to stop trusting her and she’ll have a much harder time spending any remaining bitcoin even once, let alone multiple times.

In the end, the best way to protect yourself from a “double spend” transaction is to wait until several blocks are added to the blockchain after the block containing your transaction. A lot of members of the Bitcoin community recommend that you wait a minimum of six confirmations, which would take, on average, an hour to complete. You might not be willing to wait an hour in the checkout line to buy your groceries, but you’d probably be willing to wait an hour if you were selling your car or your business for bitcoin. It’s up to you to determine the level of risk you’re willing to take on and how long you’re willing to wait. Just remember that if a bitcoin never makes it into your bitcoin wallet, it is never really yours to begin with.

For the purposes of this article, references to bitcoin (i.e., with a lower-case “b”) refer to bitcoin the currency or bitcoin the unit of account. References to Bitcoin (i.e., with an upper-case “B”) refer to Bitcoin the blockchain, Bitcoin the network, or Bitcoin the community.

If you found the above post to be helpful, please consider supporting me by providing a small tip below.

Interested in learning more about Bitcoin, Blockchain, and Cryptocurrencies? 

The following links are for companies that I personally use and recommend. You are under no obligation to sign up for their services or review their content. However, I may receive some small form of compensation if you do click the links and sign up and that compensation helps support me in my efforts to educate people about cryptocurrency and blockchain:

  • Coinbase provides cryptocurrency exchange and custody services, cryptocurrency staking on several blockchains, and more! Open a new account and earn $10 in free Bitcoin when you buy or sell your first $100 on Coinbase.

  • BlockFi provides cryptocurrency exchange and custody services, interest-bearing cryptocurrency accounts, and more! Open a new account and earn $10 in free Bitcoin when you deposit your first $100 on BlockFi.

  • Celsius Network provides interest-bearing cryptocurrency accounts, crypto-collateralized loans, and more! Open a new account and earn $40 in free Bitcoin when you deposit your first $400 on Celsius Network.

  • Publish0x allows you to earn crypto for reading crypto news and interacting with crypto bloggers, 100% free of charge.

6
$ 1.67
$ 1.67 from @TheRandomRewarder
Avatar for the.hifi.crypto
2 years ago

Comments