Can't get valid signatures for signMessage for web3-provider
See original GitHub issueI can’t get a verifiable signature when I use web3 provider like ethers
, direct usage of connector works fine.
This works (with direct connector usage): https://codesandbox.io/s/unruffled-benz-9ubn6?file=/src/App.vue
This doesn’t work: https://codesandbox.io/s/gallant-banach-z7svg?file=/src/App.vue the same code works for direct MetaMask usage as a browser extension.
I was also testing with wrappers like:
const rawMessageLength = new Blob([rawMessage]).size
let message = ethers.utils.toUtf8Bytes("\x19Ethereum Signed Message:\n" + rawMessageLength + rawMessage)
message = ethers.utils.keccak256(message)
They don’t help as well.
This topic was also discussed here: https://stackoverflow.com/questions/63793873/sign-and-verifiy-message-on-ethereum-using-wallet-connect-not-working/63817084#63817084
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:19 (8 by maintainers)
Top Results From Across the Web
Trouble with signature verification using `signer.signMessage ...
I'm trying to do some simple signature verification using signer.signMessage with web3Provider but I think I'm missing something. I can't ...
Read more >I need help with signatures - Ethereum Stack Exchange
I know how to sign messages in web3 and how to extract r, s and v so that ecrecover returns my address. But...
Read more >Web3 signature verification is failing - ethers.js - Stack Overflow
Figured it out! Turns out, I was signing the string dataHash instead of bytes value of dataHash. I was able to get the...
Read more >Ethereum : Using Web3.js for message signing - Medium
Object : The signed data RLP encoded signature, or if returnSignature is true the signature values as follows: message - String : The...
Read more >How to Verify a Message Signature on Ethereum
Creating and verifying signatures does not require a connection to the Ethereum ... signMessage(message); // Using our wallet instance which holds our ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The method below you can try, and you can see the full raw message (not hex) on the client side
reference from zkSync
Here’s my workaround that works for window.ethereum and wallet connect, with ethers: