This contract is not yet documented
Know something about this contract? Switch to the History tab and suggest an edit to help preserve Ethereum history.
Key Facts
Tangerine Whistle Era
Emergency fork to address DoS attacks. Repriced IO-heavy opcodes.
Bytecode Overview
Verified Source Available
This contract has verified source code on Etherscan.
Show source code (Solidity)
{
"language": "Solidity",
"sources": {
"ECVerifyLib.sol": {
"content": "pragma solidity ^0.4.0;\r\n\r\n\r\nlibrary ECVerifyLib {\r\n // From: https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d\r\n // Duplicate Solidity's ecrecover, but catching the CALL return value\r\n function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) {\r\n // We do our own memory management here. Solidity uses memory offset\r\n // 0x40 to store the current end of memory. We write past it (as\r\n // writes are memory extensions), but don't update the offset so\r\n // Solidity will reuse it. The memory used here is only needed for\r\n // this context.\r\n\r\n // FIXME: inline assembly can't access return values\r\n bool ret;\r\n address addr;\r\n\r\n assembly {\r\n let size := mload(0x40)\r\n mstore(size, hash)\r\n mstore(add(size, 32), v)\r\n mstore(add(size, 64), r)\r\n mstore(add(size, 96), s)\r\n\r\n // NOTE: we can reuse the request memory because we deal with\r\n // the return code\r\n ret := call(3000, 1, 0, size, 128, size, 32)\r\n addr := mload(size)\r\n }\r\n\r\n return (ret, addr);\r\n }\r\n\r\n function ecrecovery(bytes32 hash, bytes sig) returns (bool, address) {\r\n bytes32 r;\r\n bytes32 s;\r\n uint8 v;\r\n\r\n if (sig.length != 65)\r\n return (false, 0);\r\n\r\n // The signature format is a compact form of:\r\n // {bytes32 r}{bytes32 s}{uint8 v}\r\n // Compact means, uint8 is not padded to 32 bytes.\r\n assembly {\r\n r := mload(add(sig, 32))\r\n s := mload(add(sig, 64))\r\n\r\n // Here we are loading the last 32 bytes. We exploit the fact that\r\n // 'mload' will pad with zeroes if we overread.\r\n // There is no 'mload8' to do this, but that would be nicer.\r\n v := byte(0, mload(add(sig, 96)))\r\n\r\n // Alternative solution:\r\n // 'byte' is not working due to the Solidity parser, so lets\r\n // use the second best option, 'and'\r\n // v := and(mload(add(sig, 65)), 255)\r\n }\r\n\r\n // albeit non-transactional signatures are not specified by the YP, one would expect it\r\n // to match the YP range of [27, 28]\r\n //\r\n // geth uses [0, 1] and some clients have followed. This might change, see:\r\n // https://github.com/ethereum/go-ethereum/issues/2053\r\n if (v < 27)\r\n v += 27;\r\n\r\n if (v != 27 && v != 28)\r\n return (false, 0);\r\n\r\n return safer_ecrecover(hash, v, r, s);\r\n }\r\n\r\n function ecverify(bytes32 hash, bytes sig, address signer) returns (bool) {\r\n bool ret;\r\n address addr;\r\n (ret, addr) = ecrecovery(hash, sig);\r\n return ret == true && addr == signer;\r\n }\r\n}"
}
},
"settings": {
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"compilationTarget": {
"ECVerifyLib.sol": "ECVerifyLib"
}
}
}External Links
Related contracts
MemberRegistry
Same deployerOwner-controlled dynamic-array member registry.
0x1f3b19...7c161aAugust 13, 2015Members
Same deployerOwner-controlled member registry with array + mapping tracking.
0xaeb2ac...a5fd37August 14, 2015MembershipRoster
Same deployerAn Ethereum Public Trust roster contract for adding, removing, and checking members.
0xf1d327...aa0455August 14, 2015KillMul
Same deployerTest/utility contract with `suicide(address)` kill switch and a `multiply2` helper.
0x3e5e1f...7c78cdAugust 14, 2015Members
Same deployerOwner-controlled member registry using sequential id + mapping storage.
0xc6810e...db4e6fAugust 14, 2015EthereumAlarmClock
Same deployerThe first deployment of Piper Merriam's Ethereum Alarm Clock, a smart contract protocol for scheduling transactions at future block numbers, launched on Septemb
0xb0059e...cc0cc1September 22, 2015