Why ETH Transactions Fail and What to do About it
When a transaction fails on the Etehreum network you are still charged. Transactions fail when there isn’t enough gas to pay for a transaction or a smart contract rejects a transaction.
This is because miners need to confirm transactions to the chain whether or not they succeed or fail, so you are paying for that regardless of if your transaction goes through.
The transaction fee you pay on the Ethereum network is called “gas” (gas is a small amount of ETH paid for Ethereum transactions).
Not paying enough gas: Transactions failing because you didn’t pay enough for the transaction is easy to avoid in most situations, you avoid this by making sure you pay high enough gas fees upfront. In MetaMask for example, you typically just have to stick with “normal” or “fast,” and this is going to be enough to account for any changes in gas prices. However, you can also check current gas prices and put in a custom gas amount (this can be smart if gas prices are rapidly increasing). For a single transaction, or a batch of simple transactions like when you open a Maker Vault, this is basically all you need to know, and rarely if ever will you have a transaction fail (instead worst case is you’ll have a slow transaction here or there… which you can speed up by adding more gas to). Solution: Add more gas by customizing gas before your start the transaction (you can also speed up a transaction by paying more later, but this can cause issues).
Having a transaction rejected: Failed transactions are more likely on exchanges like Uniswap or 1Inch where you are executing multiple transactions at once and the contract rejects the transaction. When you do this, each contract needs gas and sometimes there are other parameters. With transactions like this gas fees are not typically the big worry, instead, the worry is other contract specifications like slippage. If you will only approve a transaction that for example fills your entire order for 2% slippage and it can’t fill at your approved amount of tokens (due to fees or liquidity), then your transaction will be rejected by the exchange. Solution: Adjust slippage tolerance upwards (you may need to go into advanced settings depening on the platform).
In other words, if your transaction fails:
- You either have a gas problem.
- Or, you have a slippage problem.
If you are on Uniswap or Mooniswap or 1Inch, you probably need to adjust slippage tolerance and not gas. If you are doing a single transaction, you probably have to adjust gas.
If you can adjust both, and especially if prices and gas fees are going wild, you may consider adjusting both gas and slippage to avoid failed transactions.
Failed transactions are most likely to occur during periods of volatility, and each transaction that fails will cost (sometimes a lot).
So if one transaction fails, slow down, refresh prices, adjust slippage and/or gas, and try again.
For more, I suggest checking out Uniswap’s FAQ section.
TIP: This only applies when using web3 wallets, dexes, etc. Centralized exchanges like Coinbase don’t use gas.
TIP: Paying to speed up a transaction can result in the transaction being stuck. Unsticking it can be a pain. You might consider not doing this and focusing on paying more upfront.
TIP: If the prices of the coins you are trading are moving really fast, you may have to do a transaction very quickly and adjust slippage tolerance way up. If gas prices are moving really fast you may have to overshoot by a good bit. The charts in both cases will clue you in as to what you have to do.
TIP: With slippage, you won’t necessarily incur the full slippage tolerance amount. That is only the max amount. With gas, you will pay what you offer to pay. So… don’t offer to pay more than you are willing to pay, check the current gas fees and aim toward a reasonable high end and you’ll almost always be fine.
"Failed Transactions on Ethereum" contains information about the following Cryptocurrencies: