How to Cancel a Pending Ethereum Transaction (MetaMask)

Batuhan Kök
3 min readFeb 8, 2022

Ethereum transactions are processed by miners. Depending on the density of the network, the transaction fee to be paid to the miners is constantly changing. There are 3 keywords that are important at this point, gas cost, gas price, and gas limit.

Gas cost is a value required by the desired operation. This value is determined according to the complexity of the operation to be performed. Gas price is the fee to be paid for one unit of gas cost, and the gas limit is the amount you are willing to pay for this transaction.

These values can be set by you before the transaction is started. If these values ​​are set to low or the traffic on the network increases before your transaction is complete, your transaction may be stuck. If a transaction gets stuck in your wallet, the Ethereum network will not allow you to initiate a new transaction. Therefore, you can cancel your pending transaction by following the steps below.

Why don’t we use the cancel button? Because I do not recommend it.

  1. Open the popup by clicking on the MetaMask icon.
  2. Find your pending transaction using the “Activity” tab and click “details”. Note the “nonce” value that comes up.

Note: If there is more than one pending transaction, start with the oldest one first.

Find your stuck transaction’s nonce

3. Then go to MetaMask settings and click “advanced”.

Go to your MetaMask advanced settings

4. Scroll down and enable the “Customize transaction nonce” setting.

Make it on to customize the nonce

5. Return to the main screen and copy your wallet address by clicking on it.

Copy your wallet address

6. Now initiate a new transaction to send zero Eth to your own wallet address and enter the nonce value you noted in “step 2” to the “custom nonce field” and confirm the transaction.

Confirm solver transaction :)

When the transaction you confirmed is successful, it will be replaced with your pending transaction and you can now do your transactions as you wish 🎉

Notes:

  • To avoid accidents, make sure to toggle the “Customize transaction nonce” option back to OFF.
  • Make sure you are using the same device in which you made the stuck transaction.

--

--

Batuhan Kök

full-stack developer @luxoft • web3/smart-contract