<p>txindex=1 has to be added in the bitcoin.conf file.</p>

<p>When starting the node, the following command should be issued</p>

<pre><code>bitcoind -reindex=1 -daemon
</code></pre>

<p>You can keep checking the debug.log file in the .bitcoin folder to see the progress of blockchain synchronisation</p>

<p>Until you have downloaded the entire blockchain and reindexed, getblockcount will keep returning 0.</p>

CC BY-SA 4.0
2018-06-28T10:29:58.567Z
Thank you for your answer. Is ist really necessary to add `txindex=1`in the bitcoin.conf file or is it also sufficient to run `bitcoind` with `txindex=1` parameter?
Hans Dampf
CC BY-SA 4.0
2018-06-28T12:32:32.933Z
adding it to conf file makes sure it will reindex everytime it syncs. In case you forgot to add the reindex option while starting bitcoind.
Shabahat M. Ayubi
CC BY-SA 4.0
2018-06-28T09:41:18.010Z
2018-06-28T09:41:18.010Z
Shabahat M. Ayubi
<p>I am running Bitcoin Core Deamon version v0.16.0.0 on Ubuntu and need to call the getrawtransaction command for some TX. </p>

<p>To use the getrawtransaction I need to run bitcoin core with txindex=1.
But if I am running with txindex=1 it says that I have to run the core with reindex or reindex-chainstate.</p>

<p>So I did run first 
<code>bitcoind -reindex-chainstate</code>
and then
<code>bitcoind -txindex=1</code> and it still says that I have to run with reindex or reindex-chainstate.
So I tried to run
<code>bitcoind -txindex=1 -reindex-chainstate</code>  but still says run it with reindex or reindex-chainstate.
Now I am running <code>bitcoind -txindex=1 -reindex</code></p>

<p>Is this the correct way? And is it normal that <code>bitcoin-cli getblockcount</code>is stuck on <code>0</code>?</p>

<bitcoin-core><bitcoind><reindex>
Issue with getrawtransaction txindex and reindex
Hans Dampf
# Issue with getrawtransaction txindex and reindex

(Asked by: username_0 on 2018-06-28)

I am running Bitcoin Core Deamon version v0.16.0.0 on Ubuntu and need to call the getrawtransaction command for some TX.

To use the getrawtransaction I need to run bitcoin core with txindex=1.
But if I am running with txindex=1 it says that I have to run the core with reindex or reindex-chainstate.

So I did run first
`bitcoind -reindex-chainstate`
and then
`bitcoind -txindex=1` and it still says that I have to run with reindex or reindex-chainstate.
So I tried to run
`bitcoind -txindex=1 -reindex-chainstate` but still says run it with reindex or reindex-chainstate.
Now I am running `bitcoind -txindex=1 -reindex`

Is this the correct way? And is it normal that `bitcoin-cli getblockcount`is stuck on `0`?

**Tags:** bitcoin-core, bitcoind, reindex


---

## 1 answers

### Answer by username_1 on 2018-06-28. Score: 3 | Accepted answer

txindex=1 has to be added in the bitcoin.conf file.

When starting the node, the following command should be issued

```
bitcoind -reindex=1 -daemon

```

You can keep checking the debug.log file in the .bitcoin folder to see the progress of blockchain synchronisation

Until you have downloaded the entire blockchain and reindexed, getblockcount will keep returning 0.

> **Comments:**
> **username_0**: Thank you for your answer. Is ist really necessary to add `txindex=1`in the bitcoin.conf file or is it also sufficient to run `bitcoind` with `txindex=1` parameter?  
> **username_1**: adding it to conf file makes sure it will reindex everytime it syncs. In case you forgot to add the reindex option while starting bitcoind.  

---

