Skip to content

Instantly share code, notes, and snippets.

@sogoiii
Last active December 26, 2023 22:53
Show Gist options
  • Save sogoiii/796c1088796ff25b279bffb893f88a2c to your computer and use it in GitHub Desktop.
Save sogoiii/796c1088796ff25b279bffb893f88a2c to your computer and use it in GitHub Desktop.
A Solidity contract that verifies signatures
pragma solidity ^0.4.8;
contract Verifier {
function recoverAddr(bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (address) {
return ecrecover(msgHash, v, r, s);
}
function isSigned(address _addr, bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (bool) {
return ecrecover(msgHash, v, r, s) == _addr;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment