Sometimes if you submit a transaction with a very low gas fee, you may be stuck with a pending transaction that is taking way too long to be mined. You may try to submit a transaction after it from the same wallet but the second transaction is waiting on the first transaction to be mined before it can be mined. The Etherscan screen for each may look something like this:
Notice under “Estimated Confirmation Duration,” the transaction should only take 58 seconds to mine, but it is stuck waiting on an earlier transaction sent with a low gas fee that is taking days to mine. Ethereum does not let you send the second transaction until the first is mined to make sure a malicious third party doesn’t flood the network with one of your transactions and emptying your wallet. Fortunately, there are ways to use Metamask to ‘clear the nonce,’ or in other words, push through the first transaction so the latter ones can be mined.
Clearing The Nonce
1. Firstly, Metamask does not have this functionality natively built in. We will need to go into settings to enable it. Open up Metamask and click your avatar icon on the top right corner. After that, click the Settings icon.
2. Once you are in the Settings page, tap on Advanced.
3. Scroll down until you see a switch labeled “Customize transaction nonce.” Flip that on.
4. Now you can customize your nonce! Lets see how we can use this to clear the transaction from the example in the intro. First, go to the Etherscan page of the transaction that is causing the blockage. Hit “Click to see More” at the bottom to see all the data fields. You will notice that one of them is called “Nonce.”
5. That nonce value is basically denoting the position of this transaction in the sequential order of transactions from your wallet. What clearing the nonce effectively does is replace this low gas transaction with a higher gas cost transaction that goes through quick. Once another transaction of the same nonce goes through, then all the proceeding nonces get processed too.
To do that we go back to Metamask and get ready to send a transaction. Get to the “Send ETH” page. Put in a super small amount of ETH and set the gas to high so the transaction goes through quick. Your screen should look something like this:
6. Hit “Next” and at the bottom of the screen here, you should see the option to customize your nonce. Input the value here that we got from the Etherscan link before. In this example, it is 7.
7. Hit “Confirm” and the transaction should be submitted! Wait the estimated sign and you should quickly see that the transaction is confirmed. Shortly after, all of your proceeding transactions should go through as well. Your Metamask should show those transactions as confirmed and looking at the Etherscan links should show that they went through!
8. If gas prices have changed and one of your proceeding transactions are now stuck, just repeat the process as many times as you need to.