1

I'm trying to call web3's eth_sign with metamask's provider, like so

        var signature = await web3.eth.sign(web3.utils.utf8ToHex(randomMsg),acc0)

The metamask windows notification pops up and everything works correctly, I click on Sign and it seems to work since the loading finishes and I'm returned to the list of transactions, but the notification never closes and the eth_sign promise never resolves.

I'm using web3.js version 1.2.4 and the latest metamask. I've tried updating to the 2.0.0 alpha version of Web3 but the same happened.

1

I ended up using the web3.eth.personal.sign function instead. I thought I needed to add a password but it turns out if I don't add a password to the function parameters, it will use metamask to sign.

| improve this answer | |
0

You must to encrypt your message by web3.utils.sha3 instead of web3.utils.utf8ToHex.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.