I am reading "Mastering Bitcoin" written by Andreas and I found this explanation about "txindex option"

Transaction Database Index and txindex Option

By default, Bitcoin Core builds a database containing only the transactions related to the user’s wallet. If you want to be able to access any transaction with commands like gettransaction, you need to configure Bitcoin Core to build a complete transaction index, which can be achieved with the txindex option. Set txindex=1 in the Bitcoin Core configuration file

I am not sure what situations should I enable the option. In my understanding, I can set txindex=0 if I use bitcoind as just a transmission tool of Bitcoin so that I can save data and time to sync the blockchain data. Otherwise, if I intend to make a blockexplore site like Blockchain.info, I need to set txindex=1.

Is my understanding of this correct?

4 Answers 4


If you're using Bitcoin Core just for your own personal use, you probably don't need the -txindex=1 option. But, if you're using Bitcoin core for development or blockchain analysis of some sort, you will need to set -txindex=1 to be able to get transactions data for any transaction in the blockchain.

The tradeoff is just that keeping an index is slightly slower, but allows you to do things like:

bitcoin-cli getrawtransaction aec2729f5e46750b310b6feadcf853098aa86df74f93322a701c29cd68b22568 

(where aec2729f5e46750b310b6feadcf853098aa86df74f93322a701c29cd68b22568 is the ID of a transaction that does not affect your wallet at all).

Also, if you have been running your client for a while but haven't had txindex=1 set, then it might take a few hours to build the index. If you want to rebuild, launch with the -reindex option.

  • 1
    ♦ Thank you very much for your prompt reply. I understood it. I expected that I could save a lot of time to sync the blockchain but it would be not true as far as I read your answer.
    – zono
    Jan 24, 2015 at 16:32
  • 1
    Does setting txindex=1 or reindex=1 cause a new download? The prod chain is so big, I would like to avoid that if possible. Apr 3, 2017 at 13:42
  • @SteveHibbert no, it doesn't re-download the data, because you should already have the data on disk, it just reprocesses the data you have. It is still time consuming, though.
    – morsecoder
    Apr 3, 2017 at 13:52
  • @StephenM347 Great, thanks for that, much obliged. Apr 3, 2017 at 15:17

By default -txindex=0 Bitcoin Core doesn't maintain any transaction-level data except for those

  • in the mempool or relay set
  • pertinent to addresses in your wallet
  • pertinent to your "watch-only" addresses

If "txindex" is set to true (1), Bitcoin Core maintains an index of all transactions that have ever happened, which you can query using the remote procedure call (RPC) method getrawtransaction or the RESTful API call get-tx.

Several popular wallet and "block explorer" programs require -txindex=1. Note that txindex does not alter the behavior of Bitcoin's peer-to-peer interface.

  • 6
    Funny because I Googled into this and found myself reading an answer that was flat-out wrong. To my surprise when I got to the end, I saw my own name! I just rewrote my answer. Jul 7, 2015 at 15:37
  • Bitcoin core does maintain transaction-level data for all unspents, regardless of whether the address belongs to you or not. Otherwise it won't be able to validate incoming transactions.
    – k kurokawa
    Aug 1, 2015 at 20:30
  • @kaykurokawa : I don't know precisely what's included in the "relay set" but that's the terminology consistently used by the developer documentation on bitcoin.org. Of course it must include unspents, but what else is in there? Aug 2, 2015 at 21:34
  • ah I see, I was not aware of that term.
    – k kurokawa
    Aug 3, 2015 at 3:40
  • @chrisamesen That's really cool- It didn't occur to me wiki information correction also works with your past and future selves.
    – cmc
    Nov 16, 2017 at 18:29

In addition, txindex=1 used to be required if you wanted to use LND (lightning network daemon). See https://github.com/lightningnetwork/lnd/pull/751

  • @Janus: I've rejected your edit since it changes the content of the answer completely. You should rather add a new answer to mention ElectrumX.
    – Murch
    Dec 16, 2018 at 20:37

In addition to the other answers, txindex=1 is required if you want to use your wallet with Counterparty.

See the installation instructions at https://github.com/CounterpartyXCP/counterparty-lib

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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