4

I am going to write software that gets information from the blockchain directly.

Are there any tools or libraries to speed up that process? I am looking for things like decoding and encoding transactions, verifying signatures, scanning for certain data etc.

Preferred languages: Python or C/C++.

haael
  • 183
  • 1
  • 5

1 Answers1

4

You probably make the right decision to not use one of the centralized API (blockchain.com, etc.). Run you own bitcoin-core fullnode(s) and connect to the RPC or REST interface.

You could connect via python with things like http://laanwj.github.io/bitcoin-python/doc/examples.html or any other RPC client.

If you need blocks / headers / chaininfos and transactions, consider enabling bitcoind -txindex and access data over the REST API (https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md).

If you need to verify scripts, you could use libbitcoinconsensus. There is a verify function:

EXPORT_SYMBOL int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
                                    const unsigned char *txTo        , unsigned int txToLen,
                                    unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err);

Bitpays insight is also a nice library (https://github.com/bitpay/insight) but it's javascript node.js based.

Jonas Schnelli
  • 5,992
  • 1
  • 20
  • 33