The Forensic Audit of the DB: Using `gettxoutsetinfo` to verify the supply
18. The Forensic Audit of the DB: Using gettxoutsetinfo to verify the supply
How do you prove that only 21,000,000 coins exist? You use Forensic Auditing. In src/node/coinstats.cpp, the node provides the gettxoutsetinfo RPC. This is the "Supreme Audit" of the machine.
1. The Rolling Hash (MuHash)
To audit the supply, the node must read every single unspent coin in the LevelDB.
-
It calculates a "Hash" of every coin's value and owner.
-
To make this efficient, it uses MuHash.
-
MuHash allows the node to "Add" coins to the hash in any order. This is critical because LevelDB doesn't store coins in a specific "Transaction Order." It is the Precision of the Sovereign.
2. The Mathematical Proof
The resulting hash is a "Digital Fingerprint" of the entire world's wealth.
-
If even one Satoshi was "Fake" or "Double-Spent," the hash would be different.
-
This is how the network achieves "Global Consensus" on the supply without needing a central bank. It is the Truth of the Machine.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: