<p>You're trying to use an optional feature of Bitcoin Core: the ability to query for old transactions.</p>
<p>This functionality needs:</p>
<ul>
<li>(a) the full blockchain (where else would it get the transaction from)</li>
<li>(b) an index by txid so it doesn't need to read through 270 GB to find what you're looking for.</li>
</ul>
<p>The error message you get is telling you that this (b) index is not enabled. When you try to enable it, it fails because you don't actually have the blockchain (a) in the first place (it's pruned), so it can't be indexed.</p>
<p>If you really need this functionality, you'll need to disable pruning, start syncing from scratch (as it'll need to download the blockchain again), and enable indexing.</p>
<p>However, you saying &quot;tried to verify&quot; perhaps highlights a misconception you have: <code>getrawtransaction</code> doesn't verify anything, it just retrieves the transaction in your local copy of the blockchain. Everything is already verified, even when it's not kept on disk. Generally when you care about a particular transaction, it's because it directly or indirectly affects your own funds, and the recommended solution for that is simply using good wallet software - it will only show you transactions that are verified and whose entire history is verified.</p>

CC BY-SA 4.0
2021-01-09T22:31:18.677Z
Thanks @Pieter, You're right, what I meant was to retrieve an old transaction not to verify it. Would you care tell me how to disable the pruning? and later how to enable indexing? should I simply add the reindex=1 and prune=1 in the configuration file?
Pishi
CC BY-SA 4.0
2021-01-09T22:25:03.007Z
2021-01-09T22:25:03.007Z
Pieter Wuille
<p>Here is the answer to my own question:</p>
<p>Prepare a Bitcoin.conf file ( you may use this form to generate one depending on your OS and what you need from the Bitcoin core to do: <a href="https://jlopp.github.io/bitcoin-core-config-generator/" rel="nofollow noreferrer">https://jlopp.github.io/bitcoin-core-config-generator/</a>).
To this file add the following lines</p>
<p>prune=0
txindex=1
reindex=1 ( this will start to download the entire blockchain again if you have already downloaded it before). Ignore this line if you're going to run the core for the first time. If you use this code to reindex the blockchain then make sure to remove it later on when the reindexing is done.</p>
<p>Good luck</p>

CC BY-SA 4.0
2021-01-14T18:51:38.870Z
Be aware if you do this, the blockchain will be reindexed every time you start. You only want to have reindex=1 once; after that, you want to remove the line (it'll continue where it left off instead of starting over).
Pieter Wuille
CC BY-SA 4.0
2021-01-14T18:47:16.670Z
2021-01-14T18:47:16.670Z
Pishi
<p>I'm new to running a full bitcoin node. After almost a week I could download the entire blockchain. My computer is running 24/7 to support the cause.
When I tried to verify some old transactions that I have in the Bitcoin Core's console (version 0.20.1) I receive some error that I don't understand and my searches didn't help me resolve this issue.</p>
<p>I run this code in the console:
<em>getrawtransaction transaction ID true</em></p>
<p><strong>I paste the IDs for my past transactions</strong></p>
<p>This code returns an error message saying:</p>
<p><em>No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions. (code -5)</em></p>
<p>It is worth mentioning that I don't use Bitcoin Core's wallet.I use a third-party wallet.</p>
<p>I created the <em>bitcoin.conf</em> file as follows (placed in ~/.bitcoin/bitcoin.conf) :</p>
<p><em>txindex=1</em></p>
<p>When I ran the bitcoin-qt I got the error message:</p>
<p><em>Error: Prune mode is incompatible with -txindex.</em></p>
<p>I was wondering if someone could help me resolve this issue?</p>
<p>Thanks</p>

<transactions><verification><pruning><txindex><getrawtransaction>
Retrieving Old Transaction in Bitcoin Core's console -getrawtransactions returns "no such mempool transaction" error
Pishi
# Retrieving Old Transaction in Bitcoin Core's console -getrawtransactions returns "no such mempool transaction" error

(Asked by: username_0 on 2021-01-09)

I'm new to running a full bitcoin node. After almost a week I could download the entire blockchain. My computer is running 24/7 to support the cause.
When I tried to verify some old transactions that I have in the Bitcoin Core's console (version 0.20.1) I receive some error that I don't understand and my searches didn't help me resolve this issue.

I run this code in the console:
*getrawtransaction transaction ID true*

**I paste the IDs for my past transactions**

This code returns an error message saying:

*No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions. (code -5)*

It is worth mentioning that I don't use Bitcoin Core's wallet.I use a third-party wallet.

I created the *bitcoin.conf* file as follows (placed in ~/.bitcoin/bitcoin.conf) :

*txindex=1*

When I ran the bitcoin-qt I got the error message:

*Error: Prune mode is incompatible with -txindex.*

I was wondering if someone could help me resolve this issue?

Thanks

**Tags:** transactions, verification, pruning, txindex, getrawtransaction


---

## 2 answers

### Answer by username_1 on 2021-01-09. Score: 1

You're trying to use an optional feature of Bitcoin Core: the ability to query for old transactions.

This functionality needs:

* (a) the full blockchain (where else would it get the transaction from)
* (b) an index by txid so it doesn't need to read through 270 GB to find what you're looking for.

The error message you get is telling you that this (b) index is not enabled. When you try to enable it, it fails because you don't actually have the blockchain (a) in the first place (it's pruned), so it can't be indexed.

If you really need this functionality, you'll need to disable pruning, start syncing from scratch (as it'll need to download the blockchain again), and enable indexing.

However, you saying "tried to verify" perhaps highlights a misconception you have: `getrawtransaction` doesn't verify anything, it just retrieves the transaction in your local copy of the blockchain. Everything is already verified, even when it's not kept on disk. Generally when you care about a particular transaction, it's because it directly or indirectly affects your own funds, and the recommended solution for that is simply using good wallet software - it will only show you transactions that are verified and whose entire history is verified.

> **Comments:**
> **username_0**: Thanks @username_1, You're right, what I meant was to retrieve an old transaction not to verify it. Would you care tell me how to disable the pruning? and later how to enable indexing? should I simply add the reindex=1 and prune=1 in the configuration file?  

---

### Answer by username_0 on 2021-01-14. Score: 0

Here is the answer to my own question:

Prepare a Bitcoin.conf file ( you may use this form to generate one depending on your OS and what you need from the Bitcoin core to do: <https://jlopp.github.io/bitcoin-core-config-generator/>).
To this file add the following lines

prune=0
txindex=1
reindex=1 ( this will start to download the entire blockchain again if you have already downloaded it before). Ignore this line if you're going to run the core for the first time. If you use this code to reindex the blockchain then make sure to remove it later on when the reindexing is done.

Good luck

> **Comments:**
> **username_1**: Be aware if you do this, the blockchain will be reindexed every time you start. You only want to have reindex=1 once; after that, you want to remove the line (it'll continue where it left off instead of starting over).  

---

