<p>Whenever I try to get a raw transaction I get an error:</p>
<pre><code>ubuntu@btc:~$ bitcoin-cli getrawtransaction 2157b554dcfda405233906e461ee593875ae4b1b97615872db6a25130ecc1dd6
error code: -5
error message:
No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
</code></pre>
<p>Startup text:</p>
<pre><code>ubuntu@btc:~$ bitcoind
2021-07-20T11:26:08Z Bitcoin Core version v0.21.0 (release build)
2021-07-20T11:26:08Z Assuming ancestors of block 0000000000000000000b9d2ec5a352ecba0592946514a92f14319dc2b367fc72 have valid signatures.
2021-07-20T11:26:08Z Setting nMinimumChainWork=00000000000000000000000000000000000000001533efd8d716a517fe2c5008
2021-07-20T11:26:08Z Using the 'standard' SHA256 implementation
2021-07-20T11:26:10Z Default data directory /home/ubuntu/.bitcoin
2021-07-20T11:26:10Z Using data directory /mnt/btc/bitcoin
2021-07-20T11:26:10Z Config file: /mnt/btc/bitcoin/bitcoin.conf
2021-07-20T11:26:10Z Config file arg: datadir=&quot;/mnt/btc/bitcoin&quot;
2021-07-20T11:26:10Z Using at most 125 automatic connections (1024 file descriptors available)
2021-07-20T11:26:10Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2021-07-20T11:26:10Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2021-07-20T11:26:10Z Script verification uses 3 additional threads
2021-07-20T11:26:10Z scheduler thread start
2021-07-20T11:26:10Z HTTP: creating work queue of depth 16
2021-07-20T11:26:10Z Using random cookie authentication.
2021-07-20T11:26:10Z Generated RPC authentication cookie /mnt/btc/bitcoin/.cookie
2021-07-20T11:26:10Z HTTP: starting 4 worker threads
2021-07-20T11:26:10Z Using wallet directory /mnt/btc/bitcoin
2021-07-20T11:26:10Z init message: Verifying wallet(s)...
2021-07-20T11:26:10Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2021-07-20T11:26:10Z Using wallet /mnt/btc/bitcoin/wallet.dat
2021-07-20T11:26:10Z BerkeleyEnvironment::Open: LogDir=/mnt/btc/bitcoin/database ErrorFile=/mnt/btc/bitcoin/db.log
2021-07-20T11:26:10Z init message: Loading banlist...
2021-07-20T11:26:10Z SetNetworkActive: true
2021-07-20T11:26:10Z Using /16 prefix for IP bucketing
2021-07-20T11:26:10Z Cache configuration:
2021-07-20T11:26:10Z * Using 2.0 MiB for block index database
2021-07-20T11:26:10Z * Using 8.0 MiB for chain state database
2021-07-20T11:26:10Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2021-07-20T11:26:10Z init message: Loading block index...
2021-07-20T11:26:10Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2021-07-20T11:26:10Z Opening LevelDB in /mnt/btc/bitcoin/blocks/index
2021-07-20T11:26:10Z Opened LevelDB successfully
2021-07-20T11:26:10Z Using obfuscation key for /mnt/btc/bitcoin/blocks/index: 0000000000000000
2021-07-20T11:26:25Z LoadBlockIndexDB: last block file = 2659
2021-07-20T11:26:25Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=13, size=17474216, heights=691844...691858, time=2021-07-20...2021-07-20)
2021-07-20T11:26:25Z Checking all blk files are present...
2021-07-20T11:26:30Z Opening LevelDB in /mnt/btc/bitcoin/chainstate
2021-07-20T11:26:33Z Opened LevelDB successfully
2021-07-20T11:26:34Z Using obfuscation key for /mnt/btc/bitcoin/chainstate: 811ac9000cfb37f2
2021-07-20T11:26:34Z Loaded best chain: hashBestChain=0000000000000000000ed3eb1261750ddecb760d5914bc724963a65be5048d20 height=691858 date=2021-07-20T11:11:59Z progress=0.999995
2021-07-20T11:26:34Z init message: Rewinding blocks...
2021-07-20T11:26:35Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2021-07-20T11:26:35Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2021-07-20T11:26:35Z init message: Verifying blocks...
2021-07-20T11:26:35Z Verifying last 6 blocks at level 3
2021-07-20T11:26:35Z [0%]...[16%]...[33%]...[
</code></pre>
<p>Bitcoin conf:</p>
<pre><code>datadir=/mnt/btc/bitcoin
maxconnections=20
maxuploadtarget=144
disablewallet=1
txindex=1
maxmempool=4000
minrelaytxfee=0.0001
</code></pre>
<p>Blockchain info:</p>
<pre><code>ubuntu@btc:~$ bitcoin-cli getblockchaininfo
{
  &quot;chain&quot;: &quot;main&quot;,
  &quot;blocks&quot;: 691860,
  &quot;headers&quot;: 691860,
  &quot;bestblockhash&quot;: &quot;00000000000000000009854076e894e617436163762f9e2ec46f616a2183f372&quot;,
  &quot;difficulty&quot;: 13672594272814.14,
  &quot;mediantime&quot;: 1626778212,
  &quot;verificationprogress&quot;: 0.9999992519720163,
  &quot;initialblockdownload&quot;: false,
  &quot;chainwork&quot;: &quot;00000000000000000000000000000000000000001fab3f9dd4dc1be7d6339a98&quot;,
  &quot;size_on_disk&quot;: 403608388760,
  &quot;pruned&quot;: false,
  ...
}
</code></pre>
<p>How can I fix this error?</p>

CC BY-SA 4.0
2021-07-20T12:59:01.657Z
Are you sure your node is using the bitcoin.conf? Have you tried enabling txindex using the CLI option?
Vojtěch Strnad
CC BY-SA 4.0
2021-07-20T14:08:16.057Z
It does mention `Config file: /mnt/btc/bitcoin/bitcoin.conf`. I enabled it on command line an it now says `error code: -5
error message:
No such mempool transaction. Blockchain transactions are still in the process of being indexed. Use gettransaction for wallet transactions.`
tread
CC BY-SA 4.0
2021-07-20T14:29:40.850Z
Great, now you only need to wait for the indexing to finish and you'll have your txindex. In the meantime you can try to figure out why exactly your bitcoin.conf file isn't being read correctly.
Vojtěch Strnad
CC BY-SA 4.0
2021-07-22T05:10:28.293Z
Where is your bitcoin.conf located? It looks like it is not parsing any of the other arguments in your conf file, otherwise there would be multiple `Config file arg` lines, but there's only one for the datadir.
Ava Chow
CC BY-SA 4.0
2021-07-22T06:41:26.053Z
I had 2. One was in `~/.bitcoin/bitcoin.conf` that contained just `datadir=/mnt/btc/bitcoin`. In `/mnt/btc/bitcoin/bitcoin.conf` was the other one - that was not being read. So I moved the contents of it into `~/.bitcoin/bitcoin.conf`. I am still unsure how to use a different conf file location.
tread
<full-node>
How to get the raw transaction on my node with txindexset to 1?
tread
# How to get the raw transaction on my node with txindexset to 1?

(Asked by: username_0 on 2021-07-20)

Whenever I try to get a raw transaction I get an error:

```
ubuntu@btc:~$ bitcoin-cli getrawtransaction 2157b554dcfda405233906e461ee593875ae4b1b97615872db6a25130ecc1dd6
error code: -5
error message:
No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.

```

Startup text:

```
ubuntu@btc:~$ bitcoind
2021-07-20T11:26:08Z Bitcoin Core version v0.21.0 (release build)
2021-07-20T11:26:08Z Assuming ancestors of block 0000000000000000000b9d2ec5a352ecba0592946514a92f14319dc2b367fc72 have valid signatures.
2021-07-20T11:26:08Z Setting nMinimumChainWork=00000000000000000000000000000000000000001533efd8d716a517fe2c5008
2021-07-20T11:26:08Z Using the 'standard' SHA256 implementation
2021-07-20T11:26:10Z Default data directory /home/ubuntu/.bitcoin
2021-07-20T11:26:10Z Using data directory /mnt/btc/bitcoin
2021-07-20T11:26:10Z Config file: /mnt/btc/bitcoin/bitcoin.conf
2021-07-20T11:26:10Z Config file arg: datadir="/mnt/btc/bitcoin"
2021-07-20T11:26:10Z Using at most 125 automatic connections (1024 file descriptors available)
2021-07-20T11:26:10Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2021-07-20T11:26:10Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2021-07-20T11:26:10Z Script verification uses 3 additional threads
2021-07-20T11:26:10Z scheduler thread start
2021-07-20T11:26:10Z HTTP: creating work queue of depth 16
2021-07-20T11:26:10Z Using random cookie authentication.
2021-07-20T11:26:10Z Generated RPC authentication cookie /mnt/btc/bitcoin/.cookie
2021-07-20T11:26:10Z HTTP: starting 4 worker threads
2021-07-20T11:26:10Z Using wallet directory /mnt/btc/bitcoin
2021-07-20T11:26:10Z init message: Verifying wallet(s)...
2021-07-20T11:26:10Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2021-07-20T11:26:10Z Using wallet /mnt/btc/bitcoin/wallet.dat
2021-07-20T11:26:10Z BerkeleyEnvironment::Open: LogDir=/mnt/btc/bitcoin/database ErrorFile=/mnt/btc/bitcoin/db.log
2021-07-20T11:26:10Z init message: Loading banlist...
2021-07-20T11:26:10Z SetNetworkActive: true
2021-07-20T11:26:10Z Using /16 prefix for IP bucketing
2021-07-20T11:26:10Z Cache configuration:
2021-07-20T11:26:10Z * Using 2.0 MiB for block index database
2021-07-20T11:26:10Z * Using 8.0 MiB for chain state database
2021-07-20T11:26:10Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2021-07-20T11:26:10Z init message: Loading block index...
2021-07-20T11:26:10Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2021-07-20T11:26:10Z Opening LevelDB in /mnt/btc/bitcoin/blocks/index
2021-07-20T11:26:10Z Opened LevelDB successfully
2021-07-20T11:26:10Z Using obfuscation key for /mnt/btc/bitcoin/blocks/index: 0000000000000000
2021-07-20T11:26:25Z LoadBlockIndexDB: last block file = 2659
2021-07-20T11:26:25Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=13, size=17474216, heights=691844...691858, time=2021-07-20...2021-07-20)
2021-07-20T11:26:25Z Checking all blk files are present...
2021-07-20T11:26:30Z Opening LevelDB in /mnt/btc/bitcoin/chainstate
2021-07-20T11:26:33Z Opened LevelDB successfully
2021-07-20T11:26:34Z Using obfuscation key for /mnt/btc/bitcoin/chainstate: 811ac9000cfb37f2
2021-07-20T11:26:34Z Loaded best chain: hashBestChain=0000000000000000000ed3eb1261750ddecb760d5914bc724963a65be5048d20 height=691858 date=2021-07-20T11:11:59Z progress=0.999995
2021-07-20T11:26:34Z init message: Rewinding blocks...
2021-07-20T11:26:35Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2021-07-20T11:26:35Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2021-07-20T11:26:35Z init message: Verifying blocks...
2021-07-20T11:26:35Z Verifying last 6 blocks at level 3
2021-07-20T11:26:35Z [0%]...[16%]...[33%]...[

```

Bitcoin conf:

```
datadir=/mnt/btc/bitcoin
maxconnections=20
maxuploadtarget=144
disablewallet=1
txindex=1
maxmempool=4000
minrelaytxfee=0.0001

```

Blockchain info:

```
ubuntu@btc:~$ bitcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 691860,
  "headers": 691860,
  "bestblockhash": "00000000000000000009854076e894e617436163762f9e2ec46f616a2183f372",
  "difficulty": 13672594272814.14,
  "mediantime": 1626778212,
  "verificationprogress": 0.9999992519720163,
  "initialblockdownload": false,
  "chainwork": "00000000000000000000000000000000000000001fab3f9dd4dc1be7d6339a98",
  "size_on_disk": 403608388760,
  "pruned": false,
  ...
}

```

How can I fix this error?

**Tags:** full-node

> **Comments:**
> **username_1**: Are you sure your node is using the bitcoin.conf? Have you tried enabling txindex using the CLI option?  
> **username_0**: It does mention `Config file: /mnt/btc/bitcoin/bitcoin.conf`. I enabled it on command line an it now says `error code: -5 error message: No such mempool transaction. Blockchain transactions are still in the process of being indexed. Use gettransaction for wallet transactions.`  
> **username_1**: Great, now you only need to wait for the indexing to finish and you'll have your txindex. In the meantime you can try to figure out why exactly your bitcoin.conf file isn't being read correctly.  
> **username_2**: Where is your bitcoin.conf located? It looks like it is not parsing any of the other arguments in your conf file, otherwise there would be multiple `Config file arg` lines, but there's only one for the datadir.  
> **username_0**: I had 2. One was in `~/.bitcoin/bitcoin.conf` that contained just `datadir=/mnt/btc/bitcoin`. In `/mnt/btc/bitcoin/bitcoin.conf` was the other one - that was not being read. So I moved the contents of it into `~/.bitcoin/bitcoin.conf`. I am still unsure how to use a different conf file location.  

---

## 0 answers

