Double spending was the very first problem Satoshi noted that Bitcoin could solve in his original 2008 email.
But talking to newcomers, the idea of a double spend can be confusing. I know it was for me at first.
How do you like to explain double spending to them?
I think to explain it, one must first understand the concept of 'finality'. What does it mean for a transaction to be 'finalized' and not altered?
Side note: Bitcoin doesn't propose to have this fixed under all circumstances, but it does give some good probabilistic assertions on how likely a transaction can be overturned as blocks go by (based on the blockchain metrics we're able to collect).
In the digital world, all data can be duplicated. How then can we make a currency in which people aren't able to duplicate the data at will? Without this, we can never have 'finality' to a transaction. In the case of money duplication, the same unit of value earned once can be spent multiple times, potentially invalidating earlier transactions to keep the integrity of the money supply. So the problem of double spending asks how we can prevent a unique token of value from being used twice?
Potential solutions
We can add certain validation mechanisms to the data, but who would be performing these validations? One proposal is a trusted centralized entity. Of course that means they can always change the rules at will, so how can we trust them not to?
One way is to spread the validation across as many participant as possible and make it hard for validators cheat (from the difficulty of overturning already validated data, and the consequence of waste if unsuccessful). In the form of Bitcoin this is represented by the set of bitcoin nodes that many hodlers run today. The validation mechanism being dependent on miners, who have the permissionless role of first processing the transactions in a way that is not easy to duplicate and has a tremendous cost of failure (failure to reorg the chain will result in a lot of wasted money for a miner).
reply
The shortest example is writing a bad check. The banking system handles this differently and it tales a few days.
reply
Double spends of unconfirmed transactions happen constantly via the replace-by-fee mechanism.
Double spends of confirmed transactions are another matter entirely. They are extremely rare.
reply
Alice pays $10 to Bob but the transaction takes some time.
Before the transaction is settled, Bob spends those $10.
Alice cancels the payment and the $10 never gets to Bob, although they were spent already.
reply
This is something that can happen more often when Bitcoin enables Full-RBF
reply
It is a little misunderstood, this subject. Double spend protection (partition resistance) is not the primary target of Bitcoin's design, it's consistency. The famous 51% attack relates to the fact that controlling half the hash power lets you rewrite recent blocks.
Bitcoin's main strength is its immutable history, which is the C in the CAP theorem.
What Satoshi actually said was that the EC cryptography solved the Byzantine Generals problem via unforgeable signatures on the messages delivered to the generals.
The heaviest chain wins rule, which was his invention, is the thing that people mean when they say "Nakamoto Consensus". It is what keeps the majority of miners on the same chain and thus preventing reorgs, and further reducing the viability of double spend attempts.
reply
The double spend problem is when someone tries to use the same money twice to buy different things. On the old FIAT system, we rely on 3rd parties (banks/govs) to stop double-spending, and we pay them for this "benefit".
reply
Not too hard to explain, actually. It's basically like writing a bad check. You have $100 in your bank account but you write two $100 checks to different vendors. You successfully double spent your $100. It's a criminal offense in most jurisdictions to knowingly do this. and banks will penalize you if you do this by accident (you can also pay for overdraft protection)
The trickier question is why double-spending is a problem for decentralized ledgers.
In the current system, your bank maintains the ledger. Your bank tells the first merchant that cashes your check that it's good, and credits their account. Your bank then tells the second merchant that your check is no good, and they don't credit the account. It's a centralized system that relies on the bank's ledger as the source of truth.
What happens if there's no centralized ledger?
You write a $100 check to Alice and a $100 check to Bob. They each maintain their own ledger. Their ledgers start off in-sync, both saying you have $100. After you spend with both Alice and Bob their ledgers become out of sync. Alice's ledger says she now has your $100, whereas Bob's ledger says he has the $100.
Now, let's say Alice and Bob then both want to pay other merchants. Whose ledger is correct? Who has the authority to determine that? Without some source of truth, why would any merchant accept the validity of either Alice or Bob's ledger?
That's the problem that Satoshi solved... a way for everyone to have consensus at all times on the state of the ledger, so that double spends can't happen.
reply
There are various versions of the problem. I think of someone buying an item from a store, calling their credit card company claiming they never got it, and then using the credit they get back to buy something else.
reply