How to cancel or replace an unconfirmed Ethereum transaction
The throughput of the Ethereum network is only 15 transactions per second, which leads to long delays in sending ETH coins during periods of high user activity. What can you do if your Ethereum transaction is stuck in an unconfirmed state? How can you speed it up or reverse it? Continue reading the article to find out.
Note: You can only reverse unconfirmed transactions that have not yet been added to the blockchain. If the transaction has received at least one confirmation from the miners, it is not possible to replace or cancel it.
Why do transactions get “stuck”?
If there are only a few transactions and enough of them fit into a block, there will be no delays, even if you paid a small commission: The miners add each transaction if there is room in the block. However, if there are too many transactions and not enough space in the block, they will pile up in the mempool (a queue of unconfirmed transactions).
In this case, the miners give priority to the users with the larger amount of gas, the “fuel” that the miners need to do their work. Gas consists of two parameters:
Gas price: the cost of ETH (Gwei) per unit of gas that the sender must pay.
Gas limit: the maximum amount of gas the user is willing to pay when sending coins.
The commission is displayed on the Etherscan website in the Gas Tracker section.
Users can manually change the price and gas limit. If you decrease the value of Gwei, the transaction will receive a lower priority and take longer to confirm: the lower the commission, the further back in the queue the transaction will be. Confirmation can take anywhere from several hours to several days.
To avoid such a situation in the future, do not set a low price and limit for gas. Use the recommended values. Wallets like MetaMask have default values, and you can choose between three options: low, medium, and high fees. Do not set the gas limit at less than 21,000.
What to do if the transaction isn’t being confirmed for a long time?
If you do not want to wait for the miners to add the transaction to the block, you can either speed it up or cancel it. Here are some ways to speed up an unconfirmed Ethereum transaction.
Method 1: Send a transaction with the same amount and increase the commission (replacing an unconfirmed transaction).
Each Ethereum transaction has a nonce parameter associated with it (a counter of confirmed transactions). If you send two transactions with the same nonce value at once, miners will most likely choose the most profitable transaction for them, and the other one will be canceled.
Note #1: The information Duplicate Nonce is displayed in the blockchain browser, and it can be seen that two transactions with the same nonce value are sent to the network.
Note #2: This method only works if you send cryptocurrency to the same address that was specified in the previous transaction. Otherwise, simply create two different transactions: the new one will be confirmed, and the old state will remain unchanged.
Below we will show you how to replace a transaction in the MetaMask wallet.
- open the MetaMask plugin and log in to the wallet.
- go to the Activity tab, find the transaction that is waiting for confirmation and click on it.
- The details of the transaction will be displayed. Find out the value of the nonce parameter and memorize it or write it down.
- go to Settings and click Advanced.
- scroll down the page and check the Customize Transaction Nonce option.
- return to the wallet home page and resend the coins.
If the second transaction is not confirmed for a while, increase the commission and send the coins again with the same nonce value. The transaction with the highest commission will be written to the blockchain by the miners and the rest will be rejected. In other words, the transaction is replaced.
To avoid unexpected situations after replacing or canceling a transaction, turn off the Customize Transaction Nonce option in the Settings section again.
Method 2: Use the MetaMask transaction acceleration feature
The MetaMask wallet supports the Speed Up feature, which allows you to speed up an unconfirmed transaction. To replace an old transaction with a new one, follow these steps:
- open the MetaMask plugin and log in to the wallet.
- Go to the Activity tab and find the transaction that is waiting for confirmation.
- Press the Accelerate button.
Select a higher commission or increase it manually, and then click Save.
If that does not help, repeat the steps and increase the commission manually, using the recommended values on Etherscan as a guide.
Canceling an ETH transaction
In some cases, the user may need to cancel the transaction, for example, if a user changes their mind about sending coins or waits too long for a confirmation. Let us explore these scenarios.
Error in the recipient’s address
For example, you have mixed up the address or copied it to the clipboard incorrectly. Other scenarios are also possible: there are known cases where addresses in software wallets have been forged. Devices infected with the exploit replace part of the address when sending. In most cases, users only check the first and last two characters of the address and ignore the rest without checking the address completely. Therefore, they do not notice the substitution immediately.
If the miners have not yet confirmed the transaction, it is possible to cancel it. Imagine another case study: A user lost 5 USDT without knowing the Ethereum checksum. ETH Addresses are written in upper and lower case. If you write the address in upper or lower case only, the checksum check is disabled. This means that the wallet cannot determine whether a valid address is being used or not. Wallets can only calculate the checksum in mixed registers.
0x80218A47ECE971e24863ADE43e9F05b77605da54 – mixed case address. The checksum can be verified.
0x80218a47ece971e24863ade43e9f05b77605da54 – address with only lowercase letters. The checksum cannot be verified.
- The transaction has remained unconfirmed for a while. Sometimes factors overlap: for example, the price of ETH has changed due to the long wait, and the user has decided to cancel the transaction instead of speeding it up.
- The user realized they are being scammed. You may have realized that you have become a victim of scammers and the attackers want to steal your money by cheating on the transaction. This can be prevented if it is not too late.
- You have discovered that your wallet has been compromised. For example, you entered a seed phrase on a phishing website or a smart contract that your wallet interacted with was hacked. In this case, the hackers can withdraw coins without your intervention. Until the transaction is confirmed, you can return the money and keep it.
How to cancel an unconfirmed Ethereum transaction
The cancelation process is similar to replacing a transaction with one exception: you must send a blank transaction, i.e. enter 0 ETH in the Amount field with the same nonce value. A substitution takes place: You spend the cryptocurrency only for the commissions and the main amount goes back to the wallet.
Empty transactions are usually sent to invoke a smart contract when you add coins/tokens to the staking or remove them from the pool. Therefore, to cancel transactions, you need to provide your wallet address when you send a zero amount. Such transactions are marked in the Blockchain Explorer with a special label SELF.
What else can you do?
Ethereum blockchain transaction fees reach $50, $100, and even more during peak usage. If you are not willing to pay such a high amount for a transfer, or if there is not enough ETH in your wallet to cover the fees, just wait until the network is less loaded. Sometimes it happens that the blockchain automatically deletes stalled transactions, but this can take a very long time.
If you send an Ethereum transaction to the network but the miners do not confirm it for a while, it can always be canceled or expedited by replacing it with another transaction.