Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: u87982 on October 24, 2017, 01:52:07 AM



Title: "No such mempool transaction" When Trying to Get a Raw Transaction
Post by: u87982 on October 24, 2017, 01:52:07 AM
I'm using Bitcoin core and trying to get a raw transaction using the command:

bitcoin-cli getrawtransaction d5ada064c6417ca25c4308bd158c34b77e1c0eca2a73cda16c737e7424afba2f

It's a transaction in the block at height 277316.  I'm getting the message "No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions."  It sounds like I'm supposed to use a -txindex option but when I type "bitcoin-cli help getrawtransaction" it doesn't say anything about this option and it doesn't work when I try it.  What does this message mean and how do I resolve it?  The other weird thing is that it works with some transactions in the block, but not all.  There are 419 transactions in that block and for 34 of them, the getrawtransaction command works the way I'm trying to use it.  All the rest fail. 

I've seen another post where it says that this message can sometimes mean that it's a transaction that was never accepted by the network, but I just started my full node and downloaded a fresh copy of the blockchain a few days ago and the transactions that are giving me errors show up on https://blockexplorer.com/blocks.  Thanks!


Title: Re: "No such mempool transaction" When Trying to Get a Raw Transaction
Post by: Taras on October 24, 2017, 02:34:25 AM
If you don't have -txindex set, you can't use getrawtransaction anywhere you want. You'll have to run bitcoin with the -txindex option set.

That transaction is confirmed, very deeply. You just can't see it, because your client isn't indexing it.

In bitcoin.conf, you might be able to add a line that says txindex=1 and then it will work (after it goes through your copy of the blockchain creating a database of all the transactions in it!) but if that doesn't work then just run bitcoin-qt or bitcoind with the -txindex=1 option in the command line.

A lot of people try to test if they have txindex by checking if they can use this command on the transaction in the genesis block, but it is specifically excluded, so don't get confused just in case you try to do that.


Title: Re: "No such mempool transaction" When Trying to Get a Raw Transaction
Post by: HCP on October 24, 2017, 03:39:06 AM
getrawtransaction will only work for transactions that your wallet is indexing... by default, it only indexes transactions that actually affect your wallet (ie. incoming and outgoing transactions to your wallet addresses)... or are currently in the mempool of your node.

If you use the -txindex=1 commandline argument (or add it to your bitcoin.conf), then Bitcoin Core will index EVERY transaction in the blockchain, and you'll be able to retrieve the information for them all, regardless of whether or not the transaction involves an address in your wallet or is in the mempool of your node.


Title: Re: "No such mempool transaction" When Trying to Get a Raw Transaction
Post by: u87982 on October 24, 2017, 04:43:53 AM
I added txindex=1 to bitcoin.conf and restarted bitcoind and that did it :)  Thanks!


Title: Re: "No such mempool transaction" When Trying to Get a Raw Transaction
Post by: rrr2018 on January 11, 2018, 02:23:15 AM
I have the same problem with the  wallet ELECTRUM, was sent me bitcoinsBTC 10 January 2017, this amount was divided into several parts ,after 3-4 hours I saw part of the transaction in my wallet electrum , but this was not the full amount ,and they in the unconfirmed status ,and after 2-3 hours when I again opened his wallet electrum ,I found that are no more of these transactions . Now 24 hours passed , and these transactions have not appeared in my wallet . On the blockchain all of the transactions in full size available , but still unconfirmed! You tell me please, what to do ? Please help me ! I've read a lot of forums and a variety of tips , but so far to no avail
P.S. I've using version 3.05 ,updated yesterday , but the problem occurred before the update .



Title: Re: "No such mempool transaction" When Trying to Get a Raw Transaction
Post by: Valle on January 11, 2018, 05:15:41 AM
I wonder why getrawtransaction doesn't return proper error like "No indexed transactions, run app with txindex=1".


Title: Re: "No such mempool transaction" When Trying to Get a Raw Transaction
Post by: ranochigo on January 11, 2018, 11:35:40 AM
I wonder why getrawtransaction doesn't return proper error like "No indexed transactions, run app with txindex=1".
It's not exactly useful for most users to get raw transactions for those that are confirmed. The client cannot tell if the user is trying to get an unconfirmed or confirmed transaction and it would just be a waste of time for users to index the transactions. Basic users just need information about their own transactions or from the mempool.