3

I'm reading through Mastering Bitcoin and trying to follow along the examples.

When I first initialized bitcoind, I set txindex=1 in my bitcoin.conf file. In a later example I was unable to getrawtransaction which failed with the error No such mempool transaction. I re-ran bitcoind with the -txindex=1 and -reindex flags, which took a few hours.

However I'm still unable to getrawtransaction, which again fails with the same error.

Have anyone experienced the same issues? Perhaps there is something else that needs to be done for this to work in v0.16.0?

Any advice would be appreciated. Thanks.

Edit 1:

~/Library/Application Support/Bitcoin/bitcoin.conf:

txindex=1

~/Library/Application Support/Bitcoin/debug.log:

Dropbox link

Aleksander
  • 133
  • 5
  • Can you give an example of a txid that fails like this? – Nate Eldredge Apr 22 '18 at 19:45
  • @NateEldredge any transaction without an unspent output really, just as expected if `txindex` was set to `0`. For an example, the below transactions give me that error: `3fd3431462b46b4adc8e3da663582993ecbfebf62ef7de4d81115b235a5020de` `331dd436aebeb22c9b629d6a769fd3f679e18ca4c6c34b15d6b3ab9ce936cd05` `45ea0a3f6016d2bb90ab92c34a7aac9767671a8a84b9bcce6c019e60197c134b` – Aleksander Apr 22 '18 at 20:40
  • Is bitcoind fully reindexed? Can you post the contents of your bitcoin.conf and debug.log files? – Andrew Chow Apr 22 '18 at 21:47
  • @AndrewChow added to the original question – Aleksander Apr 22 '18 at 22:39

1 Answers1

3

According to your debug.log file, txindex is not enabled:

2018-04-22 20:40:34 LoadBlockIndexDB: transaction index disabled

This indicates that your bitcoin.conf is incorrect. Make sure that your bitcoin.conf file's full filename is actually bitcoin.conf (not bitcoin.conf.txt or with some other extension).

Andrew Chow
  • 67,209
  • 5
  • 76
  • 149
  • You're right, it seems as though the paths confused me a little. I specified `~/Library/Application Support/Bitcoin/bitcoin.conf` instead of `~/Library/Application\ Support/Bitcoin/bitcoin.conf` which ended up saving the file as `~/Library/Application`. However I'm still a little confused as to what went down during the almost full day it spent reindexing when I ran `bitcoind -txindex=1` and subsequently `bitcoind -reindex`. I have however created the correct `bitcoin.conf` file now and will reindex and try again. – Aleksander Apr 23 '18 at 01:17
  • Whenever you start with `-reindex`, the blockchain will be read off disk and all of the block and chainstate databases will be rebuilt. This will happen for all `-reindex`s regardless of `-txindex`. With `-txindex`, the reindex will do the same but include more data in the databases it builds. Specifying `-reindex` will reindex even if one is not required. – Andrew Chow Apr 23 '18 at 01:43
  • Great, thank you so much for that information. It was very helpful! – Aleksander Apr 23 '18 at 02:53