Request: How many mempool transactions are evicted by time?

Sadeeq raised a potential issue with time-based expiry of mempool transactions whereby a transaction that is likely to be mined in the next block could be evicted. David responded with a great history of time-based mempool expiry. After reading the thread, I’m not particularly convinced we need to index by time, but I would like to know how many transactions are expired due to the default timeout of 2 weeks.

I came across this issue when researching what it would take to remove the boost multi-index from Bitcoin Core dependencies. No matter the approach, removing time as a key would greatly simplify the patch-set.

This is probably derivable from the other data offers, but I thought I would post this for discussion anyway.

I have logs since early 2024 from multiple nodes that include [validation] TransactionRemovedFromMempool: txid=xyz wtxid=abc reason=expiry.

I might also have backups of mempool-observer databases that include this. I would need to check - it’s been a while since I worked with them.

Would a graph with time-based evictions per day be helpful? Do you need raw data?

I think a graph would be great! I am just trying to get a gut-feel for how often this may occur.

I noticed that we log two lines for each expiring transaction, so just grepping for a reason=expiry will yield two log entries for each transaction that expires.

[validation] Enqueuing TransactionRemovedFromMempool ... reason=expiry
[validation] TransactionRemovedFromMempool ... reason=expiry

While analyzing the data, it took me a while to find something that conveys what I’m seeing: The upper part shows the average number of expiries per day on the nodes that saw at least one expiry on that day. This is usually somewhere between 10 and 10k. There are also days without any expiries. This is shown in the bottom part of the chart: when it reaches 100%, all nodes didn’t see an expiry.

I was surprised to see only very few days between 2025-02-01 and 2025-09-15 with expires. I see the other obvious mempool removal reasons on these dates (block, conflict, …) but no reason=expiry.

1 Like

The most transaction expires per day in my data, with roughly 57k expired, happened on 2025-09-30. These expired in two batches:

  1. a smaller batch at around 8:00 am UTC
  2. a larger batch at around 11:00 am UTC

I manually looked up some of the txids of the two batches:

  1. small batch at 8am
  1. larger batch 11am:

For both batches, all transactions I looked at were eventually mined. So either someone rebroadcast them, or pools kept them around. The first batch transactions all seem to reveal an inscription and have a runestone OP_RETURN. The second batch all seem to have a OP_RETURN runestone, but don’t reveal an inscription.

I was wondering if these transactions were rebroadcast or if the miners still had them. We don’t know for sure what the miners did, but grepping for the txids show that they all were re-added to my mempool on 2025-10-03.

  1. small batch at 8am:
  • 283010443254facdf72e7e3445e45ea608d06105950213925b4c025766983d1e: 2025-10-03T11:10:36.863086Z AcceptToMemoryPool
  • 638a0d23a145f989c6bdeb8aaefe1cf05e2007c592d958317e5457b8a9b1b3fc: 2025-10-03T11:19:04.324639Z AcceptToMemoryPool
  • 8aae8b644ba485e128afe65c4284b849862711fe15ff00d878cd403153fab653: 2025-10-03T11:40:55.635440Z AcceptToMemoryPool
  • 20aeff4fee6ff3a8b11971bec0bff621308a6df15660f4126b83eee43069ac2b: 2025-10-03T11:57:13.099842Z AcceptToMemoryPool
  1. larger batch 11am:
  • 97c588cb4eb2d71a235aecd07afa53715d964c1a3dc34e8adf817b99ed63f1ed: 2025-10-03T11:45:05.443985Z AcceptToMemoryPool
  • a93fe961c4a0e7c4a0ca574a0c2f87ceef7347ae5c0b3797b256b23fdadf7b5c: 2025-10-03T11:47:00.555131Z AcceptToMemoryPool
  • dfcd93a9fde18f92fdb3ebd5d618ca3104b06005dbe91a4450e897527fb948e1: 2025-10-03T11:57:25.844020Z AcceptToMemoryPool
  • 9ad32067b6fd4059b72dc540deef39f8a6b21eadd4da7377ede43d62cc97652f: 2025-10-03T11:09:19.685492Z AcceptToMemoryPool
1 Like

Thanks for the comprehensive research, certainly an interesting result. Given the example of the mass expiry with a big wave of rebroadcast, it seems the expiry mechanism is just adding marginal bandwidth use for no gain, as they were all eventually mined. I wonder if we can find examples of 1. a transaction is “expired,” was not seen in a later rebroadcast announcement, but was later mined, indicating miners are running a longer expiry. 2. a transaction was “expired” and was in fact replaced by adding/changing inputs. (1) is not possible to prove with certainty of course, but if a new tx announcement does not come up in a well-connected node’s logs and yet the (expired) tx was mined, I think we can have high confidence the default expiry was not used by miners. In investigating (1) if it was found that all transactions end up being re-broadcast, that would indicate to me that time isn’t doing much at all in practice.

This sounds doable, but I can’t promise I’ll get to this anytime soon.

1 Like