How to modify or cancel a pending Ethereum transaction


Ethereum is an open source blockchain-based software platform with thousands of decentralized applications (DApps) that powers its native cryptocurrency, Ether (ETH), which can be sent and received globally without third-party interference.

Ethereum, first conceptualized in 2013 by Russian-Canadian programmer Vitalik Buterin, was designed as a platform for self-executing, permanent, and immutable DApps with use cases ranging from finance to gaming to art.

DApps are often called smart contracts, which are Ethereum transaction protocols that automatically perform certain functions and actions, such as processing transactions with predetermined conditions and agreements. Sending a transaction, canceling it or resolving a pending Ethereum transaction are actions related to the operation of smart contracts.

What is an Ethereum transaction?

Transactions are cryptographically signed account instructions.

The Ethereum network supports two main types of transactions: contract implementation transactions, the type of transaction without a receiver, and regular transactions, the simplest type of transaction used to transfer ETH from one wallet to another.

A regular Ethereum transaction sent includes the sender identifier or the signature generated when the sender's private key signs the transaction and confirms that the sender has authorized the particular Ethereum transaction. The receiving address, an amount of ETH to transfer from sender to recipient, information about the Ethereum transaction fee, and an optional field to include arbitrary data are all part of a regular Ethereum transaction sent.

Ethereum transactions must be mined to be valid and require a fee from the sender.

Ethereum miners verify legitimate transactions to receive a reward for their work in creating a new ETH. When a miner solves a cryptographic (mathematical) puzzle, a transaction is considered validated. Ethereum, like Bitcoin (BTC), have a proof of work (PoW) system to prevent cyberattacks from a single individual or group.

The obligation of users to pay a transaction fee when using the blockchain protects the Ethereum network from careless or malicious computational tasks, such as users spamming the blockchain with purposeless transaction overload.

Life cycle of Ethereum transactions

An Ethereum transaction goes through a series of states, starting with the unknown state until it is confirmed in a block.

Unknown: Unknown status refers to a transaction that the network has not seen or processed.

Pending: When a transaction is in a pending state, it is waiting for miners to pick it up and process it, which is called a pooled transaction, also called a "mempool." Because miners prioritize higher gas prices, transactions with lower gas values โ€‹โ€‹can languish in the pending stage for an extended period. Lower gas price transactions may never recover, leaving them "stuck" in pending status forever.

In block: When a miner successfully selects a transaction and extracts it within a block, it advances to the block state. Block transactions are called mined transactions. If the block is forked, a transaction in the block can return to the pending state. When a mined transaction (that is, one in the block state) is rolled back by the network, it is known as a forked transaction.

Replaced: When any of the following occurs, a transaction can be moved from the pending state to the superseded state:

  • A new transaction with the same nonce from the same sender enters the bulk state, or
  • Another transaction with the same nonce and a 12% higher gas price enters the pending stage, this time from the same sender.

Ethereum transaction confirmations

Ethereum transaction confirmations are the number of blocks created from the first block that included this transaction.

A pending Ethereum transaction needs to receive a certain number of confirmations. The higher the gas rate, the greater the certainty that the Ethereum network processed and recognized the transaction.

Recent blocks can be rearranged, giving the impression that transaction processing has failed. Even so, the transaction can be included in another block and is still valid. The probability of reorganization decreases with each subsequently mined block, that is, the more commits, the more immutable the transaction becomes.

Ethereum transaction confirmations

A transaction fee is an incentive that users pay to block miners. It is used to send a particular transaction on the Ethereum blockchain.

Ethereum blockchain transaction fees are also called gas fees as they are related to gas, a pricing mechanism used on the Ethereum network that refers to the calculation required to process the transaction by a miner. . The computational tasks of a transaction are measured in terms of the cost of gas.

On the other hand, each gas unit has a gas price expressed in ETH. Although the complexity of a particular transaction determines the cost of gas, users can set their own gas price and limit, or the maximum number of gas units consumed by the transaction.

What is a nonce?

A nonce is an abbreviation for "number only used once", which refers to the total number of confirmed transactions sent from the given Ethereum address.

Ethereum wallets can stream multiple transactions from one account without much delay to each other, which means that a nonce calculation is considered a necessary mechanism that determines which transaction is processed first. Usually Ethereum wallet apps take care of nonce management for users.

How to cancel an Ethereum transaction?

There are two main methods of canceling a pending Ethereum transaction: in-app cancellation and setting a custom nonce.

Typically, Ethereum transactions are pending for hours or get stuck when users ship with a low gas price. Therefore, users often find it necessary to change Ethereum transactions.

When resolving this issue, users should remember that cancellation can only be attempted if the transaction is still pending on the network. The first step they must take is to check in a block explorer if the transaction is still pending. Mainly, to paste the transaction hash, also known as the Ethereum transaction ID, and if a block explorer says "pending", users can still try to cancel it.

The easiest way to cancel a stuck Ethereum transaction is in-app cancellation, which requires users to exit the Ethereum wallet app and close their browser, reopen it, and log back into the app.

If these steps don't solve the problem, the second way will come to the rescue.

Canceling a pending Ethereum transaction by setting a custom nonce means generating a 0 ETH transaction with a high gas price at the user's own address to prevent a previous transaction from being blocked. Before submitting this second transaction, users must make a note of the nonce that the original pending transaction is using, and then reuse the same nonce that they noted.

If users have multiple Ethereum transactions pending, they preferably start with the oldest or the lowest nonce value.

How to speed up the Ethereum transaction?

Users can speed up a slow Ethereum transaction by adding gasoline. This step can incentivize Ethereum miners to prioritize it.

If an Ethereum user sets a gas price too low, other users have a chance to outbid this initial offer and the transaction will remain pending. When the transaction is blocked, the network does not confirm any new transactions from the same wallet address until the miner confirms the first transaction.

In this situation, users can choose to wait until the network is ready to process a transaction at the set price or to resend the original transaction, but at a higher gas rate. Clicking the "speed up" button in your Ethreum wallet should allow the transaction to process faster.

If the above step didn't work, users can go to advanced tab to set gas price manually.

After all, users are advised to look up the transaction in the blockchain explorer by posting its hash to see if it was processed correctly. If the transaction does not appear immediately, they will have to wait a few minutes and refresh a page.

Can Ethereum transactions be reversed?

Ethereum wallets cannot reverse already completed Ethereum transactions.

When Ethereum users accidentally send funds to the wrong address or send the wrong amount of ETH, they can cancel the transaction while it is still pending. When the transaction is confirmed and displayed as "Successful", meaning that it has been added to the next block, it cannot be reversed. The Ethereum blockchain is designed as immutable, so the data blocks entered are irreversible. Knowing this, it is essential to ensure that the transaction details are correct before clicking the submit button.

Finally, it is worth noting that many blockchain startups have already developed mechanisms that would allow users to reverse Ethereum transactions.