-
Notifications
You must be signed in to change notification settings - Fork 741
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
difference of eth_sign and personal_sign #1395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is a lot of miscommunication unfortunately about these two going around forums. I've ported this JSON-RPC specification straight from Ethereum EIPs but it fails to clarify the difference Essentially they have the same digest hashing schema but it happens at different times eth_signThis was the original signing method which is now almost completely deprecated. The flow for this method is essentially to hash it before transport. This would result with Wallets receiving a hash that would be unreadable for users to approve personal_signThis was introduced later on to solve the readability and essentially differentiates itself by transporting the message without hashing allowing the user to read beforehand. Then after approved the message is hashed accordingly before signed ComparisonThe two flows differentiate as follows: Another difference is the order of the params: Finally we need to take into consideration what the |
I don't think this is correct. If we use |
Maybe I'm wrong but that's how I understood it given the introduction of the new method was supposedly more secure since it added human readability. @danfinlay would be able to provide more clarity on the above since we wrote the article below https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527 |
I found more relevant context on the history of signing on Ethereum on Metamask documentation https://docs.metamask.io/guide/signing-data.html#a-brief-history |
As Metamask described, eth_sign don't add the header but personal_sign add the header, this seems reasonable. |
This is only metamasks implementation, according to the standard it should be different. (see MetaMask/metamask-extension#9957) Edit: |
I'm attempting to put this to practice. The following line works with MetaMask, but for WC its shows a hex string, rather than the text "Please prove you control this wallet by signing this random text: 792823". const signature = await walletProvider.getSigner(0).signMessage(message); Later when calling I feel as if the behavior here should be the same. There is no signPersonalMessage in ethers (that I've found)
Frontend code https://github.com/oneclickdapp/ethereum-auth/blob/dc163d31c7e19ae0886f11a85d49a1b9820a85db/src/utils.js#L28 |
This thread is incorrect since it defines an old API (unprefixed eth_sign) as standardized which is not compliant with the latest Ethereum JSON-RPC API https://github.com/ethereum/execution-apis UPDATED RESPONSE eth_sign should ALWAYS be prefixed |
Closing this issue because it is more relevant to discussions. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
https://docs.walletconnect.org/json-rpc-api-methods/ethereum#personal_sign


https://docs.walletconnect.org/json-rpc-api-methods/ethereum#eth_sign
In the document, there is no difference of eth_sign and personal_sign, but eth_sign may not need add the header '\x19Ethereum Signed Message:\n', would you please help to confirm this?
The text was updated successfully, but these errors were encountered: