bitcoin-cli getrawtransaction 0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2
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.
[Rohan@fedora bitcoin]$ 
  • Hi Rohan, you had originally tagged this question as “Mastering Bitcoin”. It was not clear to me what the connection to the book was, so I removed the tag. If you think that this question is connected to the book, could you please clarify what the connection is in your question’s text and add the tag back?
    – Murch
    Mar 29, 2023 at 18:40

1 Answer 1


The error code that you posted tells you why it’s not working:

  1. the transaction you are looking for is not in the mempool
  2. to query for a confirmed transaction, you need to either run a full node with transaction index or provide the block the transaction was in

Since you do not seem to be running your node with transaction index, you should try to provide the blockhash.

Per the RPC documentation we learn that getrawtransaction takes up to three arguments with the latter two being optional:

bitcoin-cli getrawtransaction "txid" ( verbose "blockhash" )

  • txid – the transaction you want to know about
  • verbose – false: return the hex-encoded full transaction, true: return a json object detailing the transaction
  • blockhash – the block the transaction was confirmed in

So I suspect that your node should tell you what you want to know if you call

bitcoin-cli getrawtransaction 0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2 <false/true> 0000000000000001b6b9a13b095e96db41c4a928b97ef2d944a9b31b2cc7bdc4

in this specific case.

  • Thank you for the help!
    – Indul
    Mar 31, 2023 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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