Ever been trying to mint or send a transaction using MetaMask only to get stuck in the void? Sometimes you can find yourself in a spot of trouble without any options to cancel showing up in the MetaMask interface. Luckily, you can do this manually using the custom nonce trick – i’ll show you how to do it.
Cancelling An Eth Transaction Using The Custom Nonce
In order to do this, you’re going to have to do the following:
- Activate an advanced setting within MetaMask
- Find out which nonce and how much GWEI you used for the stuck transaction
- Send yourself a small amount of Eth using the same nonce as the stuck transaction but at a higher GWEI
We’ll go through the steps in more detail below.
1. Activate custom nonce in MetaMask
Open up the MetaMask plug-in and click the colorful circular icon at the top right.
Go to ‘settings‘ and then to ‘advanced‘.
You’ll find a section quite far down called ‘Customize Transaction Nonce‘. Turn it on.
2. Figure out which nonce the stuck transaction used
This is pretty simple to do. Just open up MetaMask and click on the stuck transaction. There will be a section titled ‘Nonce’ and it will tell you exactly which nonce the transaction was using. I am using nonce ‘1929’ in the example below.
You might be thinking, wtf is a nonce? Well, let me explain briefly. The nonce is a number that will only be used once. It is effectively a pseudo-random number that is used to tag the transaction and prevent replay attacks.
Each time you send a transaction, the nonce value increases by 1. It stops someone front running your transaction with a higher gas fee and draining your Eth with replay attacks.
But, you don’t really need to know this. You just need to know the number and you have that now. Let’s carry on.
Whilst in this menu, take a look at how much GWEI you used for the stuck transaction. If you can’t see it, check your transaction on Etherscan.
3. Send yourself a transaction
Now we’re all good to go. Open up MetaMask and go to send a transaction. You need to enter your own Eth address as the receiver and it really doesn’t matter how much Eth you send – go for something like 0.0001 . What matters is that you enter the same nonce as the stuck transaction and that you enter a higher GWEI.
You will want to enter a GWEI that is high enough to get picked up by the network too or else you’ll get stuck again. You can check on Block Native Gas Estimator to find out what GWEI is going to make it.
Hit confirm and send your transaction on it’s way.
Check your transactions
Now you’ve sent the transaction go check Etherscan, as soon as the new transaction clears it will cancel the old transaction in the process and you are good to go. Simple!