Skip to content

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

@mudgen

Description

@mudgen

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: LedgerHQ/ledgerjs@a1f21d2

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

Please help me get this fixed. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions