5

I'm curious as to what happens to transactions in orphaned blocks and what happens when a transaction gets dropped.

Transactions in orphaned blocks

They appear when a soft fork happens. All the transactions in the orphaned branch return to the mempool keeping their transaction ID and might eventually be included in some block.

Dropped transactions

A transaction can be dropped if it spends to much time in the mempool without being accepted by any miner (as was the case with some transactions a while ago when the Cryptokittes app congested the network and raised gas price). In that case the transaction needs to be resubmitted and is granted a new transaction ID

Could you comment on my bold statements and correct them if they are wrong? Also, what is the criteria to drop a transaction from the mempool?

1

You are broadly correct, although it's kinda misleading to think of "the" mempool. Every Ethereum node has a mempool, some bigger than others. A transaction may be dropped from a miner's mempool, only to be re-added by a peer later. If you're running a node locally, it'll typically keep any transactions you submit to it indefinitely, so your transaction may be retried when the network is quieter.

If a transaction's been dropped from every mempool, then you can resubmit it, and it may get a new transaction id (although the id is based on its hash, so it may be the same).

One other key concept is the "nonce". The first transaction sent from an account has nonce 0. The second has nonce 1. Transactions have to be processed in nonce order, with no skipping. This also means that if you want to resubmit a transaction with too low a gas price, you just have to use the same nonce as the one you're resubmitting (nodes will drop a transaction if one comes in with the same address and nonce, but higher gas price). In a pinch, you can also use this to cancel a not-yet-mined transaction, by submitting a completely different transaction with the same nonce and higher gas price.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.