There are no double spends in bitcoin
Bitcoin does not know such thing as a “double spend”
When you take the words “double spend” literally, it means something is spend two times. This is a problem known as the “double spending problem”. Bitcoin solves this.
My proposition is: Bitcoin does not know such thing as a “double spend”.
To understand this, it is important to understand what Bitcoin is.
Bitcoin is just a collection of mathematical rules, nothing more. Only when these mathematical rules are followed, there is Bitcoin. When one of such rules is breached, there is no Bitcoin.
So imagine the following Bitcoin Blockchain:
In Block 98 and 99 there are two transactions, both with an input address A. You can say, this is a double spending, but it is not. It is not, because, following the rules of Bitcoin, Block 99 is not valid and thus, does not exist, so nothing is spend in Block 99:
So, only the transaction in Block 98 is spending address A following the mathematical rules of Bitcoin.
Now, imagine the following Bitcoin Blockchain:
In this state of the Blockchain, there are two chains. In each chain, there is a transaction with an input of address A. And the question is: are those transaction spending something?
The answer is no, these transactions do not spend anything, because both chains are invalid. The only valid chain is the chain until Block 97:
Block 98 and 98' are invalid, because none of them makes the longest chain (see Additional note below).
Now imagine the following Bitcoin Blockchain:
In this state, the transaction in Block 98 did spend address A.
Important to realize is that this is just a temporary state. After some time, the state can be changed to this:
So, which one of the transaction spends address A can change during time.
However, this is by design of Blockchain: the greater the difference is in length of the two chains, the lesser the chance this will change. This is why you need to wait for confirmations to be sure the spending transaction will not be changed to ‘not spending’ over time.
Additional note:
To be more precise, it is not about what is the longest chain which one is valid following the rules of Bitcoin, it is about which chain has the most Proof of Work. This difference is important, because each chain can be produced with a different difficulty.
This, is the magic of Bitcoin. Thank you Satoshi, you are my hero!