Get transaction fees per transaction via gettransaction 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?
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:


run bitcoin-cli getblockhash &lt;block number&gt;
run bitcoin-cli getblock &lt;result from 1&gt;


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.