TeachMeBitcoin

Mempool Architecture & Eviction

From TeachMeBitcoin, the free encyclopedia ⏱️ 4 min read

The Memory Pool: Architecture, Eviction, and Fee Floor Dynamics

The Memory Pool (or Mempool) represents a node's in-memory waiting area for validated, unconfirmed transactions. It forms the transactional staging layer where transactions reside before they are compiled into a candidate block by a miner.

Rather than being a single, unified global network database, the mempool is entirely localized. Each node on the network independently manages its own transaction cache according to its local policies, system memory limits, and fee criteria.


🏗️ 1. Transaction Admission and the Mempool Lifecycle

Before any transaction can enter a local node's mempool, it must pass a series of strict consensus validation checks and policy filters.

                      TRANSACTION VALIDATION AND MEMPOOL PATHWAY

                       ┌──────────────────────────────────┐
                       │  Incoming Raw Transaction Bytes │
                       └────────────────┬─────────────────┘
                                        │
                                        ▼
                       ┌──────────────────────────────────┐
                       │     Consensus validation Engine   │
                       │  • Are inputs unspent? (UTXO)    │
                       │  • Are signatures correct? (Sig) │
                       │  • No double-spends in chain?    │
                       └────────────────┬─────────────────┘
                                        │ (Pass)
                                        ▼
                       ┌──────────────────────────────────┐
                       │      Policy Filter (Standard)    │
                       │  • Is size below 100,000 vBytes? │
                       │  • Feerate >= minrelaytxfee?     │
                       │  • Non-standard scripts rejected?│
                       └────────────────┬─────────────────┘
                                        │ (Pass)
                                        ▼
                       ┌──────────────────────────────────┐
                       │      Admission to Local RAM       │
                       │  (Propagated to connected peers) │
                       └──────────────────────────────────┘

The Three Ingestion Pathways


📈 2. Volatile RAM Management and Size-Based Evictions

Because the mempool must be parsed and searched in real time during peer transaction validation, it is hosted entirely in system RAM rather than on non-volatile disk storage.

                       RAM MEMORY VS. SERIALIZED PAYLOAD SIZES

      ┌─────────────────────────────────────────────────────────┐
      │  Serialized Transaction Bytes on P2P Wire (e.g. 100 MB) │
      └────────────────────────────┬────────────────────────────┘
                                   │
                                   ▼  [Inflated via Database Overhead]
      ┌─────────────────────────────────────────────────────────┐
      │  Local RAM Database Allocation in Node (e.g. 300-400 MB) │
      │  • Tx Indexes & UTXO Lookups                            │
      │  • Ancestor / Descendant Tree Metadata (DAG)            │
      │  • Multi-index sorting structures                       │
      └─────────────────────────────────────────────────────────┘

📉 3. The Dynamic Eviction Pipeline

When the real RAM utilization of a node's mempool exceeds the maxmempool setting:

  1. Sorting and Slicing: The node evaluates the eviction scoring of all unconfirmed transactions. Scoring is based on the Descendant Feerate of each transaction package.
  2. Trimming the Tail: The node identifies the transaction package with the absolute lowest scoring feerate and evicts it completely from RAM, along with all of its descendant transactions.
  3. Elevating the Minimum Floor (mempoolminfee): Once evictions occur, the minimum acceptable fee floor for new transaction admission is dynamically elevated: $$\text{mempoolminfee} = \max(\text{minrelaytxfee}, \text{Feerate of evicted package} + \text{incrementalrelayfee})$$
  4. Rejection of New Low-Fee Transactions: Any incoming transaction whose feerate is lower than the updated mempoolminfee is immediately rejected.
  5. Linear Fee-Floor Decay: Over time, as transactions get mined and memory pressure decreases, the dynamic fee floor slowly decays. It halves approximately every $12\text{ hours}$ of idle time until it returns to the base static configuration level of $1\text{ sat/vB}$ (minrelaytxfee).
☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!