I am using bitcoin.rpc.RawProxy to connect to bitcoind and scrape the data. But I am getting an error when I gettransaction and I have to reindex the blockchain. Thus I am wondering how I set the txindex to 1 so I can reindex and continue.

up vote 2 down vote accepted

You can enable the txindex by either adding it to your bitcoin.conf file:

txindex=1

or

You can run bitcoind with the -txindex flag:

$ bitcoind -txindex

See:

$ bitcoind --help

    -txindex
       Maintain a full transaction index, used by the getrawtransaction rpc
       call (default: 0)
  • but reindexing is necessary correct? – SantiClaus Nov 18 at 6:08
  • Yes you might need to also use the -reindex flag. You might also want to set a higher -dbcache to speed it up. – JBaczuk Nov 18 at 16:19
  • One more question, and thanks again. If I do not shut out of the ubuntu command prompt correctly, for example if I have to restart it or if it shuts down unexpectedly, can it corrupt the data? – SantiClaus Nov 18 at 17:36
  • And will I know if the database is corrupted? For example, will the program notify me? – SantiClaus Nov 18 at 18:07
  • If you set the -daemon flag it will run in the background and you can close the terminal. If it shuts down, it may corrupt the data, but you should see errors in ~/.bitcoin/debug.log – JBaczuk Nov 18 at 18:16

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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