Why did my transaction fail with an 'Out of Gas' error? How can I fix it?
Does this article need to be translated?
If you are curious to learn more about gas and what it signifies in Ethereum, we recommend readingour guide on gas or the ethereum.org guide if a little more comfortable already.
A common problem that you may see or have seen is transactions failing with an "out of gas" error like in the screenshot below.
This means that all the gas units up to the limit you set were used up before the transaction could be fully processed.
To avoid another "out of gas" error, you will need to increase the gas limit of your next transaction. This can be done just before sending your next transaction, once you have enabled Advanced Gas Controls.
Advice from the MetaMask team
The vast majority of the time, the gas limit that MetaMask automatically sets for your transaction will be sufficient.
Selecting a gas limit is mostly a personal preference, but it may be helpful to review recent successful transactions of the executing smart contract to understand what is a sufficient gas limit for your transaction.
Recommended steps:
- While reviewing your transaction with the "out of gas" error on Etherscan, click the link to the Contract address in the "To:" section directly above the out of gas error
- Scroll down to the list of Transactions and click on the Txn Hash of any completed transaction (non-pending)
- Ensure that the transaction shows Status as Success. If not, go back and choose another transaction.
- Click on Click to show more
- Make a note of the Gas Limit that was chosen for the transaction
- Optional: repeat steps 1-4 to better estimate a gas limit that will be sufficient for your transaction
- Once you have a good idea of a value for your gas limit, make sure to adjust the gas limit when sending out your next transaction.