About transaction_hash and BlockIndex of ICPledger?

How to get valid transaction_hash?
Because after using ICPledger.transfer, the return value is only BlockIndex, without transaction_hash, and at the same time, query_blocks cannot be used to query without transaction_hash.
Because it is found in ICP Explorer https://dashboard.internetcomputer.org/transactions, only transaction_hash can be viewed.

In this way, the transaction can only be browsed by obtaining the transaction_hash in advance. How to obtain the transaction_hash?
Or is it possible to view transactions by BlockIndex?
Thanks!

1 Like

Looking forward to the replies from the big guys

query_blocks method of ICP ledger canister takes block Index and length as argument not tx_hash.

I know, but guiding users to view transactions in ICP Explorer requires knowing the transaction_ hash

1 Like

Looking forward to expert answers

Well not necessarily. You can get it by blockIndex.

Tx details using blockIndex and hashes can be pulled from rosetta api as well. Check these implementation here : https://github.com/dfinityexplorer/dfinityexplorer-dashboard/blob/main/web/src/rosetta/RosettaApi.js
https://github.com/dfinityexplorer/dfinityexplorer-dashboard/blob/630107275f270a22d5ff6bdf0f090a74d0ccaafe/web/src/rosetta/RosettaApi.js#L241

Also I am not an expert or a big guy, so hoping it will help :slight_smile:

1 Like

The blcokchain explorer accepts the BlockIndex but only int he URL, not as a search query.

So to get what you want, simply construct the URL like this:

https://dashboard.internetcomputer.org/transaction/`BlockIndex`

For example: https://dashboard.internetcomputer.org/transaction/10500226

2 Likes