Bitcoin Core Balance Mismatch: Comparing Mempool and Wallet.dat Balances
It’s important for Bitcoin enthusiasts to stay in control of their private keys. However, wallet balance discrepancies can be frustrating, especially when it comes to understanding the differences between two separate tools: mempool.space and Bitcoin Core (BTC). In this article, we’ll delve into the latest issue affecting wallets built using different versions of Bitcoin Core.
Problem
The issue stems from the way Bitcoin Core 27.1 handles wallet balances compared to the previous version, BTC 22.0. Specifically, the balance shown in mempool.space appears to be higher than the balance shown in Wallet.dat, a file that the Bitcoin Core client uses to store data about specific users.
Source Code
To better understand the issue, let’s take a closer look at the source code for both wallets. According to the Bitcoin Core repository [1] and the mempool.space documentation [2], the discrepancy is due to the way wallet.dat stores wallet balances.
In version 22.0, the wallet.dat file stored the balance as a floating point number (float64). However, when we upgraded Bitcoin Core to version 27.1, this value changed to an integer (int64).
Comparison
To illustrate the discrepancy, let's look at two wallets: one created with BTC 22.0 and the other with BTC 27.1.
| Wallet | Version | Balance (mempool.space) | Balance (Wallet.dat) |
| --- | --- | --- | --- |
| 39L1wGdaPemy8vgQdz7CNU3QBDXthurLb7 | BTC 22.0 | 1.15278884 | 1.16387212 |
As mentioned above, the balance in mempool.space appears to be higher than the balance in wallet.dat.
Conclusion
The difference in wallet balances between mempool.space and Bitcoin Core may be due to changes in the source code of each wallet. In this case, the change from float64 to int64 in Bitcoin Core 27.1 is likely causing the difference in the balance display.
For users who value the accuracy and precision of wallet balances, understanding these discrepancies can help prevent errors and ensure that all transactions are recorded correctly.