Allow binary message for wallet.signMessage.
See original GitHub issuehello @ricmoo , what is the equivalent of web.eth.sign()
(https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsign) in ethers.js ?
I am trying to sign a piece of data in order to retrieve s, r and v from the signature. I tried with Wallet.sign()
and also SigningKey.signDigest
, but I don’t get the same output as when I call web3.eth.sign()
.
The purpose of that is that I need to call the solidity ecrecover
function to verify that my address has signed the data.
Thanks a lot!
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Signing Messages — ethers.js 4.0.0 documentation
By allowing a user to sign a string, which can be verified on-chain, interesting forms of ... Create a wallet to sign the...
Read more >Signing Messages - Solflare Wallet
The signMessage function expects an Uint8Array and a data display type parameter (either utf8 for readable text or hex for binary data) and...
Read more >Unable to verify message signed by sol-wallet-adapter
Use solana.signMessage and base58 encode the signature. var _signature = ''; try { signedMessage = await window.solana.request({ method: " ...
Read more >eth_account — eth-account 0.8.0 documentation
Creates a new private key, and returns it as a LocalAccount , alongside the mnemonic that can used to regenerate it using any...
Read more >Create a Signed Transaction | Aptos Docs
The Aptos node will generate the signing message, the transaction ... In Aptos blockchain, all the data is encoded as BCS (Binary Canonical...
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
Ok, I’ve found the problem.
I have updated the signMessage API to allow binary data to be passed in. Before it only allowed UTF-8 strings. You will have to make a small change to the above code, since “0x1234” is a valid string (of 6 bytes); the eth-sig-util is using the message as a binary payload.
I’ve also added your example to the test-cases.
Once Travis-CI has completed, I’ll publish to npm and close this issue. You’ll have to delete your package-lock.json and node_modules and redo an
npm install
, but then you should be off to the races. 😃Excellent Point! I will add it to my todo list for the Cookbook.