One of the most common problems crypto traders face when transferring their assets on non-custodial wallets is the issue of failed transactions.
When a transaction fails in Metamask, the transfer amount always remains intact. However, the gas fee will be deducted.
Gas fees are a meager amount of a crypto asset required to validate a transaction on a blockchain network.
They are paid to people who validate crypto transactions as compensation for verifying transactions and securing the blockchain.
For instance, when you send a token, transfer ETH, interact with a smart contract, or process a transaction on the Ethereum blockchain, you must pay fees in Ether.
These fees also keep the network from being clogged up with spam transactions.
However, when a transaction is initiated on the blockchain, the transaction fee is always deducted, no matter the outcome of the transaction.
This is because when you initiate a transaction, you are paying for the computation on the blockchain.
Therefore, when a miner or validator picks up the transaction, they always execute or validate the transaction. Hence, you are paying for the miner’s computational power.
In other words, you must pay the miner for a failed transaction the same way you must do for a successful one.
Reasons for Metamask Transaction Failure
Transaction failure might be due to a lot of reasons. However, the most common cause is an error due to gas limit. A transaction can also be reverted.
Transaction failure can also be due to bad jump destinations or bad instructions. They are errors related to the smart contract, especially generic failure due to the technical properties of the contract code.
1. Out of Gas Error
Gas is a measure of the computational power a miner use up while validating a transaction or processing smart contract interactions on a blockchain network.
The more complex the transaction, the larger the computational power required, and the higher the gas.
Calculating the gas required to process a transaction is complicated as there is no rule to doing that.
This is because the computational power required to verify a transaction cannot be determined before the execution of the transaction.
However, a blockchain user typically pays for every unit of gas burned upon successful verification of the transaction.
Apart from this, a trader must include a priority gas fee that helps you prioritize your transaction in the pool.
Therefore, to calculate the amount of gas fee needed to process a transaction, every user must pay a max fee which comprises the gas limit fee and the max priority fee.
However, when a transaction fails after the ‘Out of Gas’ error, that means the gas limit set for the transaction is not enough to cover the computational cost needed to validate the transaction.
When a transaction fails due to this, a small part of the transaction amount is deducted for the expended gas.
Therefore, when this happens, you must initiate the transaction again with the optimal fee or by raising the fee.
‘Out of Gas’ error can also occur if your gas limit is below 21,000. In this case, you need to increase the gas limit manually before processing the transaction.
Additionally, you can encounter this error if you set the appropriate gas limit, but the contract execution requires more gas input.
Here’s how to raise the gas limit in Metamask wallet
- Enable Gas Control
- Send transaction again by manually inputting gas limit and priority fee
1. Enable Gas Control
Open your Metamask wallet extension and input your password on the log-in page. Tap UNLOCK to open your Metamask wallet.
In your wallet, click on the wallet icon in the upper part of your Metamask home screen.
Click on SETTINGS > ADVANCED.
In the Advanced wallet settings, scroll down and activate the ADVANCED GAS CONTROLS to manually set the gas limit in the transaction window.
2. Send transaction again by manually inputting gas limit and priority fee
Once you’re done, go back to your Metamask home screen and choose the asset you want to send.
Tap SEND and paste the recipient wallet address.
Continue by inputting the transfer amount, then tap NEXT.
On the next page, tap EDIT to manually input gas limit and priority fees. You can track realtime gas fee at https://etherscan.io/gastracker
Then finalize the transaction by clicking on CONFIRM.
2. Dropped Transaction
Another reason why your transaction can fail on Metamask is when your transaction has been dropped from the node.
Normally, when a transaction has been initiated, it gets broadcasted on the blockchain network. However, it can be dropped due to various issues with the connected node.
For instance, when a node has reached the maximum limit of pending transactions, or when the network is stuck, the node automatically lets go of some pending transactions in the pool.
Another reason can be when the gas limit of your transaction is lower than many pending transactions in a pool.
When this happens, all you have to do is process a zero amount transaction with the same nonce value but with a higher gas limit. With this, your transaction will be prioritized in the pool.
You can easily replace a dropped transaction by sending a new transaction with the transaction NONCE and details like the previous one.
Here’s how to replace a dropped transaction:
- Change Nonce Customisation and Gas Limit Settings
- Copy Nonce value
- Send replacement transaction
1. Change Nonce Customisation and Gas Limit Settings
Log in to our Metamask wallet and click on the round icon on the top right corner of your home screen.
Click on SETTINGS > ADVANCED to go to advanced settings.
Scroll down and enable the CUSTOMIZE TRANSACTION NONCE and ADVANCE GAS CONTROL.
With this, you will be able to input your preferred nonce value and set an appropriate gas limit.
2. Copy Nonce value
Before you send a new replacement transaction, take note of the nonce value from the previous transaction details page on Etherscan or within your Metamask wallet.
To view the nonce value in Metamask wallet, click on the transaction in your Metamask wallet and copy the value below the NONCE.
3. Send replacement transaction
Go back to your Metamask home screen and send a zero transaction with the same details and nonce value as the failed transaction.
To do this, click on SEND. In the SEND TO address, paste your personal wallet address. Input 0 as amount and input nonce value in the field provided for CUSTOM NONCE.
Finally, tap confirm.
Total fund loss due to transaction failure is almost impossible after processing a transaction on a network.
However, if you encounter any unusual error or failure, you can simply reach out to Metamask support on Twitter by visiting twitter.com/MetaMaskSupport.