Cancelling a Pending Ethereum Transaction

Why Your Ethereum Transaction Is Still Pending and How to Fix It?

Transferring cryptocurrency should be considered a fast procedure; however, it is not always the case. During peak network loads, some transactions may take an unexpectedly long time to get confirmed by the blockchain, as well as to be completed, leaving users in uncertainty about what to do next. 

These problems could occur due to network overload, the amount of transaction fees, or how the validators pick transactions from the mempool.

The topic of Canceling a Pending Ethereum Transaction appears when the transfer does not get confirmed despite being broadcast to the Ethereum blockchain. 

Transactions may be stuck when the gas fee paid for them is smaller compared to the gas fees paid for other transactions. As Ethereum validators consider first transactions with the highest priority fees, lower-fee transfers may stay in the mempool for longer.

Why do Ethereum Transactions Become Pending?

Ethereum handles many transactions on its blockchain; however, not all the transactions are immediately confirmed. First of all, all transactions enter the mempool, where they wait until they are placed in blocks.

After the implementation of EIP-1559, every transaction on Ethereum has two types of fees. One of them is automatically calculated by the network, and the other one is selected by users and is called a priority fee. Validators usually process those transactions first that have higher priority fees.

Pending transactions can occur as a result of an increase in network demand, as low-priority transactions may take a long time to be confirmed.

Reasons for pending transaction are the following:

  • Blockchain network congestion because of the high network load.
  • Reduced gas price when compared to the existing network price.
  • Multiple pending transactions originating from the same wallet.
  • Wallet software is broadcasting transactions more slowly than expected.

How to Cancel a Pending Ethereum Transaction Before Confirmation

Pending Ethereum transactions cannot be deleted after they have been broadcast to the network. However, they can often be replaced before confirmation by submitting another transaction that uses the identical nonce together with a higher gas fee.

Ethereum assigns every outgoing transaction from a wallet a sequential value known as a nonce. Since there is only one confirmed transaction possible for each individual nonce, the validator usually confirms the replacement transaction in case it pays higher fees.

This strategy will work as long as the original transaction exists in the mempool. Once it gets confirmed, the transaction becomes a permanent part of the blockchain, and it is no longer possible to alter it.

Replacing a Pending Transaction Using MetaMask

MetaMask provides an integrated feature that is aimed at boosting pending transactions automatically.

The wallet can be opened, and under the Activity tab, the user can find the transaction which needs to be speed up. The option Speed Up will help MetaMask to suggest an enhanced gas price based on the current network conditions.

Source: Trading View

 Upon confirming the enhanced gas price, the wallet sends another transaction with the same nonce as the initial one.

In case the replacement transaction gets mined first, then the earlier pending transaction gets canceled by itself because Ethereum supports only one transaction per nonce. This process is possible when the user has enough ETH to pay for a higher transaction fee.

Manually Replacing the Pending Transaction by Setting a Custom Nonce

When Speed Up fails to fix the problem, MetaMask also offers manual replacement using the custom nonce function.

Users need to turn on the Customize transaction nonce from the Advanced tab. It will require users to find the nonce that is set for the transaction that is pending in the Activity tab. If there are several transactions pending, then it will be necessary to start with the transaction having the lowest nonce number.

The next step after generating the nonce involves creating a new transaction that is aimed at the user’s wallet with zero amount of ETH. Before executing the transaction, users have to provide the same nonce used for the pending transaction, and the specified gas price should be higher than the current one.

Once the validators confirm the transaction, then the pending transaction with the used nonce will not be confirmable.

At the end of the process, users can disable the custom nonce option and prevent providing wrong nonces in the future.

Requirements for Transaction Replacement

For a pending transaction to be replaced, there are certain requirements that must first be met.

It is the responsibility of the user to ensure that:

Requirement Purpose
Access to the originating wallet Authentication is needed for the transaction replacement
ETH balance Required to pay the extra gas fees
Nonce Replacement  possible with the same nonce
Pending status The transaction can only be replaced when it is pending

In the event that the user imports their wallet in another platform, it becomes necessary for the user to have access to their wallet recovery info.

Replacing Transactions Tests

The users can do a test to check whether the transaction can be replaced using a blockchain explorer such as Etherscan.

If the transaction status is still pending, the transaction can still be replaced by use of the same nonce. However, if the transaction status on the blockchain explorer shows that the transaction has been confirmed, then the transaction is complete according to Ethereum.

Transactions once confirmed cannot be replaced or canceled since they have been irreversibly stored on the blockchain. The only solution for recovering those payments sent will be through a voluntary agreement by the recipient to return the payments.

Actions That Can Be Taken to Prevent Future Transactions From Becoming Pending

Some of the actions that can be taken in order to prevent future transactions from becoming pending owing to high traffic on the network are indicated below.

They include:

  • Checking the cost of gas before sending payments.
  • Using gas recommendations in the wallet during busy network times.
  • Ensuring no simultaneous outgoing transactions when one transaction is pending.
  • Upgrading the wallet software to take advantage of fee estimation tools.

Such actions will not necessarily guarantee the confirmation in an instant manner, but may help prevent any delay caused by under-priced transactions.

Conclusion

In summary, learning how to cancel a pending Ethereum transaction could come in handy for users in order to help them handle any delay in the network caused either by network congestion or low gas prices. 

Even though transactions that have been confirmed in the Ethereum blockchain network cannot be reverted, there is an option for replacing a pending transaction by using the same nonce with a higher gas fee.

Frequently Asked Questions (FAQs)

Can I cancel a transaction on Ethereum once it’s confirmed?

No, once you have an Ethereum transaction confirmed and recorded in a block on the blockchain network, the transaction is permanently written to the ledger, which means that it is irrevocable and uneditable.

Can I cancel a transaction of Ethereum that is pending at the moment?

Yes, you can. But, it is possible only if the transaction is still pending and not confirmed yet. It will be done through the issuance of another transaction using a high gas fee.

What does nonce mean in Ethereum?

It means the sequence number which is used by the wallet to perform all outgoing transactions. 

Scroll to Top