6

I'm using bitcoin-qt and have a local copy of the blockchain, in which I'm running some analysis with the JSON-RPC API using mostly getblock and getrawtransaction. I have no need writing or sending transactions in this use case. It's overkill to run a full node just to read the blockchain, and it hurts my analysis performance, too.

Is there a (preferrably tested) library to parse the blockchain and return objects, JSON or not? Language doesn't matter much. If not, is there a node implementation that allow turning off network and wallet features?

2
  • 1
    It should be easy with bitcoin-qt to effectively disable networking with something like -connect=0.0.0.0. And I don't think the wallet features should have much effect if you just don't use them. Feb 24, 2014 at 17:33
  • Here is the lightweight blockchain parser github.com/normanvolt/blockchain-parser Jun 22, 2018 at 14:48

3 Answers 3

5

There are a couple available:

https://github.com/znort987/blockparser Which is c++ based and has some basic analysis functions already written.

http://codesuppository.blogspot.com/2014/01/how-to-parse-bitcoin-blockchain.html describes the basics of parsing the block chain and links to code written by the author of the post.

It looks like most projects don't parse it directly and use the RPC interface of the main bitcoin client.

1

A good solution would be to use a trusted third-party that has already parsed the entire block chain for you. For example, the Blockchain.info API is quite well suited for your purpose.

Specifically what you want is the Block Explorer API which returns JSON objects.

1
  • 4
    Given that I have a local blockchain, I think it would be more efficient to reach my disk than the network. I've considered this option and the apparent lack of standalone tools bothers me.
    – Bruno Kim
    Feb 21, 2014 at 13:36
0

https://github.com/alecalve/python-bitcoin-blockchain-parser just parses the blkXXXXX.dat directly for you into Python, no servers needed. Likely much slower than the C++ option from https://bitcoin.stackexchange.com/a/22621/21282 , but good at least for quick prototyping since in Python.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.