Ethereum is experiencing a backlog of transactions at current, resulting in a number of transactions not being processed for hours or even days. This article explains how transactions can become stuck, and what can be done to release them.
The latter website is especially useful because it can order transactions by gas price. To do so click on the GasPrice column. The resultant list is roughly how miners will look at the transactions so if you select a gas price value to ensure that your transaction is in the first couple of pages you are likely to have very short confirmation times.
But what if your transaction has not been confirmed? It is possible that it has become stuck, and needs action to be released.
Understanding stuck transactions
Before explaining how to release stuck transactions it is important to understand why transactions become stuck in the first place. Ethereum is a blockchain: multiple blocks, each containing transactions and linked one after the other in a chain as shown below:
(In reality both individual blocks and the chain structure are more complex, but the diagram provides a sufficient overview for the purpose of this article).
The concept of blocks being created by miners through a process called mining is well-known, but the process by which transactions are selected for a particular block is less clear. To explore this process in more detail, let us look at the creation of example block 1434 below.
Ethereum contains many elements other than the blockchain, and one of these is the transaction pool. The transaction pool contains all of the transactions that have been submitted to the Ethereum network but have not been allocated to a block.
At the point that block 1433 has been mined, the mining of block 1434 begins. Block 1434 starts empty:
The miner will select a number of transactions from the transaction pool to insert in to block 1434 and start the mining process:
Once block 1434 has been mined successfully it forms part of the blockchain and the relevant transactions are removed from the transaction pool:
(Again, this is a much-simplified explanation of what really goes on).
The obvious question is “how do miners select which transactions to put in to their block?”, to which the answer is: “money”.
Every transaction submitted to Ethereum has a number attached to it that represents the amount of funds that the submitter is willing to pay the miner to include the transaction in their block, known as the gas price. When a miner examines the transaction pool and sees two otherwise identical transactions it will pick the one with the higher gas price, as that will result in more money being paid to the miner when the block is mined.
(Another simplification; the total amount of money that the submitter pays the miner is in fact the gas price multiplied by gas used. In turn, gas used is dependent on the complexity of the contract being called by the transaction. The important point to remember, though, is that higher gas price transactions are more attractive to miners).
When there are more transactions in the pool than fit in the next block this means that those transactions with lower gas prices will be left out of the block. And if the number of higher gas price transactions entering the pool meets or exceeds the capacity of each block then ones with low gas prices might never be picked. At this point the low gas price transaction is stuck.
Dealing with stuck transactions
Transactions can become unstuck by themselves if the number of transactions being submitted to Ethereum drops, but otherwise manual intervention is required to release them.
Releasing a transaction requires increasing the gas price for the transaction to a higher value such that it will be higher up the list when the miner selects transactions for a block. To do this the transaction must be rebroadcast with a higher gas price. For example, here is a transaction that is stuck due to a low gas price:
Note that the “From” address and the “Nonce” are the same in both transactions. These two values identify the transaction, and allow it to be overwritten. Also, the gas price has changed accordingly.
Alternatively, the transaction might need to be cancelled. Ethereum has no mechanism to remove a transaction from the transaction pool but it is possible to overwrite the transaction with different information, for example a 0-value transfer back to the sender, that has a similar effect. However, this is still a transaction and will still need to be mined. Resubmitting the above transaction with a cancellation results in the following:
Note that the “To” address has changed to the same as the “From” address and the “Value” is now 0.
Whenever a transaction is replaced the new gas price must be more than 10% higher than the previous price to be accepted, so an attempt to change a gas price from 20GWei to 21GWei will not succeed and the original transaction will remain in the transaction pool.
Using Ethereal to release stuck transactions
is a command-line tool that allows you to carry out common Ethereum activities using standard Geth or Parity keystores. Ethereal contains commands to release stuck transactions with ease.
To install Ethereal you will need to have Go installed. To check if you have Go installed type:
Use of Ethereal can provide you with the ability to release stuck transactions and ensure that transactions go through in time even when the Ethereum network is busy. Full information about Ethereal and its additional capabilities can be found at its github page⧉