4

When are transactions dropped from the blockchain?

Suppose I broadcast a transaction to the blockchain, then it is a pending transaction waiting to be mined.

But when are pending transactions dropped from the blockchain, e.g., if the gas price is too low? Can someone think of other reasons for miners not willing to include the transaction?

If transactions are not discarded at some point, then an enormous amount of pending transactions could result.

4

All transactions are kept in the Mempool a term borrowed from Bitcoin. You can see all the current pending transactions here: Pending Transactions

There's a limit to the size of the Mempool and once it reaches its limit it will start removing transactions. This article When there are too many pending transactions explains it pretty well.

In Geth 1.6.5, the basic config for the mempool is in a Go structure called TxPoolConfig. One of the interesting fields in that structure is GlobalSlots ("Maximum number of executable transaction slots for all accounts"). In the default config (DefaultTxPoolConfig), GlobalSlots is set to 4,096. Once that limit is reached, Geth starts freeing up space by evicting some of the transactions in its mempool according to a fairly complex set of rules.

  • 1
    If a transaction is evicted from the mempool in one node it doesn't mean it will disappear from the network. Another node can keep it around and resubmit it again when it reconnects. – Ismael Nov 22 '17 at 2:42
  • Are pending transactions removed from the Mempool in a FIFO (first-in-first-out) manner, i.e., a queue? +1 for your answer. – Shuzheng Nov 22 '17 at 9:46
  • 1
    @Shuzheng Well transactions that arrive in the mempool first have a higher chance of getting mined and added to a block, but there's a lot of factors to consider the most obvious one is the gas price you're willing to pay. The same way the transactions that are in the bottom of the mempool are more likely to be removed but like Ismael said the removed transaction can be resubmitted. These are the rules of the Bitcoin mempool which should be quite similar How do transactions leave the mempool – I.B Nov 22 '17 at 14:06

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.