Hardhat-ledger plugin error using blockchains that don't support EIP-1559 transaction format
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 send signed transaction with eth_sendRawTransaction and EIP-1559 format.
{"jsonrpc":"2.0","id":17,"error":{"code":-32000,"message":"RPC error response: error getting from address"}}
Debugging it I see that is sending the transaction with type EIP-1559 that is not supported by zkEVM now (https://support.polygon.technology/support/solutions/articles/82000897869-does-polygon-zkevm-support-the-eip-1559-format-for-transactions-).
{
"chainId": "2442",
"type": "EIP-1559",
...
}
So at this moment to support deploying to Polygon zkEVM networks this ledger-plugin should send legacy transaction (type=0) instead and calcultaing then gasPrice.
This will produce legacy transaction format:
{
"chainId": "2442",
"type": "LegacyTransaction",
...
}
Minimal reproduction steps
- Install
hardhat-ledgerplugin following the instructions here https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-ledger - Patch first getting accounts in hardhat-ledger
providerfor zkEVM networks with empty array [] becauseeth_accountsis not supported in zkEVM node now (https://github.com/NomicFoundation/hardhat/issues/5785). - Try to deploy a smart contract to zkEVM Cardona with some faucet through
ledgerAccountsaddress with any Ledger device.
Search terms
hardhat-ledger zkevm eip-1559 eth_sendRawTransaction