<p>use </p>

<pre><code>txindex = 1
</code></pre>

<p>in you bitcoin.conf file and restart daemon with -reindex flag if you are building it for the first time, it might take a while but after txindex is defined you can get data for any transaction in blockchain no matter if its related to your wallet or not.  </p>

<p>Alternetivly you can start your daemon with </p>

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

<p>Either way it functions the same</p>

CC BY-SA 4.0
2019-02-21T06:53:51.033Z
Always I have to add the -txindex flag to restart the daemon. Currently i am using bitcoind -deprecatedrpc=accounts to start a daemon
Lalit Mohan
CC BY-SA 4.0
2019-02-21T06:58:22.923Z
"Use -txindex to enable blockchain transaction queries." line has been removed from the error But I am still getting the following error "No such mempool or blockchain transaction. Use gettransaction for wallet transactions."
Lalit Mohan
CC BY-SA 4.0
2019-02-21T07:01:57.820Z
add txindex=1 and reindex=1 in your bitcoin.conf file, and make sure you start your daemon with -reindex=1 for the first time, it will take a while for your blockchain to reindex ,the progress can be seen in debug.log , after the reindexing is done you should not encounter same error again
Parishilan Rayamajhi
CC BY-SA 4.0
2019-02-21T07:06:20.917Z
I have added the txindex=1 and reindex=1 in your bitcoin.conf file and restarted the daemon with command "sudo bitcoind -daemon -txindex=1 -reindex=1" and still i am getting the following error "No such mempool or blockchain transaction. Use gettransaction for wallet transactions."
Lalit Mohan
CC BY-SA 4.0
2019-02-21T07:08:22.963Z
FYI " Use -txindex to enable blockchain transaction queries. " line has been removed from the error. this is a another error with error code -5
Lalit Mohan
CC BY-SA 4.0
2019-02-21T07:30:14.860Z
check debug.log file for more info
Parishilan Rayamajhi
CC BY-SA 4.0
2019-02-21T06:44:30.747Z
2019-02-21T06:53:42.307Z
2019-02-21T06:53:42.307Z
Parishilan Rayamajhi
<p>I am trying getting the raw of transaction. But I am getting the following error with following command and  RPC call as well.</p>

<blockquote>
  <p>bitcoin-cli getrawtransaction ad844933ceb9cf990fd75ebd2f6731527885e31d1a4c9ea292db235bcd64bdbe</p>
</blockquote>

<p>Error 
<code>No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions.</code></p>

<bitcoind><json-rpc><txindex>
How to use -txindex to enable blockchain transaction queries?
Lalit Mohan
# How to use -txindex to enable blockchain transaction queries?

(Asked by: username_0 on 2019-02-21)

I am trying getting the raw of transaction. But I am getting the following error with following command and RPC call as well.

> bitcoin-cli getrawtransaction ad844933ceb9cf990fd75ebd2f6731527885e31d1a4c9ea292db235bcd64bdbe

Error
`No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions.`

**Tags:** bitcoind, json-rpc, txindex


---

## 1 answers

### Answer by username_1 on 2019-02-21. Score: 2

use

```
txindex = 1

```

in you bitcoin.conf file and restart daemon with -reindex flag if you are building it for the first time, it might take a while but after txindex is defined you can get data for any transaction in blockchain no matter if its related to your wallet or not.

Alternetivly you can start your daemon with

```
 bitcoind -daemon -txindex=1 -reindex=1

```

Either way it functions the same

> **Comments:**
> **username_0**: Always I have to add the -txindex flag to restart the daemon. Currently i am using bitcoind -deprecatedrpc=accounts to start a daemon  
> **username_0**: "Use -txindex to enable blockchain transaction queries." line has been removed from the error But I am still getting the following error "No such mempool or blockchain transaction. Use gettransaction for wallet transactions."  
> **username_1**: add txindex=1 and reindex=1 in your bitcoin.conf file, and make sure you start your daemon with -reindex=1 for the first time, it will take a while for your blockchain to reindex ,the progress can be seen in debug.log , after the reindexing is done you should not encounter same error again  
> **username_0**: I have added the txindex=1 and reindex=1 in your bitcoin.conf file and restarted the daemon with command "sudo bitcoind -daemon -txindex=1 -reindex=1" and still i am getting the following error "No such mempool or blockchain transaction. Use gettransaction for wallet transactions."  
> **username_0**: FYI " Use -txindex to enable blockchain transaction queries. " line has been removed from the error. this is a another error with error code -5  
> **username_1**: check debug.log file for more info  

---

