Interest in double-spending Bitcoin grew after it was recently revealed that the Bitcoin network processed the same Bitcoin (BTC) in two transactions – the double-spend scenario that Bitcoin designed specifically to prevent this from happening.
Except that the double spending didn’t take place, at least not in the traditional sense.
“The double-spend headline on the bitcoin media certainly scared investors, but it’s a misunderstanding of how the bitcoin network works. In this case, a block chain reorganized, which is quite common,” said Jason Lau, COO from OKCoin Exchange, opposite CoinDesk.
In other words, no bitcoin was issued twice because no new coins were added to the bitcoin offering. Instead, the same coins from the same wallet were registered in two different blocks during a typical split in the Bitcoin blockchain.
The reason this doesn’t qualify as double spending is because only one of these transactions (the one recorded in Bitcoin’s longest blockchain history) is considered valid by the network, while the bitcoin cannot be spent in the other transaction since the network does not take this into account it is valid.
What is a Bitcoin Block Reorganization?
Due to the distributed and competitive nature of bitcoin mining, from time to time the same block will be mined at the same time, creating a split in the history of the blockchain. In this case, miners are added to both blocks until one history wins the other.
For example, let’s assume that mining pool A and mining pool B mine a block at the same time, which leads to two different blockchain histories (versions A and B). In the future, all other miners will have to choose which version of the chain to build on. Suppose the miner who finds the next block in the sequence builds on version A, but after that the next two or three or more miners decide on version B. Version B ultimately wins if more miners mine that transaction.
The other story is cut out of the network and considered irrelevant, and any blocks mined on it become stale blocks.
This was the case at block 666.833, where two blocks were created by separate mining pools and a one-block reorganization described by Lau took place. The above scenario is why Satoshi Nakamoto said in the whitepaper that a transaction should only be considered final after six confirmations (i.e. six new blocks are mined onto the chain that recorded the transaction).
No, double spending didn’t actually happen
The alleged double spending first became known yesterday after BitMex Research reported on Twitter about the anomalies of block 666,833. The reorganization meant dismantling an “obsolete block” (sometimes called an “orphan block”) that contained bitcoin, which was also spent on the valid chain of bitcoin. Therefore, a transaction with the same bitcoin was recorded for both the relevant and irrelevant chains.
What BitMEX research initially referred to as a “double spend scenario” now looks like a perfect storm caused by the one-block reorganization and a fee-replacement transaction. An RBF transaction occurs when you instruct your wallet to resend the same bitcoin, but with a higher fee, in the hopes that it will be confirmed before the transaction with the lower fee.
Here’s what actually happened
It went like this: someone sent 0.00062063 BTC to this address but set the lowest possible fee (1 satoshi per byte or less than a fraction of a cent per byte of transaction data).
Because the fee was so low, it took a while for the transaction to be confirmed. The sender tried to outperform them by sending a so-called “Replace With Fee Transaction” (RBF).
Instead of the RBF replacing the slow transaction as intended, the transaction with the lower fee was deleted first and reached the block that was mined to the longest chain.
In the meantime, the transaction found its way into the obsolete block with higher fees. The end result: 0.00062063 BTC is recorded as present at the address 1D6aebVY5DbS1v7rNTnX2xeYcfWM3os1va in the irrelevant transaction history, while 0.00014499 BTC is present at the same address but in the corresponding transaction book.
The importance of 6 affirmations
Technically, the same bitcoin was issued twice in this scenario. However, a transaction was duplicated to an address in a transaction history that the Bitcoin network does not believe to be valid (for example, if you query the transaction ID for the “losing” transaction in a Bitcoin block explorer, nothing is displayed).
“It’s a bit of a double, but not really. Usually, double-spending refers to you deliberately replacing a transaction that sends money to someone with a transaction that sends it to your own wallet,” said Ben Carman, one Bitcoin Core employee and developer at Suredbits, opposite CoinDesk.
In this scenario, it is important to know that there may be different versions of the same transaction, but only [one] will ultimately be accepted by the nodes and users of the Bitcoin network, ”Bitcoin network data analyst Lucas Nuzzi of Coin Metrics wrote on Twitter.
Double-spending usually means that a sender is tricking a recipient into accepting a transaction that the sender is actually sending to himself. Because of this, it is considered a best practice for merchants to wait six confirmations before considering a payment final in order to avoid an outcome like this.
As CoinMetric co-founder and CoinDesk columnist Nic Carter said on Twitter, what happened yesterday was actually pretty much within walking distance for Bitcoin, not to mention something that Satoshi Nakamoto describes in the white paper himself.