OKX Blockchain 60 Lectures | Episode 20: What is the Double Spending Problem?
"OKX Blockchain 60 Lectures" is a blockchain educational animated video series jointly produced by OKX and Sina Tech, targeting users with zero blockchain foundation. Through series articles, educational animations, and other forms, it explains blockchain concepts vividly from the perspectives of concepts, technology, and applications, covering 5 major sections and 60 knowledge points. The content of this episode was completed under the guidance of Dr. Liu Changyong, PhD in Economics from Peking University.
Hello everyone, I'm Xiao K. Today we're going to talk about: "What is the double spending problem?"
In previous lessons, we've already covered what the four core technologies of blockchain are, which together determine the entire foundational framework of blockchain. However, in blockchain networks, there are still some issues that the four core technologies cannot completely solve, such as network congestion, efficiency issues, and so on. Today, we're going to discuss one of these - the double spending problem.
The so-called double spending problem, as the name suggests, is when the same money is spent twice. For example, if we have 100 yuan in our WeChat wallet, we go to a restaurant for a meal first, but due to a WeChat bug, this transaction isn't synchronized with the bank and remains in the wallet, so we can use the same 100 yuan to go to a movie - this is a double spending problem.

Generally speaking, double spending problems fall into two situations: one is double spending before recording, such as when the same money is used multiple times due to bank synchronization delays - the example we just gave is this situation; the other is double spending after recording, where money is spent and the bank has recorded it, but if you attack the bank and delete this transaction from the bank's ledger, you can spend it again - that is double spending.
So how do we solve the double spending problem in real life and in blockchain?

In real life, for the payee (such as a shop owner), preventing the first type of double spending is easy - don't rely on the payer's transaction records, only deliver goods after confirming that the money has arrived in your own account. For example, when using WeChat Pay, you need to not only look at the payment page shown by the user, but also check whether you've received it on your own phone. Of course, if it's a very small transaction and the business is busy, and the user is a regular customer from the neighborhood, just looking at the payment page is fine - the shop can bear this small risk.
In blockchain applications, preventing double spending before recording is similar - the best solution is also to wait for recording before completing the transaction. Large transactions generally follow this path. However, if the amount is small and the parties know each other well, the transaction can be not recorded on the blockchain - that is, payment can be completed without recording. This is called "zero confirmation payment," but with this method, the payee bears the risk of being double spent.

Preventing the second type of double spending is more difficult. In life, for example, if WeChat has already recorded the transaction but a hacker attacks WeChat's server, once the merchant's received transaction records are lost, the merchant naturally suffers a loss, and the payer can use the original money again. However, this situation rarely occurs - since recording is involved, the ledger must be preserved very carefully.
Blockchain applications are similar - the core of the entire blockchain technology is to ensure the security of the ledger, so once recorded, it cannot be double spent. But security is not absolute - even after recording, it's still possible to be double spent. This is because blockchain applications don't rely on the authority of institutions like central banks to ensure ledger security, but rather on nodes distributed worldwide all keeping a unified ledger, with miners worldwide competing with computing power to record and generate completely consistent new ledger pages.
When someone controls more than 51% of the network's computing power, they can void the just-recorded ledger pages and restore a transaction within them to an unspent state. This is double spending after recording, and this attack method is called a "51% attack." This type of double spending is relatively more difficult to achieve than double spending before recording, because controlling 51% of computing power requires a lot of money. But if the returns from double spending are large enough, attacks are still possible. What to do?
The solution is to wait for more confirmations. For 51% of computing power to void the latest ledger page, the success probability is 51%, but the probability of voiding two consecutive new ledger pages is 51%*51%=26%, for 3 it's 13.3%, and for 6 it's only 0.46%. If the attacker doesn't control 51% of computing power but only 20%, then the probability of successful attack is only 0.0064%.
This way, the problem becomes simple. Merchants can decide how to prevent double spending based on the transaction amount.
If the transaction amount is very small, such as selling a pencil, zero confirmation is completely acceptable - it's both time-saving and thoughtful for users. Even if double spending occurs, it doesn't matter. If the transaction amount is larger, such as selling a piece of clothing, it's recommended to wait for one confirmation. No hacker would use 51% of computing power to launch an attack for a piece of clothing. If the transaction amount is very large, such as buying a diamond, you need to be careful. You should estimate how many confirmations are needed based on the cost of the network's computing power - the larger the amount, the more confirmations needed.

