0

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?

1 Answer 1

0

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.

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.