question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hardware-wallets: "Error: transaction.chainId/signature.v mismatch"

See original GitHub issue

I am getting this error: Error: transaction.chainId/signature.v mismatch

From this code:


const { LedgerSigner } = require('@ethersproject/hardware-wallets')

async function main () {
  const signer = new LedgerSigner(ethers.provider)
  const usdcAddress = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'
  // account 3
  const account3 = 'myaddress'
  const erc20 = (await ethers.getContractAt('IERC20', usdcAddress)).connect(signer)
  const tx = await erc20.transfer(account3, ethers.utils.parseUnits('0.1', 6))
  const receipt = await tx.wait()
  if (receipt.status) {
    console.log('Successful')
  } else {
    console.log('Failed')
  }
}

The v value for the signature is 54.

I wonder if this error could be related to the chain id math change that was made in ledgerjs: https://github.com/LedgerHQ/ledgerjs/commit/a1f21d25f3c216d4b2ec475c0802c56223e9a9e0

This code is using Hardhat connected to Polygon, which uses chainId 137.

Please help me get this fixed. Thanks!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:27 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
ricmoocommented, Apr 10, 2021

The main thing is to pull the ancillary packages from the monorepo, especially things like the hardware wallets package, which have incredibly complex dependencies (it needs an OS with the dev libusb, and/or hid headers, and C extensions). They are causing havoc with the CI environments, and even testing locally is non-trivial.

I’m trying to upgrade the LedgerSigner to use modern methods of communicating from both node and the browser instead of the hacky u2f hijacking they used to do, which they have deprecated.

Right now I’m still fighting the dist file generation, as the Ledger libraries don’t seem to play nice with bundlers, but I think a module that can be dropped into a web browser will simplify the lives for many (including myself 😉).

2reactions
ricmoocommented, Dec 14, 2021

Awesome! Thanks @anders-torbjornsen ; I’ll refer people to this package until I get the v6 ancillary package working. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

0 - Ethereum Stack Exchange
Ethers.js signTransaction with LedgerSigner doesn't work on Polygon (transaction.chainId/signature.v mismatch).
Read more >
Developers - hardware-wallets: "Error: transaction.chainId/signature ...
I am getting this error: Error: transaction.chainId/signature.v mismatch. From this code:
Read more >
Transactions - ethers
An unsigned transaction represents a transaction that has not been signed ... is a mismatch between the chain ID of transaction and signature...
Read more >
EIP712 is here: What to expect and how to use it | MetaMask
One thing to note about chainId is that wallet providers should prevent signing if it does not match the network it is currently...
Read more >
scwallet package - github.com/ethereum-optimism/optimism/l2geth ...
Transaction, error); func (w *Wallet) SignTxWithPassphrase(account accounts. ... key recovered from a signature does not match the one expected by the user.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found