Bitcoind with -txindex=1 still no mempool transactions

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

Posted 2018-04-22T19:21:26.453

Reputation: 133

Can you give an example of a txid that fails like this?Nate Eldredge 2018-04-22T19:45:21.243

@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 45ea0a3f6016d2bb90ab92c34a7aac9767671a8a84b9bcce6c019e60197c134bAleksander 2018-04-22T20:40:45.073

Is bitcoind fully reindexed? Can you post the contents of your bitcoin.conf and debug.log files?Andrew Chow 2018-04-22T21:47:26.973

@AndrewChow added to the original questionAleksander 2018-04-22T22:39:32.200

Answers

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

Posted 2018-04-22T19:21:26.453

Reputation: 40 910

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 2018-04-23T01:17:02.673

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 -reindexs 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 2018-04-23T01:43:22.193

Great, thank you so much for that information. It was very helpful!Aleksander 2018-04-23T02:53:05.747