Ethers.js: Problem verifying personal_sign signatures produced by ledger (v5)

Created on 16 Jun 2020  路  5Comments  路  Source: ethers-io/ethers.js

Initially thought this was a MetaMask issue but looks like it's a bug in ethers v5, ref

Describe the bug
When verifying a personal_sign signature from a Ledger hardware wallet ethers@5 will return the incorrect address.

To Reproduce

  1. produce a personal_sign signature with metamask in the browser console using a ledger device:
> ethereum.sendAsync({ 
  jsonrpc: '2.0', id: 1, 
  method: 'personal_sign', 
  params: ['0x6d7367', '0x73120171D5f26C93F7472b0f4F4C94C300264Bcb']
 }, (a, x) => console.log(x.result))

0xfcd04509a330684eff11f6f4a872a592c33024f6d16022011f35323cb77147dd18f5600f22179721691ce4f3a2d7ee90adf6309bf86fb4bfb0740a330f8f539b01
  1. Try to recover the signature using @ethersproject/wallet in a node console:
> require('@ethersproject/wallet).verifyMessage('msg', '0xfcd04509a330684eff11f6f4a872a592c33024f6d16022011f35323cb77147dd18f5600f22179721691ce4f3a2d7ee90adf6309bf86fb4bfb0740a330f8f539b01')
'0x1d741B84405D5D6cb4F05b5A74ac5588F2149B90'
  1. Try to recover the same signature with ethers@4 in a node console:
> require('ethers').utils.verifyMessage('msg', '0xfcd04509a330684eff11f6f4a872a592c33024f6d16022011f35323cb77147dd18f5600f22179721691ce4f3a2d7ee90adf6309bf86fb4bfb0740a330f8f539b01')
'0x73120171D5f26C93F7472b0f4F4C94C300264Bcb'

Expected behavior
When recovering the signature the same address as used in MetaMask should be returned using the ethers@5 library.

  • Hardware Wallet: Ledger Nano S Firmware version 1.6.0
  • MetaMask Version used to produce signature: 7.7.9
bug fixed

All 5 comments

I鈥檒l look into this shortly.

Hey @ricmoo any update on this? :)

I've updated the issue #933 with this and will track progress there.

I've found the problem and am working on the fix right now.

This should be fixed in 5.0.5.

Try it out and let me know. :)

Confirmed to be working with 5.0.5. Thanks @ricmoo 馃檹

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ricmoo picture ricmoo  路  3Comments

rekmarks picture rekmarks  路  3Comments

jochenonline picture jochenonline  路  3Comments

adamdossa picture adamdossa  路  3Comments

GFJHogue picture GFJHogue  路  3Comments