Blockchain Semantics Insights
Business Case | Deep Tech | Announcements | Blockchain Glossary |
Releasing Pending Transactions On EthereumBy Viswanath Kapavarapu | May 21, 2018, 3:21 p.m. GMT
The popularity of DApps and Initial Coin Offerings (ICOs) often lead to network congestion on Ethereum. ICOs account for a significant portion of the trading volume on Ethereum. In June 2017, the Ethereum network was unable to handle the surmounting transaction volume from Bancor’s ICO, which raised nearly $153 million in just three hours. These lead to a backlog of transactions that can remain unprocessed for hours and even days at a time. This article tries to explain how to deal with such pending transactions on Ethereum.
For this, it is important to understand why transactions become stuck and why a user needs to worry about them.
Why do transactions get stuck?
Each new transaction submitted to the Ethereum network is included in a transaction pool. This transaction pool contains all the pending transactions that have not yet been included in a block.
Miners, as a part of the consensus mechanism, select some transactions from the transaction pool and start including them into a block. This block then gets included in the main Ethereumchain through a complex process known as Mining. Once the block has been mined, all the relevant transactions from the block are marked complete and removed from the transaction pool.
But how does a miner decide which transactions to be included in the block? The answer is simple: Transactions with a higher gas price will get prioritized by the miner over several other transactions from the mining pool.
So, when there are more transactions in the pool than those that can fit in a block, those with lower gas prices will be left out of the block. At this point, a low gas priced transaction can get stuck in the Ethereum pool. But why do you have to worry about stuck transactions? Can’t you just transact on the Ethereum Network leaving the stuck transaction alone? Again the answer is No. If you have a pending transaction, it will hold up your entire account and you won’t be able to transact until the previous transaction gets processed. Therefore it is important to learn on how to deal with stuck transactions.
Dealing with Stuck Transactions
Transactions can become unstuck by themselves if the volume being submitted to Ethereum drops. However, if this doesn’t work out, manual intervention is required.
Releasing a stuck transaction requires increasing the gas price to a sufficiently high value so that when the miner sees two identical transactions, he will prioritize the one with higher gas price while selecting from a pool of transactions. However, how does one create an identical transaction that looks similar to the previous transaction?
Each transaction broadcast in Ethereum will have a unique identifier known as Nonce. This nonce, along with the sender and recipient address uniquely identifies a transaction. Therefore, all the user has to do is create another transaction with the same nonce, sender, and recipient address to overwrite the previous one.
Let’s take a look at a transaction stuck in the Ethereum pool:
The above transaction is stuck in Ethereum for approximately 26 days because of a low gas price of 0.01 GWei. To get the transaction processed, it needs to re-submitted with a higher gas price of say, 4 Gwei. You can do this using the following procedure:
- Open MyEtherWallet
- Click on the Send Offline tab
- Copy the From Address, To Address, Nonce, Value, and Input Data from the Etherscan page. The From Address, To Address, and Nonce can be used together to identify the transaction and allow it to be overwritten.
- Change the gas price from 0.01 Gwei to 4Gwei or higher.
- Note that 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 0.01GWei to 0.101GWei will not succeed and the original transaction will remain in the transaction pool.
- Generate the transaction and re-broadcast it.