I am interested in understanding the structure of Monero's database LMDB and using mdb_stat to extract relevant information from it. I am assuming querying it directly (i.e. via mdb_stat) for information should be a lot faster and easier than doing so through the wallet, daemon or RPC. Is that the case?
For instance, I was hoping to be able to extract information about blocks, transactions, outputs, rings, Pedersen commitments, range proofs, number of rings that use a given output etc, and I think it would be invaluable to have some sort of specific manual on how to conduct such queries on Monero's LMDB, and what sort of information is actually available in this data structure.
While I was able to follow the examples here and perform the first two queries successfully (for number of outputs and key images, respectively), when I tried to adapt them to queries about the number of transactions it didn't seem to work:
$ mdb_stat -s output_txs ~/.bitmonero/lmdb
Status of output_txs
Tree depth: 1
Branch pages: 0
Leaf pages: 1
Overflow pages: 0
Entries: 30668498
$ mdb_stat -s spent_keys ~/.bitmonero/lmdb
Status of spent_keys
Tree depth: 1
Branch pages: 0
Leaf pages: 1
Overflow pages: 0
Entries: 26564596
$ mdb_stat -s txs ~/.bitmonero/lmdb
Status of txs
Tree depth: 0
Branch pages: 0
Leaf pages: 0
Overflow pages: 0
Entries: 0
Does that mean that I am doing a badly formed search, or is it that txs is not yet populated with transaction data?
I understand that there exists a manual for mdb_stat itself, so maybe it is just me, but I figured that everyone could benefit from having a more explicit and comprehensive guide with examples specific to Monero's database.
Thanks in advance!
tx_indicesandtx_outputshave the same number of entries. I wonder if those are the number of transactions on the blockchain? I know I could find that out by readingcryptonote_basic.hbut I don't understand cpp. Am I out of luck in that case?// The entire thing is way more low level than I was hoping for. It looks like it is going to be a challenge to get a tool that grabs all the information I wanted quickly and efficiently. Thanks for the links! // PS.: in your last line, a letter is flipped, mbd should be mdb. – user141 Feb 24 '19 at 01:56output_txsshowed the total number of outputs, not transactions. – user141 Feb 24 '19 at 23:36