I recently was going through some sol contracts, because I am planning to create my own one. So I stumbled upon this function call: function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError)
I was wondering, where the contract takes the variable "hash" from, because within the original contract call there is no such parameter, where is the "hash" variable stored. Does the contract calculate the hash itself, when I only pass the signature, or how is the hash calculated to verify that the signature is corresponding to msg.sender?
Add a comment
|
1 Answer
How the hash is calculated highly depends on the contract. So to provide a detailed answer you would have to link the specific contract.
There are a couple standards that outline guidlines on how such an hash should be generated:
As an example where signature recovery is used you can look at tokens that implement EIP-2612 or at smart contract wallets such as the Gnosis Safe.