hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Hardhat-ledger plugin error using rpc nodes that don't support eth_accounts

Open daveroga opened this issue 1 year ago • 1 comments

Version of Hardhat

2.22.10

What happened?

Trying to deploy smart contracts through hardhat and hardhat-ledger plugin (1.0.3) to Polygon zkEVM networks (Cardona or Mainnet) is not possible because it throws an error when trying to get accounts with eth_accounts.

In hardhat-ledger provider I see that is failing in this code when trying to get accounts through eth_accounts when the rpc node is not supporting this in the API:

  if (args.method === "eth_accounts") {
      const accounts = (await this._wrappedProvider.request(args));
      return [...accounts, ...this.options.accounts];
  }

Minimal reproduction steps

  1. Install hardhat-ledger plugin following the instructions here https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-ledger
  2. Try to deploy a smart contract to zkEVM Cardona with some faucet through ledgerAccounts address with any Ledger device.

Search terms

hardhat-ledger zkevm getaccounts eth_accounts

daveroga avatar Sep 27 '24 15:09 daveroga

Thanks for the reported error. I suspect we want there is to guard against eth_accounts throwing and return [] as if there were no unlocked accounts.

kanej avatar Oct 01 '24 08:10 kanej

Is this problem solved? i am still getting this

farhad-zada avatar May 07 '25 10:05 farhad-zada

Is this problem solved? i am still getting this

Not solved yet. We still have a patch for this in our project https://github.com/iden3/contracts/blob/master/patches/%40nomicfoundation%2Bhardhat-ledger%2B1.0.3.patch

daveroga avatar May 07 '25 10:05 daveroga

Is this problem solved? i am still getting this

Not solved yet. We still have a patch for this in our project https://github.com/iden3/contracts/blob/master/patches/%40nomicfoundation%2Bhardhat-ledger%2B1.0.3.patch

I don't encounter it. i just changed the RPC to public one

farhad-zada avatar May 11 '25 19:05 farhad-zada

Hey we released a general fix for deprecated eth_accounts in v2.24.2: https://github.com/NomicFoundation/hardhat/releases/tag/hardhat%402.24.2

kanej avatar Jun 05 '25 09:06 kanej

Hey we released a general fix for deprecated eth_accounts in v2.24.2: https://github.com/NomicFoundation/hardhat/releases/tag/hardhat%402.24.2

Hey @kanej . The issue about eth_accounts is solved but I still have the issue about legacy transactions in networks like zkEVM. I left a comment here explaining how I solved the issue in my patch.

Thanks

daveroga avatar Jun 05 '25 11:06 daveroga