Skip to content

Instantly share code, notes, and snippets.

@dominiek
Created February 16, 2018 02:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dominiek/50de25f94bd0449e9db29559c74226ed to your computer and use it in GitHub Desktop.
Save dominiek/50de25f94bd0449e9db29559c74226ed to your computer and use it in GitHub Desktop.
ethereum_smart_contract_ecrecover.sol
function getOriginAddress(bytes32 signedMessage, uint8 v, bytes32 r, bytes32 s) constant returns(address) {
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 prefixedHash = keccak256(prefix, signedMessage);
return ecrecover(prefixedHash, v, r, s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment