Home > Enterprise >  Is there a way to check the number of confirmations in a Blockchain hash? And check when the transac
Is there a way to check the number of confirmations in a Blockchain hash? And check when the transac

Time:04-11

I’ve been trying to look for a way to get the number of confirmations in a certain blockchain hash, but have gotten nowhere.

I’m basically trying to find a way to print when the said transaction becomes 4/4.

Could anyone please give me a starting guide? Thanks!

Edit:

I’ve tried things like https://blockchain.info/rawtx/$tx_hash using requests, I still cannot find a way to get the amount of confirmations and wait til it hits 4.

CodePudding user response:

There is a method to get transaction confirmations by using getrawtransaction rpc method with verbose flag set to true. Part of the json output looks like:

  "blockhash" : "hex",               (string) the block hash
  "confirmations" : n,               (numeric) The confirmations
  "blocktime" : xxx,                 (numeric) The block time expressed in UNIX epoch time
  "time" : n                         (numeric) Same as "blocktime"

The full docs how to use it is here

  • Related