estimateGas call fails in optimism network.
See original GitHub issueDescription : estimateGas call fails if I try optimism rpc endpoints, with others it’s successfully returning the result.
I’m using “ethers”: “^5.5.3” version in my project, and while trying the following code I get the error: Error: gas required exceeds allowance
const ethers = require('ethers')
async function test() {
let url
url = 'https://kovan.optimism.io'
// url = 'https://polygon-rpc.com'
// url ="https://kovan.poa.network"
// url = 'https://rinkeby.arbitrum.io/rpc'
// url = 'https://mainnet.optimism.io'
let provider= new ethers.providers.JsonRpcProvider(url)
const gasPrice =await provider.getGasPrice();
const tx = {
to: '0xb4DE0833771eae55040b698aF5eB06d59E142C82',
value: '0x1',
}
const estimatedGas = await provider.estimateGas(tx);
console.log(gasPrice.toString())
console.log(estimatedGas.toString())
}
test()
Here’s the full error that I am getting.
All the other endpoints works fine except the optimism ones. Can anyone suggest if I am doing something wrong?
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
transaction may fail or may require manual gas limit - Contracts
When i execute this script, i get this following error. { Error: cannot estimate gas; transaction may fail or may require manual gas...
Read more >transaction may fail or may require manual gas limit" : r/ethdev
I am trying a mint function that I wrote and getting this error: Error: cannot estimate gas; transaction may fail or may require...
Read more >eth_estimateGas - Alchemy Docs
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added...
Read more >Asking for "Gas estimation failed" on BSC
I have problem on get quote always return "Gas estimation failed" ... I use this link reply response always estimate gas estimation failed, ......
Read more >hardhat cannot estimate gas; transaction may fail or ... - You.com
npx hardhat run ./scripts/sample-script.js --network optimism; See the following error: Error: cannot estimate ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We (the Optimism team) did additional research and found that this was an issue over at QuickNode, the RPC provider behind both mainnet.optimism.io and kovan.optimism.io. QuickNode upgraded its infrastructure over the last few days and it seems that this problem has been fixed along with that upgrade. This can safely be closed as it’s not an issue with ethers.js and it’s also been fixed.
I think this is probably an issue with some quirk in the Optimism node and unlikely to be an Ethers issue.