2

Getblock through RPC method. I can only see the block hash. But I want a hash for each transaction. What should I do?enter image description here

2
  • I have solved it. Thank you for providing methods
    – Andy
    May 5, 2022 at 8:07
  • If you have solved the issue, you should post the solution as an answer to this question so that others who have the same issue can also find the solution.
    – Shawn Tabrizi
    May 23, 2022 at 16:28

1 Answer 1

2

The transaction hash is a blake2b-256 of the SCALE-encoded extrinsic data.

This should be consistent, no matter which middleware API is used, the process is the same to get to that point. For instance, in the polkadot-js API, each extrinsic will have a .hash exposed that does exactly this, i.e. it runs a blake2b-256 over the encoded data as received.

3
  • But, you see, in the picture I asked, there is no hash
    – Andy
    May 5, 2022 at 2:34
  • 1
    The above is not the JS API - so you need to, as explained, get the blake2b-256 of the SCALE-encoded extrinsic data. So call the blake2b in your toolset with the encoded extrinsic, that gives you the hash.
    – Jaco
    May 5, 2022 at 5:15
  • Thank you, but what I want is the Java version.
    – Andy
    May 5, 2022 at 6:07

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.