Ethereum Transactions - Pending, Mined, Dropped & Replaced
Ethereum Transactions - Pending, Mined, Dropped & Replaced
Let's talk about Transaction Staging from User to Block on Ethereum. When you do trading, you actually are sending transactions to blockchain, and then the blockchain will save the trading record onto itself so that everybody can query it and get acknowledged. Thus your asset is liquiding in the Ethereum economic system.
Transaction has 5 stages,
- Init
- Pending
- Dropped
- Replaced
- Mined
Init Stage
This is the initial status of a transaction. It means, by your authority, the wallet is generating the transaction information locally, preparing ready the sender, the receiver, gas fee, transferred asset, your signature. It has nothing with the blockchain for now, a "string of charactors".
Pending Stage
Once the wallet connects with blockchain node, and broadcasts the "string of charactors" to the blockchain, the transaction goes into "Pending Stage". When a transaction is in pending stage, it is alive in a pool called "Mempool".
What is Mempool?
Mempool, as the name implies, memory pool, in which the transaction is not locked down onto the blockchain, it might be dropped, might be replaced, might be verified, might be executed failed, the pool is a place for transactions to be checked(C), to be executed(E), to be organized(O) before recording onto blockchain.
What is to be Checked?
Transaction protocol validation, double spending.
What is to be Executed?
The code logic in contract.
What is to be Organized?
Transaction prioritization by miners.
In summary, Mempool is the stage for miners, they are the CEOs, responsible for getting the job done.
Dropped Stage
The transactions go into "Dropped Stage" if CEO does not accept them after "working". Once dropped, the transaction will be removed from Mempool and without being included in a block.
The Not-Accept reasons are normally below,
- Invalid Transaction
- Transaction Expired
- Transaction Replaced
Replaced Stage
The user broadcasts another transaction with the same NONCE but a higher gas price. This new transaction is intended to replace the original transaction, with different tx hash. Miners prioritize transactions with higher gas prices, so the replacement transaction may be included in a block.
What is NONCE?
A nonce in Ethereum serves as a security measure to prevent replay attacks and as a mechanism for enforcing the order of transactions from the same sender address.
Using nonce to replace old transactions
Nonce is an advanced usage for senior users, it is useful when you want to cancel/replace the old transaction and want to speed up the transactions. You can change the gas fee to be higher and send a new transaction from the same address with the same nonce, then miners will choose your higher gas transactions verified, omitting the old one yet.
Mined Stage
Come to the last final stage of a transaction, it is being successfully included in a block by a miner and confirmed on the Ethereum blockchain. Its details, including sender, recipient, and amount, are permanently recorded on the Ethereum blockchain and cannot be altered or reversed.