ETH Out of Gas error | error: transaction failed #1262
TheChronicMonster
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Premise
If you're having trouble with failing ETH transactions, then you may need to use
setGasLimit
in the frontend.The Error
In MetaMask, a failed transaction looks like:
And the console error message may look like:
Notice the indicators of
maxPriorityFeePerGas
,maxFeePerGas
, andgasLimit
The Solution
This indicates that
setGasLimit
needs to be established in your minting function.Everything before
const myGasLimit
is only to provide context.Create a constant to hold the gas limit value. We set
myGasLimit
to 5 million.account
is a user definedconst
and is not a special keyword.After setting the gas limit, we see the same codebase now makes a successful transaction:
Learn More
Learn more about
setGasLimit
in the documentationFailed Troubleshooting advice
In our search for this answer, we tried to enforce gas fee limits in MetaMask. I'll share these misadventures in the hopes of saving Reach developers time in the future. Note that the following was a failure and seemed to have no value.
Enforce gas fee limits in MetaMask
Open Settings:
Click Advanced:
Turn on 'Advanced gas controls'
Exit Settings.
Click 'EDIT' before 'Confirm'
Edit the Gas Limit
Save.
Confirm the transaction.
See that the transaction still fails.
Moral of the story:
If your ETH transactions are failing, set gas limits with the standard library and ignore nonsense advice found elsewhere on the internet.
Beta Was this translation helpful? Give feedback.
All reactions