Verify signature in smart contract near_sdk rust

254 Views Asked by At

In ethereum, we can sign a message and verify it onchain if the signer is correct. How can we do this in smart contract near_sdk_rs?

1

There are 1 best solutions below

2
Max On BEST ANSWER

Use the environment function env::ecrecover(hash, signature, v, malleability_flag), to get the signer's public key from his signed message hash and signature.

https://docs.near.org/develop/contracts/environment/#environment-functions