1

I cannot find any description on how to get the transaction info using just the txHash returned by signAndSend() in the API documentation. I think it's a basic function which is really weird that it's not there.

As I can see the only way to track the status of a transaction is using the callback functions of signAndSend() which only viable if the transaction was created from my side. However in block explorers like polkadot.subscan.io or polkascan.io, I can easily find the transaction using just the txHash. Any idea just briefly on how can I implement such a function?

Minh Tran Duc
  • 227
  • 3
  • 13
  • 3
    Hashes are not used to uniquely identify transactions on Substrate-based chains. On Substrate-based chains, transactions are identified by a tuple containing the block in which the transaction was submitted and the index (position) of that transaction in the list of transactions associated with that block. – Dan Forbes Sep 01 '20 at 10:47
  • @DanForbes I see, but somehow exchanges like to returned to the users only the txHash. And I can see the way to easily pick up just my transfer even if it's in a batch extrinsic. The problem is no exchange give back the unique identification in the format of blockNumber-index – Minh Tran Duc Sep 01 '20 at 11:42
  • 1
    You may want to look into something like Substrate Archive, which is probably the type of thing block explorers and exchanges may use as a middle layer between the actual blockchain and the application capabilities that are exposed to users https://github.com/paritytech/substrate-archive – Dan Forbes Sep 01 '20 at 18:33
  • 1
    @DanForbes that might be what I'm looking for. Previously I was just concerned about listening for transactions' status could end unexpectedly somehow. That would make it unreliable to get the common blockNumber + index identification. The only thing we could have left is the txHash which was returned right away. Thank you very much! Could you make an answer so I can mark it solved my problem? – Minh Tran Duc Sep 03 '20 at 01:54

1 Answers1

4

Please consider using a solution such as Substrate Archive to help you index transactions on a Substrate-based chain.

Dan Forbes
  • 2,734
  • 3
  • 30
  • 60