Is it possible to use db other than leveldb for bitcoin core? I'd like to make queries on running node and make views with decoded data
1 Answer
There is no code for that, and it would be either very slow or nearly useless.
Bitcoin Core assumes it has exclusive access to the -database, and caches data very aggresively. It may take hours before actual data from the chain is on disk.
The data structures are very compact and specifically designed for efficient use in Bitcoin Core. This means only unspent transaction outputs and block/transaction disk location are written to the database, in a custom byte-level format. You'd have to write your own parsers for these. In the 0.12 release most of this data will be scrambled by default even, to thwart overly aggressive virus scanners that detect virus patterns inside the database.
In short, that's not what the database is intended for. If you want something to index the blockchain or query the UTXO set, there exist other projects that build databases specifically designed for that.
-
Thanks, what do you recommend to use to query DB for op_return data if I don't know in which block or tx it has been stored? Commented Nov 15, 2015 at 14:42
-
@IgorBarinov you need to parse the blockchain and check every transaction for op_return output in this block, or you can use coinsecrets.org API or BlockCypher asset API dev.blockcypher.com/#asset-api– FarghalyCommented Nov 15, 2015 at 17:50
-
@Farghaly thx. I found this one repo on github github.com/RCasatta/op_return with some analytics on op_return. check it out opreturn-976.appspot.com Commented Nov 15, 2015 at 18:05
-
@IgorBarinov it uses Google visualization API alongside with coinsecrets and Blockr API to show stats of op_return usage– FarghalyCommented Nov 15, 2015 at 18:21