An early experiment in checking a Bitcoin-style signature with ecrecover, using hex-string parsing helpers.
Key Facts
Description
A test contract for verifying a Bitcoin-style ECDSA signature on Ethereum. It holds a message hash, the r, s and v values of a signature over it, and the expected signer, written as hex strings and parsed on chain, then passes them to the ecrecover precompile. The deployer published the final version as verifysignature.sol in the poolicy repository, a project to enforce Bitcoin mining pool policies from Ethereum.
Source Verified
Exact runtime and creation bytecode match with soljson v0.1.6+commit.d41f8b7c, optimizer on. Source: github.com/bertani/poolicy verifysignature.sol @ 49987b6 (author's original, verbatim). Verified on Etherscan. Not submitted to Sourcify: its oldest supported compiler is v0.1.7.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract VerifySignature {
address owner;
function VerifySignature() {
owner = msg.sender;
}
function priv() returns(bytes32) {
return 0xeab5f6141b4c66877f178f8b87c804d380af6d5404edc249d2c388dbcc542977;
}
function r() returns(bytes32) {
return 0x0b7effb7704f726bc64139753dc2d0a3929af2309dd2930ad7a722f5b214cf6e;
}
function s() returns(bytes32) {
return 0x73a461ce418e9e483f13a98c0cba5cddf07f647ea1d6ba2e88d494dfcd411c9c;
}
function v() returns(uint8) {
return 32; //equal to 0x20
}
function v2() returns(uint8) {
return v()-4; //bitcoin signature use v that is +4 see reddit comment https://www.reddit.com/r/ethereum/comments/3gmbkx/how_do_i_verify_a_bitcoinsigned_message_in_an/ctzopoz
}
function hashToSign() returns(bytes32) {
return 0x58e2f335bbd6f2b0da93eae19342e7309654fbfeed9a214a1e5d835ac09cc226;
}
function expectedAddress() returns(address) {
return 0x31031df1d95a84fc21e80922ccdf83971f3e755b;
}
function isValid() returns(bool) { //this returns true!!!
return expectedAddress()==testECRecover();
}
function testECRecover() returns(address) {
return ecrecover(
hashToSign(),
v2(),
r() ,
s()
);
}
function kill(){
if (msg.sender == owner) suicide(msg.sender);
}
}External Links
Related contracts
LastIsMe
Same deployerA last-player-wins game: each entry makes the sender the last player, and after enough blocks with no new entry the pot is paid to them.
0xd6b955...30dd2aSeptember 8, 2015LastIsMe
Same deployerA last-player-wins game: each entry makes the sender the last player, and after enough blocks with no new entry the pot is paid to them.
0x6197b2...2eda88September 8, 2015LastIsMe
Same deployerA last-player-wins game: each entry makes the sender the last player, and after enough blocks with no new entry the pot is paid to them.
0x78eea8...58ac23September 8, 2015LastIsMe
Same deployerA last-player-wins game: each entry makes the sender the last player, and after enough blocks with no new entry the pot is paid to them.
0xb84f79...af6a30September 9, 2015LastIsMe
Same deployerA last-player-wins game: each entry makes the sender the last player, and after enough blocks with no new entry the pot is paid to them.
0xf6a239...378d81September 9, 2015LastIsMe
Same deployerA last-player-wins game: each entry makes the sender the last player, and after enough blocks with no new entry the pot is paid to them.
0x7d692b...5e0c15September 9, 2015