How to use -txindex to enable blockchain transaction queries?

0

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.

Lalit Mohan

Posted 2019-02-21T06:28:49.480

Reputation: 103

Answers

1

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

cryptoKTM

Posted 2019-02-21T06:28:49.480

Reputation: 489

Always I have to add the -txindex flag to restart the daemon. Currently i am using bitcoind -deprecatedrpc=accounts to start a daemonLalit Mohan 2019-02-21T06:53:51.033

"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 2019-02-21T06:58:22.923

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 againcryptoKTM 2019-02-21T07:01:57.820

1I 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 2019-02-21T07:06:20.917

FYI " Use -txindex to enable blockchain transaction queries. " line has been removed from the error. this is a another error with error code -5Lalit Mohan 2019-02-21T07:08:22.963

check debug.log file for more infocryptoKTM 2019-02-21T07:30:14.860