How can I read chainstate database?

4

1

1) What is the format of the LevelDB databases stored in the database directory?

I know there are some custom blockchain parsing libraries, such as this one, but I'm wondering if I can just do a read of the chainstate database to get some basic information about the UTXO set.

2) Is there some sort of a LevelDB database explorer GUI that I can use to see what's in this database?

3) Could I have a second program that just read from this database? Would it be safe or would I mess up the database if I tried this?

morsecoder

Posted 2014-10-06T14:51:21.197

Reputation: 12 624

https://github.com/hij1nx/levelwebNick ODell 2014-10-14T15:34:55.913

Answers

1

You can find how to read the blockchain leveldb (format and meaning of the keys) here: What are the keys used in the blockchain levelDB (ie what are the key:value pairs)?

no idea (yet) for the UTXO :-)

Vincent de Lagabbe

Posted 2014-10-06T14:51:21.197

Reputation: 121

1He talks about the unspent transaction set too. Ctrl-F Inside the chain state databaseNick ODell 2014-10-10T17:19:43.420

@Nick, could you elaborate further on how to get the UTXO set from the chainstate database? That sounds like the answer I am looking for. But many other coins don't have the chainstate database, so how would I do this for those coins?morsecoder 2014-10-14T14:41:21.703

@StephenM347 I don't think there's any *coin that doesn't have a transaction index or an unspent transaction index. Way too slow. Be more specific.Nick ODell 2014-10-14T15:36:19.140

In my ~/Application Support/Bitcoin/ directory, there is a chainstate directory, which I think has the database of UTXOs. In my ~/Application Support/PPCoin/ directory, though, there is no chainstate directory. Is the UTXO set stored somewhere else in PPCoin? Can you explain what you mean by "Ctrl-F Inside the chain state database"? Thanks!morsecoder 2014-10-14T15:53:11.197

@NickODell means: go to http://bitcoin.stackexchange.com/questions/28168/what-are-the-keys-used-in-the-blockchain-leveldb-ie-what-are-the-keyvalue-pair and search the sentence "Inside the chain state database" in your browser. Format of UTXO DB is explained here.

Vincent de Lagabbe 2014-11-03T15:14:13.470