ethers-io / ethers.js

Complete Ethereum library and wallet implementation in JavaScript.
https://ethers.org/
MIT License
7.97k stars 1.85k forks source link

Signature from signMessage changes depending on wallet instance used #88

Closed jennazenk closed 6 years ago

jennazenk commented 6 years ago

Hey @ricmoo ! Again thanks for all your help so far.

So regarding #80 , it indeed works for me; I have a wallet instance that I got from decryptWallet(encryptedWallet, password) and I sign data, works smoothly, ecrecover validates signature.

However, now I try to sign with a wallet instance that I have from Wallet.fromMnemonic(...)and when I try to sign with this wallet instance, the signature doesn't seem right (not according to ecrecover in solidity). When I try to verifyMessage(data, signature) in that case, it throws an error.

Here is a code snippet to reproduce:

(i) w wallet from mnemonic; doesnt work https://runkit.com/jennazenk/5a299fafb38d9000120cad0a

(ii) w wallet from encrypted json + password; works https://runkit.com/jennazenk/5a29a1cdc6e3070011841ddb

Any idea what could go wrong?

Also, as a side question (its not the case here), but why can't we instantiate a wallet with Wallet.fromMnemonic(...) with a mnemonic coming from a walllet created in Parity? It says 'invalid mnemonic' when I try to do that.

Thanks!

ricmoo commented 6 years ago

Hey @jennazenk!

I will be looking into this today, and get back to you shortly.

ricmoo commented 6 years ago

I think we have concluded this was an issue with the v parameter being passed tot he parity library?

Do you mind if I close this? Or is there still an open issue with ethers?

jennazenk commented 6 years ago

Yep, we can totally close it! Thanks again a lot for the great support @ricmoo !