0

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

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.

1
  • 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 Jan 9 at 22:31
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

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). – Pieter Wuille Jan 14 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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