Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

geth 1.5 eth.sign - ecrecover possible problem #60

Closed
kenshyx opened this issue Nov 15, 2016 · 16 comments
Closed

geth 1.5 eth.sign - ecrecover possible problem #60

kenshyx opened this issue Nov 15, 2016 · 16 comments

Comments

@kenshyx
Copy link

kenshyx commented Nov 15, 2016

Hello, I've tested ecrecover func with the latest geth version and it's giving me an unexpected result.
Description:

  • having this message 0x0bf46433510ca9ac7b2203e5477163cfa1f72679cecf71c03a454e3313477bad I signed it using web3.eth.sign from address 0xc7fea2aa9b1475e09f6325e3f6586170f3a1c470 and obtained the vrs usgin fromRpcSig
{
 v: 27,
 r: <Buffer e2 0e 09 f2 5e fa 26 00 05 ec fc 8d a9 00 ce 3a 82 d3 2a 3d bf 68 92 fc 59 7c 1a 24 2e 59 2a 96>,
 s: <Buffer 03 f0 9d e9 f6 c5 12 8b d4 77 84 fb a2 fb 3f e4 bd f9 97 f5 c1 91 52 e9 6f 00 b7 a4 4b 5d c3 7e>
} 
  • using this vrs and the messagebufferToHex(ecrecover(toBuffer(message), v, r, s)) I obtain this public key 0xb94b0ad2c1bab5a27c1b74fb477024b44585fe5cc0da2c1091e4c01bb9adc9dff4cf831b649caacdcce38f749c031d29342adf643aac719a640c90f5e4c26e26
  • if I transform this public key to an ethereum address it gives me this address 0x19e8c0753dd4a51903241be7ad6d32d02ea7c6a5 which is different from the one used to sign the message.
@kenshyx
Copy link
Author

kenshyx commented Nov 15, 2016

This worked as expected before geth 1.5

@axic
Copy link
Member

axic commented Nov 15, 2016

@kenshyx do I understand correctly that geth <1.5 output works with ethereumjs-util, while geth 1.5 does not?

@kenshyx
Copy link
Author

kenshyx commented Nov 15, 2016

yes

@axic
Copy link
Member

axic commented Nov 15, 2016

@kenshyx have you reported it to go-ethereum? Would you be able to run the same command, with the same keys and inputs on an old and current geth version to see if the output differs?

@kenshyx
Copy link
Author

kenshyx commented Nov 15, 2016

Don't know if its because of geth or because of fromRpcSig

@kenshyx
Copy link
Author

kenshyx commented Nov 15, 2016

I didnt report to go-ethereum

@axic
Copy link
Member

axic commented Nov 15, 2016

If you can, please paste here the entire command and the output you're getting from geth. It would be easier to figure out if it is a bug here.

@kenshyx
Copy link
Author

kenshyx commented Nov 15, 2016

Only the signed message was missing from my description: 0xe20e09f25efa260005ecfc8da900ce3a82d32a3dbf6892fc597c1a242e592a9603f09de9f6c5128bd47784fba2fb3fe4bdf997f5c19152e96f00b7a44b5dc37e1b

@axic
Copy link
Member

axic commented Nov 15, 2016

@kenshyx can you recover the signature with other tools to the address you're looking for?

@axic
Copy link
Member

axic commented Nov 16, 2016

From https://github.com/ethereum/go-ethereum/releases/tag/v1.5.0:

Breaking Change: eth_sign prepends a known string to the input and hashes the message on the server side. See PR ethereum/go-ethereum#2940 for more information.

@kenshyx
Copy link
Author

kenshyx commented Nov 16, 2016

Hello @axic, I get the same result when using the solidity's ecrecover as ethereumjs-util ecrecover so the problem is clearly from signature.

@kenshyx
Copy link
Author

kenshyx commented Nov 21, 2016

It seems to be fixed in geth 1.5.2, closing.

@kenshyx kenshyx closed this as completed Nov 21, 2016
@kenshyx
Copy link
Author

kenshyx commented Nov 21, 2016

Never mind, it doesn't work >_>

@mchlmicy
Copy link

mchlmicy commented Dec 6, 2016

Is there any ETA on the the resolution of this issue?

@axic
Copy link
Member

axic commented Dec 6, 2016

@mchlmicy can you please confirm that the message includes the header added by Geth?

"\x19Ethereum Signed Message:\n" + len(message).

@mchlmicy
Copy link

mchlmicy commented Dec 6, 2016

I was able to work through it using the fromRpcSig method. Sorry for my misguided question. Thanks for the speedy response.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants