How To “Cancel” Ethereum Pending Transactions?

A transaction on the Ethereum Blockchain is not as complicated as you might think. There are several things you need to know to make sure that the transaction you are making will go through successfully.

1. Gas Fee

There are many examples of how to explain “Gas Fee.” “Gas Fee”, or commonly called a "Transaction Fee", is a small incentive or fee that is paid to block miners to include your transaction in the Ethereum Blockchain. The unit of “Gas Fee” is called Gwei and 1 Gwei is equivalent to 0.000000001 Ether.

The way we calculate how much gas fee to pay for a transaction is by multiplying “Gas Price” with “Gas Used.” Do not confuse “Gas Used” with “Gas Limit.” “Gas Used” is the total amount of gas used in the transaction while “Gas Limit” is the maximum number of gas the transaction is allowed to use by the sender.

From one Ethereum address to another Ethereum address, the gas needed for sending ETH is exactly 21000 gas. Thus when sending ETH to another Ethereum address (instead of a contract address), a 21000 gas limit is enough. Using a gas price of 20 Gwei, the total gas fee paid for the particular transaction above is:

21000 gas x 20 Gwei = 420000 Gwei = 0.00042 ETH

The gas used for executing a contract is different from one contract to another. It is recommended to check the previous transactions from the contract address and to expect a little more while setting gas limit during a transaction involving a contract.

2. Network Congestion

Network congestion plays an important role in the amount of gas price users would need to pay and the speed of the transaction. Pending transactions on the Ethereum network determine how congested the network is. The more congested the network is, the higher the gas price users would need to pay to secure their transactions on the blockchain.

Miners will favor transactions that have a higher gas price thus including transactions that pay a higher gas price first before those with a lower gas price. Ethereum Gas Price Tracker is a simple tool that helps users determine the safe and recommended gas price to use while performing a transaction at a particular point in time. The gas price tracker also provides an estimate of the time needed for a transaction to be included in the blockchain for a given gas price.

3. Nonce

A nonce is the number of the transaction of the sender’s address. Every transaction from an address is numbered sequentially, beginning with 0 for the first transaction. For example, if the nonce of a transaction is 10, it is the 11th transaction sent from the sender’s address.

The nonce is essential to take note of especially if you perform multiple transactions using the same address. The Ethereum network works in a way that a transaction with a lower nonce will be processed first before any other, thus if you have a problem with an earlier transaction, the ensuing transaction will not be included in the blockchain until the one with the lower nonce is successfully included.


Replacing / Cancel Pending Transactions

Replacing a transaction on the blockchain is a little tricky.

A bit of context to begin with. How miners work is that they prioritize transactions that pay a higher gas fee. When you send a transaction on Ethereum, it is sent to a “pending transaction pool” and the transaction you have just sent is sitting there waiting for miners to include it into the blockchain.

Miners will “pick” transactions that pay a higher gas fee leaving transactions with low gas fees at the bottom of the queue. This is where your transaction might be hanging and in the midst of network congestion (see above), your transaction might take a while to be included since more transactions are being added into the pool offering higher gas fees than your transaction.

Remember Nonce? (see above)

The trick to “cancel” your pending transaction is by replacing the transaction with another 0 ETH transaction with a higher gas fee sending to yourself with the same nonce as the pending transaction.

How to determine the nonce of your pending transaction? Look at Etherscan :D Look up your transaction hash (txhash) on Etherscan and find your nonce for the pending transaction below.

Image for post

Some wallets' interfaces will provide you with an advanced setting where you are able to set a higher gas fee and change the transaction Nonce.

Wallet support articles on speeding up/replacing/cancel transactions:

If you like to add a link to how to speed up or cancel your transaction of your wallet provider, please contact us here.


With all of the above in mind, before initiating any transaction on the Ethereum Blockchain, users are advised to:

  1. Check the congestion status of the network
  2. Determine the comfortable gas price needed for the transaction
  3. Make sure there are no pending transactions from the sending address
  • Kaven Choi
Updated
You've successfully subscribed to Etherscan Information Center!