We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
account.hashMessage
const web3 = new Web3(null); const message = "馃"; console.log(web3.eth.accounts.hashMessage(message)); // => 0xd21b04463b76fb09777ca0c59f4de0e02895b0847bf547b3df67ca7b67bb8f66 console.log(web3.eth.accounts.hashMessage(web3.utils.utf8ToHex(message))); // => 0x716ce69c5d2d629c168bc02e24a961456bdc5a362d366119305aea73978a0332
The two hash values should be the same.
I think you should use web3.utils.utf8ToHex on this line. https://github.com/ethereum/web3.js/blob/4ec98d48096007b113d38f634243cf99df6702cd/packages/web3-eth-accounts/src/index.js#L296
web3.utils.utf8ToHex
git clone https://github.com/odan-sandbox/eth-ecRecover-compare
yarn install
yarn ts-node src/app.ts
web3: 1.2.7 nodejs: 12.11.1
The text was updated successfully, but these errors were encountered:
I found the same problem as you, and the solution you suggested works!
(I tested at ubuntu 18.04 / OSX 10.15.4 and node version is 13.5.0)
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Expected behavior
Actual behavior
The two hash values should be the same.
I think you should use
web3.utils.utf8ToHex
on this line.https://github.com/ethereum/web3.js/blob/4ec98d48096007b113d38f634243cf99df6702cd/packages/web3-eth-accounts/src/index.js#L296
Steps to reproduce the behavior
git clone https://github.com/odan-sandbox/eth-ecRecover-compare
yarn install
yarn ts-node src/app.ts
Environment
web3: 1.2.7
nodejs: 12.11.1
The text was updated successfully, but these errors were encountered: