0

I tried the steps mentioned in the link to verify the hash of a block. But it turned out the hash generated from the steps is not the same as the hash of the block. And also generated hash is of a different block. Is there any way to calculate and verify the hash in Near Protocol by using Block (RPC endpoint)?

Thanks in Advance

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 04 '21 at 09:03
  • To be specific: May I get to know about "How to validate a block using Light Client Block?" – Shreyas K S Dec 05 '21 at 16:19

2 Answers2

1

Good question! I think it is possible, but the difficulty is that you need to manually construct the inner rest struct and calculate its hash. Once you have that information, you can do the calculation similar to https://github.com/near/nearcore/blob/master/pytest/lib/lightclient.py#L33. However, if you are only interested in light client, then you should not need to care about what exactly is in BlockInnerRest and only care about its hash. I created a tracking issue https://github.com/near/nearcore/issues/5701.

berryguy
  • 1,144
  • 3
  • 4
  • Hello, I have followed the steps which you mentioned. When I tried to construct the block hash for this block: https://explorer.testnet.near.org/blocks/Bv6Dgu4X4thU5LQQAotohnywkYYQkQvJWG8rcFN79dF4. I got the hash but which is of a different block: https://explorer.testnet.near.org/blocks/G41RRpGT1Sidnu45xjmVAJ363Cj7eRxMaKNt91EmgA8v – Shreyas K S Dec 17 '21 at 06:41
0

This is an old question but for anyone that visits the page. This issues shouldn't be reproducible anymore: https://github.com/near/nearcore/pull/6044

The Vikk
  • 1
  • 1
  • 2