2

For a research project I need to analyse all transactions that happened in 2015. All I care about are volumes transacted, fees paid and a timestamp per transaction or corresponding block.

Getting this data via APIs over the net creates lots of overhead and lets me run into rate limits (I cannot just run 50 million+ queries against blockchain.info or the coinbase-API).

So I would like to get the data out of my local instance of bitcoin-core.

Unfortunately running gettransaction fails both programatically and via the commandline, despite the fact that I'm running bitcoind with the -reindex flag enabled:

{ [Error: Invalid or non-wallet transaction id] code: -5 }

I resorted to using getrawtransaction 1 which, unfortunately, only returns the transacted volumes per output. I take the txid of inputs and query the local instance again. A tedious-error prone process, I would like to know whether there is an easier way.

So, can somebody please help me with getting gettransaction working?

2

If you want to get the gettransaction command running, you would need to enable the txindex via bitcoind -reindex -txindex. Note this takes a few hours.

Alternatively, you can do the following:

  1. run bitcoin-cli getblockhash <block number>
  2. run bitcoin-cli getblock <result from 1>

This will give you the block time and all the transactions within the block in a nice JSON format. Iterate through all the txid's via:

bitcoin-cli getrawtransaction

Unfortunately, you'll have to look up all the inputs and see how much is in them in order to calculate the transaction fee using this method.

  • Thanks, I was unaware of the -txindex flag, I'm now letting my client reindex. The second method you describe is the one I've tried before. Unfortunately, tx.vin does not list the transaction volume with this method. – mxschumacher Dec 9 '15 at 17:59
  • Yea, looking up the original tx's can be a huge pain. It's not too hard if you write a script to do it for you, though. – Jimmy Song Dec 9 '15 at 18:01
  • 1
    So, now I did rerun bitcoin-core with the flags you've mentioned but the problem persists, e.g. same error message. Do you have any more tips? – mxschumacher Dec 10 '15 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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