se3000/ruby-eth

Unable to recover signature from Solidity

mtomov opened this issue · 3 comments

Hello,

Thanks for the helpful library, and especially the latest personal_sign addition to it.

I've been trying to sign a message with personal_sign and then verify the signature from Solidity with an ECVerify library. However, the signature appears to be invalid from Solidity.

If I use this tool: https://etherscan.io/verifiedSignatures to verify the signature, it appears to be correct.

Comparing to a signature generated with the JavaScript libraries, the one generated from #sign or #personal_sign appears to be different every time. How is that expected as the JS generated signature is always the same for the same message and private key?

Is there something obvious that am I missing?

Thank you!

I think the question about why you get a different signature is covered in #1 (comment). Short answer is this gem does not use libsecp256k1 or anything derived from it for signatures.

As for why it doesn't work with the ECVerify library, that seems to be specific to that library. The signatures generated by this gem are valid and submitted to the blockchain regularly. I would first try to get it working with regular sign and then move to the prefixed personal_sign.

Feel free to reopen, but assuming by the thumbs up that you're good.