I am trying to check if a transaction is confirmed or not via RPC commands. At first I tried to use gettransaction, but it doesn't work.

Then I use getrawtransaction and decode it:

         "script_string":"OP_DUP OP_HASH160 0f14a815e42dcdff9c8239a7393b2a9a63a8b68d OP_EQUALVERIFY OP_CHECKSIG",

And I got the above result. But I don't understand what is written, how can I know if it has been confirmed without relying on Blockexplorer?


1 Answer 1


The decoderawtransaction RPC call oddly omits the confirmations field in the resulting JSON output. Instead of using decoderawtransaction, try this:

$ bitcoin-cli getrawtransaction <tx_id> true

(Notice the "true" at the end, which means "output as json")

This will return JSON that has a "confirmations" field in the top level of the returned object.

  • hi thanks for the reply... but i am getting Error: value is type bool, expected int Jan 25, 2018 at 10:54
  • @OneyesOneno ah sorry, we might be on different versions. try: bitcoin-cli getrawtransaction <tx_id> 1
    – Tony Rizko
    Jan 25, 2018 at 11:07
  • hii... its me again.. i try 1 , it return  parameter 1 must be hexadecimal string (not '04e66db5c1dc6471c6e518636ed66f99cbb853a2bb3303cd0a60403d49e66a4') (code -8) .. then it try getrawtransaction (tx_id) verbose = it return Error: Error parsing JSON:verbose Jan 25, 2018 at 12:02
  • hi @OneyesOneno, it looks like the hex string you are providing is invalid: (04e66db5c1dc6471c6e518636ed66f99cbb853a2bb3303cd0a60403d49e‌​66a4). You are missing 3 more hex digits.
    – Tony Rizko
    Jan 25, 2018 at 20:10
  • wow you are absolutely right about it. Thanks you so much! Jan 26, 2018 at 1:15

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.