I am using HardHat to deploy contracts on Polygon (Matic), it works most of the time when deploying or minting.. but then it usually breaks when I switch from testnet to mainnet.
For example: I switched from mainnet to rpc-mumbai.maticvigil.com, then I get the error ProviderError: invalid sender.
Then I updated my hardhat.config.js to point to matic-mumbai.chainstacklabs.com and I am able to mint and deploy contracts with no errors.
I am reaching out to see if this is a known issue occurring with polygon and or hardhat?
Add this to your hardhat.config.js, after accounts:
gasPrice: 8000000000, // default is 'auto' which breaks chains without the london hardfork
Full entry:
matic: {
url: "https://matic-mumbai.chainstacklabs.com",
accounts: [PRIVATE_KEY],
gasPrice: 8000000000, // default is 'auto' which breaks chains without the london hardfork
}
Ref: https://github.com/nomiclabs/hardhat/issues/1828
Confirmed the solution of "The Vikk" is working. Added also the account details and 0x before the private key.
mumbai: {
url: "https://polygon-mumbai.g.alchemy.com/v2/<API_KEY>",
accounts: [`0x${PRIVATE_KEY}`]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With