Bitcoin double spend scare: What actually happened?

Yesterday the report of the first verified Bitcoin double-spend was making the rounds. BitMex Research posted details of the incident via Twitter. For several minutes the transaction in question showed up in two separate blocks but in the end the protocol worked as designed.

What actually occurred is that a user attempted to send a transaction with an insufficient fee. In Bitcoin, fees go to the miners and miners can choose which transactions to include in a block. Most often they choose transactions with the highest fees.

After a day without the transaction being included in a block the user updated the transaction with a higher fee using a replace by fee transaction (RBF). An RBF created a clone of the original transaction with a higher fee but the original transaction remains on the network as well. So now there are two identical transactions waiting to be processed.

After another day of waiting the user submitted yet another RBF with an even higher fee leaving the network with three versions of the same transaction.

On Jan 20 at block height 666833 two different miners mined a block simultaneously. Both blocks contained different versions of the transaction described above. This caused a temporary condition that looked like a double spend.

The protocol is built to handle this situation and is an example of a fork. The network quickly reorganized itself and only one of the blocks was eventually included in the chain.