How to Cancel or Replace a Pending Ethereum Transaction
āĻšā§‹āĻŽ
āĻ¨āĻŋāĻŦāĻ¨ā§āĻ§
How to Cancel or Replace a Pending Ethereum Transaction

How to Cancel or Replace a Pending Ethereum Transaction

Beginner
āĻĒā§āĻ°āĻ•āĻžāĻļāĻŋāĻ¤ āĻšā§Ÿā§‡āĻ›ā§‡ May 20, 2021āĻ†āĻĒāĻĄā§‡āĻŸ āĻšā§Ÿā§‡āĻ›ā§‡ Jan 6, 2023
5m

TL;DR

If you've used the Ethereum network before, you've likely experienced a transaction that takes longer than usual to confirm. This happens because of the way the miners prioritize transactions – users who offer higher fees get priority.

If your Ethereum transaction is stuck because the gas fees are low, you will need to wait until the fees drop and miners finally process your transaction. However, you also have the option to replace the pending transaction with a new one that has a higher gas price. Sounds complicated? It's easier than you might think. And it works with ether (ETH) and all ERC20 tokens.


Introduction

First of all, keep in mind that you cannot replace, revert or cancel transactions that have already been confirmed. However, during periods of network congestion, some cryptocurrency transactions may get stuck. When the volume of transactions is too high, you could find yourself with a transaction pending for hours or even days.

Sometimes, the blockages will clear on their own – either because the pending transaction failed or because the gas fees decreased. While you can't literally cancel an Ethereum transaction, there are some steps you can take to speed up the process. In fact, it consists of replacing a pending transaction with a new one that pays higher fees.

In this guide, we will show you how to speed up transactions using MetaMask or Trust Wallet. You could also use other crypto wallets that support the Ethereum blockchain, but the process might be slightly different.

cancel-eth-tx-cta


Requirements

  • MetaMask or Trust Wallet installed.

  • Private keys (seed phrase) to log in to your Ethereum wallet.

  • Internet access.


Why is my Ethereum transaction stuck?

Ethereum works with a bidding system for your transaction fees. Your fee will depend on the complexity of your transaction (i.e., how much computational work it needs). In this context, there are three important terms you should know: gas cost, gas price, and gas limit.

The computational tasks of a transaction are measured in terms of gas cost, while the price paid for each unit of gas is what we call gas price. You can think of the gas cost as the amount of work required and the gas price as the price paid for each "hour of work." Finally, the gas limit is the maximum amount you are willing to pay for a transaction.

While the gas cost is defined by the complexity of your transaction, you are free to set your own gas price and gas limit. The total fee paid will then act as an incentive for miners. However, if your gas price is too low, you may be outbid by other users, leaving your transaction pending. If a transaction is stuck, Ethereum will not confirm any new transactions you make from the same wallet address until a miner confirms the first transaction.


How to speed up a transaction on MetaMask

1. Log in to your MetaMask wallet that has the pending transaction. If it's an external wallet, you need to import the address using the corresponding seed phrase or private key.

cancel-eth-tx-img1


2. Find the pending transaction under the [Activity] tab and click on [Speed Up].

cancel-eth-tx-img2


3. This process will allow you to broadcast your transaction again. Make sure to use a higher gas price by clicking on [Fast] and then [Save].

cancel-eth-tx-img3


4. If the previous step didn't work, you could also go to the [Advanced] tab to set the gas price manually. You can check the current gas prices and average confirmation time on Etherscan or EthGasStation.


How to replace a transaction on MetaMask

1. Log in to your MetaMask wallet that has the pending transaction. Again, if it's an external wallet, you need to import the address using the corresponding seed phrase or private key.

cancel-eth-tx-img4


2. Find the pending transaction under the [Activity] tab. Click on it to check the details and write down the [Nonce] value. 

Note: If you have multiple pending transactions, you need to start with the oldest first (lowest nonce value).

cancel-eth-tx-img5


3. Next, go to MetaMask [Settings] and click on [Advanced].

cancel-eth-tx-img6


4. Scroll down and turn [Customize transaction nonce] on.

cancel-eth-tx-img7


5. Go back and click on your wallet address to copy it to your clipboard.

cancel-eth-tx-img8


6. Click [Send] to create a new transaction and paste your wallet address in the [Add Recipient] field.

cancel-eth-tx-img9


7. You need to send 0 ETH to your own wallet using the nonce of the pending transaction (noted down on step 2). Click [Confirm] when you are ready.

Note: If your gas price is too low, this transaction might also get stuck. Make sure you set a reasonable gas price.

cancel-eth-tx-img10


8. Wait for the new transaction to be confirmed, so the pending one gets replaced.

Note: To avoid accidents, make sure to toggle the [Customize transaction nonce] option back to OFF.


How to cancel a transaction with Trust Wallet

1. Click on the pending transaction in your Trust Wallet app and search for the [Nonce] field. Take note of the number you see.

cancel-eth-tx-img11


2. Create a new transaction and add your wallet address in the [Recipient Address] field. Make sure it's the same address as the pending transaction. Set the [Amount ETH] as 0 and click [Next].

cancel-eth-tx-img12


3. Tap the settings in the top right corner.

cancel-eth-tx-img13


4. Replace the [Nonce] field with the value you wrote down earlier. Make sure to set a competitive [Gas Price], so your transaction doesn't get stuck again.

cancel-eth-tx-img14


5. Wait for the new transaction to be confirmed, so the pending one gets replaced.


Closing Thoughts

Submitting an Ethereum transaction and finding yourself outbid on gas prices can be very frustrating. It gets even worse when you realize that you can't use your Ethereum wallet until the pending transaction either fails or gets confirmed.

Sometimes, stuck transactions will clear automatically when the network fees drop. But unfortunately, this can take quite a while. Thankfully, you can cancel a stuck transaction by front running it with a simple zero token transfer. Remember that you will need to pay sufficient gas fees to successfully push through the canceling transaction.

āĻĒā§‹āĻ¸ā§āĻŸ āĻļā§‡āĻ¯āĻŧāĻžāĻ° āĻ•āĻ°ā§āĻ¨
āĻ¸āĻ‚āĻļā§āĻ˛āĻŋāĻˇā§āĻŸ āĻ¨āĻŋāĻŦāĻ¨ā§āĻ§āĻ¸āĻŽā§‚āĻš
Blockchain Use Cases
What Are Smart Contracts and How Do They Work?
Central Bank Digital Currencies (CBDC) Explained
āĻāĻ•āĻŸāĻŋ āĻ…ā§āĻ¯āĻžāĻ•āĻžāĻ‰āĻ¨ā§āĻŸ āĻ¨āĻŋāĻŦāĻ¨ā§āĻ§āĻ¨ āĻ•āĻ°ā§āĻ¨
āĻ†āĻœāĻ‡ āĻāĻ•āĻŸāĻŋ Binance āĻ…ā§āĻ¯āĻžāĻ•āĻžāĻ‰āĻ¨ā§āĻŸ āĻ–ā§‹āĻ˛āĻžāĻ° āĻŽāĻžāĻ§ā§āĻ¯āĻŽā§‡ āĻ†āĻĒāĻ¨āĻžāĻ° āĻœā§āĻžāĻžāĻ¨ā§‡āĻ° āĻ…āĻ¨ā§āĻļā§€āĻ˛āĻ¨ āĻ•āĻ°ā§āĻ¨āĨ¤