4

How can you check the status of a past transaction given the TxHash (i.e. pending, failed, or successful) and also the assurance level / number of confirmations and block number? (like on Cardanoscan here for example https://cardanoscan.io/transaction/df8c580d50c1b8f97bd0831edb622be2737bc2a7e46971a8b369ab12e51cb214#:~:text=7214272-,Assurance,-Low?

Is this possible using the cli or @emurgo/cardano-serialization-lib-asmjs library?

1 Answer 1

4

The main option you have with cardano-cli is to keep running

cardano-cli query utxo --tx-in df8c580d50c1b8f97bd0831edb622be2737bc2a7e46971a8b369ab12e51cb214#0 --mainnet

Where df8c580d50c1b8f97bd0831edb622be2737bc2a7e46971a8b369ab12e51cb214 is the TxHash and #0 indicates the first output of that transaction, noting that all transactions must have at least one output.

It will give an output like the following

 TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
df8c580d50c1b8f97bd0831edb622be2737bc2a7e46971a8b369ab12e51cb214     0        49517208 lovelace + 1 7482551a1dab4a992e579718a81e6cd14401bf4d02856c0c738a2587.5061706572536f63696574793032303132 + 1 7482551a1dab4a992e579718a81e6cd14401bf4d02856c0c738a2587.5061706572536f63696574793036333930 + TxOutDatumNone

Note it will only highlight the moment the transaction makes it to a block accepted by your local node with no additional details such as the block number or assurance level.

As it currently stands there are limited options to query the status of a transaction using the cardano-cli. cardano-serialization-lib-asmjs on the other hand has no querying capability but allows you to build and serialise the transaction itself.

For more information you will have to consume the following resources from HTTP-based APIs

These will give you the block number but you will have to calculate the assurance level yourself by subtracting it from the current tip.

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.