Recently I started analyzing the UTXO set data that every full node stores in chainstate
folder (a LevelDB
database).
By looking into the code you can learn more or less how the data entries are formatted. However, to save as much space as possible, some of the data is compressed and encoded as a varint
.
How data is compressed can be found and also analyzed in the code. However, I'm struggling with understanding how the varint encoding/decoding is performed. According to the developers guide, the class responsible to do so is CVarint
, and I've been able to trace down the method that I think is doing so. However, since I don't know the format the data is encoded I'm not able to understand what it is doing.
Does someone have a clue about how the stored data is formatted?
Clarification: I'm referring to the CVarint format that is used in UTXOs along the Bitcoin Core, not to the varint format that is used to encode information in txs scripts.