For example, if this blockchain confirms once every 10 minutes, and the cost of 51% of the network's computing power every 10 minutes is 100,000 yuan. The diamond you're selling is worth 1 million yuan. Then you need at least 10 confirmations or more before delivering the diamond. Ideally, 20 or more confirmations.
In summary, a basic principle for preventing double spending attacks is to make the probability of the attacker losing money far higher than the probability of you being double spent.
Of course, to prevent double spending problems, blockchain itself has introduced some other technologies on top of the consensus mechanism, such as timestamps and the UTXO model. Through them, they further improve blockchain's recording security and the cost of double spending evil. As for how they specifically solve it, let Xiao K keep you in suspense - we'll talk about it in the next lesson~
Note: The data in these examples are estimates given for simplicity. Real attack cost and return analysis is very complex.
Thanks to Teacher Liu Changyong for his help and guidance with this episode's content.
Sina Weibo: @昌用老师
Disclaimer
This article may contain product-related content not applicable to your region. This article is intended to provide general information only and does not accept responsibility for any factual errors or omissions therein. This article represents only the author's personal views and does not represent OKX's views. This article is not intended to provide any advice, including but not limited to: (i) investment advice or investment recommendations; (ii) offers or solicitations to buy, sell, or hold digital assets; or (iii) financial, accounting, legal, or tax advice. Holding digital assets (including stablecoins) involves high risk, may fluctuate significantly, and may even become worthless. You should carefully consider whether trading or holding digital assets is suitable for you based on your financial situation. For questions about your specific situation, please consult your legal/tax/investment professional. The information appearing in this article (including market data and statistics, if any) is for general reference only. While we have taken all reasonable care in preparing these data and charts, we accept no responsibility for any factual errors or omissions expressed herein. © 2025 OKX. This article may be reproduced or distributed in its entirety, or excerpts of 100 words or less from this article may be used, provided such use is non-commercial. Any reproduction or distribution of the entire article must also prominently state: "Copyright © 2025 OKX. Used with permission." Permitted excerpts must cite the article name and include attribution, for example "Article Name, [Author Name (if applicable)], © 2025 OKX". Some content may be generated or assisted by artificial intelligence (AI) tools. Derivative works or other uses of this article are not permitted.
Show More
Recommended Reading

OKX Blockchain 60 Lectures | Episode 43: The Rise of the Mining Circle (Part 2) — The Rise of Bitmain
Hello everyone, I'm Xiao K. Today we're going to talk about: "The Rise of the Mining Circle (Part 2) — The Rise of Bitmain". In the last lesson, we mentioned that there were two people who opened the door to mining capital and commercialization: one was Pumpkin Zhang — Zhang Nangeng, and the other was Roasted Cat — Jiang Xinyu. Although they together started the golden era of the mining circle, there was someone else who truly pushed the mining industry to its peak, and this person's name is Wu Jihan.
September 18, 2025

OKX Blockchain 60 Lectures | Episode 2: Why is Blockchain Called Blockchain?
"OKX Blockchain 60 Lectures" is a blockchain educational animated video series jointly produced by OKX and Sina Tech, targeting users with zero blockchain foundation. Through series articles, educational animations, and other forms, it explains blockchain concepts vividly from the perspectives of concepts, technology, and applications, covering 5 major sections and 60 knowledge points. The content of this episode was completed under the guidance of Teacher Meng Yan, Vice President of the Digital Assets Research Institute. In 2008, a global financial crisis broke out. On October 31st, "
September 18, 2025

OKX Blockchain 60 Lectures | Episode 16: What is the PoW Consensus Mechanism
"OKX Blockchain 60 Lectures" is a blockchain educational animated video series jointly produced by OKX and Sina Tech, targeting users with zero blockchain foundation. Through series articles, educational animations, and other forms, it explains blockchain concepts vividly from the perspectives of concepts, technology, and applications, covering 5 major sections and 60 knowledge points. The content of this episode was completed under the guidance of Mentor Huang Fangyu, Co-founder of Wan You Computing Power. Hello everyone, I'm Xiao K. Today we're going to talk about:
September 18, 2025

OKX Blockchain 60 Lectures | Episode 51: 2019, Giants Enter, Facebook's Cryptocurrency Dream
Previously we mentioned that in 2018, as blockchain was hyped into excessive prosperity, a vigorous de-bubbling process began, and the entire industry entered a harsh winter. But danger and opportunity coexist - this cyclical downturn in the industry happened to give international giants the best opportunity to enter. In February 2019, Wall Street financial behemoth JPMorgan Chase thoroughly sounded the clarion call for international giants entering the blockchain field, followed by Goldman Sachs, UBS, Citigroup, Microsoft, and other giants
September 18, 2025

OKX Blockchain 60 Lectures | Episode 7: What Does Blockchain Fork Mean?
"OKX Blockchain 60 Lectures" is a blockchain educational animated video series jointly produced by OKX and Sina Tech, targeting users with zero blockchain foundation. Through series articles, educational animations, and other forms, it explains blockchain concepts vividly from the perspectives of concepts, technology, and applications, covering 5 major sections and 60 knowledge points. The content of this episode was completed under the guidance of Mentor Buerfeimo, an Austrian school economist. The so-called blockchain fork can be said to be unique to blockchain networks - a
September 18, 2025

OKX Blockchain 60 Lectures | Episode 25: What is Lightning Network?
Hello everyone, I'm Xiao K. Today we're going to talk about: "What is Lightning Network"? The so-called Lightning Network was first proposed in a whitepaper by Joseph Poon and Thaddeus Dryja in 2015 as a technology to solve Bitcoin transaction congestion. The origin of this technology stems from a problem left over from Bitcoin's early days. Because when Bitcoin was first designed, one
September 18, 2025



