Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save qbig/f2ffa79bdfe7355b1fe4701b1856b488 to your computer and use it in GitHub Desktop.
Save qbig/f2ffa79bdfe7355b1fe4701b1856b488 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