---
title: "Feerate Diagram — definition | Nuri Glossary"
description: "A chart of cumulative size against cumulative fee, used to compare how good two block templates are."
lang: "en"
type: "glossary-term"
canonical: "https://nuri.com/glossary/feerate-diagram"
---

# Feerate Diagram

A chart of cumulative size against cumulative fee, used to compare how good two block templates are.

## Basically

A feerate diagram shows total transaction size against total fees. You can use it to see which set of transactions would make a better block for a miner.

## Key Takeaways

- A feerate diagram plots cumulative transaction size against cumulative fee for a mempool's linearisation. Its concave curve has a slope for each chunk that equals that chunk's feerate.
- Comparing feerate diagrams shows whether a replacement improves the mempool. One diagram is strictly better only if its curve is at least as high everywhere and strictly higher somewhere.
- Feerate diagrams were introduced alongside Bitcoin Core's cluster mempool redesign. They provide a mathematically rigorous framework for incentive-compatible transaction replacement, block building and eviction.

## What Is a Feerate Diagram?

A feerate diagram is a graph that shows the total fee a miner could collect by including transactions up to a given cumulative size from a mempool's linearisation, with cumulative transaction size in virtual bytes on the x-axis and cumulative fee in satoshis on the y-axis. Each point on the curve corresponds to the end of a chunk, a group of transactions from the linearisation that share the same effective feerate. Between these points, the curve interpolates linearly.
The concept was formalised as part of Bitcoin Core's cluster mempool proposal, primarily by developer Pieter Wuille. Before cluster mempool, Bitcoin Core lacked a unified way to compare different mempool states and determine which one would produce better block templates for miners. The feerate diagram provides this: a total ordering, or partial ordering, over mempool configurations that captures their relative value to miners.
The key mathematical property is concavity: a valid feerate diagram is the smallest concave function that sits at or above every prefix's fee-versus-size point. Because chunks are ordered by decreasing feerate, the curve rises steeply at first and then flattens, with the highest-feerate chunks first and the slope decreasing as lower-feerate chunks are added. This shape directly reflects how a rational miner would build a block, by including the highest-feerate transactions first.

## How It Works

Constructing a feerate diagram begins with the linearisation of a cluster. A cluster is a group of related, connected mempool transactions, and its linearisation orders these transactions so that high-feerate subsets come first while respecting dependency, or topological, constraints. Once linearised, the transactions are partitioned into chunks.

## From Linearisation to Chunks

Chunks are contiguous groups of transactions in the linearisation where merging them yields a non-increasing sequence of feerates. Each chunk has a single effective feerate: its total fee divided by its total size. The chunking process works as follows:
The result is a partition of the cluster into chunks with strictly non-increasing feerates. These chunks are the building blocks of the feerate diagram.

## Plotting the Diagram

Each chunk contributes one line segment to the diagram. Starting from the origin (0, 0), the first chunk extends the curve to the point (chunk_size, chunk_fee). Each subsequent chunk adds its size and fee to the running totals, as shown in the pseudocode.
The slope of each line segment equals the feerate of the corresponding chunk. Because chunks are ordered by decreasing feerate, the slopes form a non-increasing sequence, which guarantees the concave shape.

## Comparing Two Diagrams

The primary purpose of feerate diagrams is comparison. Given two mempool states, such as the current mempool and a proposed replacement, you can compare their feerate diagrams point by point.
This comparison defines a partial ordering over mempool states. Not every pair of states can be ranked, which prevents the system from accepting replacements that help one part of the mempool while harming another.

## Incentive-Compatible RBF

The most significant application of feerate diagrams is improving replace-by-fee (RBF) policy. Under the legacy BIP 125 rules, a replacement transaction had to pay a higher absolute fee than the sum of all transactions it displaced and cover the minimum relay fee for its own size. These rules could produce perverse outcomes: a replacement might pay more total fee but have a lower feerate, meaning miners would actually prefer the original transactions for block inclusion.
With feerate diagrams, Bitcoin Core can evaluate whether a replacement genuinely improves the mempool from a miner's perspective. A replacement is accepted only if the resulting mempool's feerate diagram is strictly better than the current one. This ensures that every accepted replacement increases the total fee a miner would collect at every possible block size threshold, not just in aggregate; for deeper analysis, see the cluster mempool deep dive.

## Block Template Construction

The feerate diagram directly informs how miners build block templates. The optimal strategy is straightforward: include chunks from highest feerate to lowest feerate across all clusters until the block is full. This is equivalent to filling the block by tracing the feerate diagram from left to right, always selecting the steepest available segment.
Because chunks represent indivisible units for template purposes, splitting a chunk would violate topological ordering, so the block template may not perfectly fill the block size limit. This bin-packing effect at the tail end of the block is a known limitation that the feerate diagram does not capture.

## Mempool Eviction

When the mempool exceeds its size limit, nodes must evict transactions. The feerate diagram guides this decision by identifying the lowest-value transactions: eviction removes the lowest-feerate chunks, the rightmost and flattest segments of the diagram, first. This is the mirror image of block building: building selects from the left, where feerates are highest, while eviction removes from the right, where feerates are lowest.

## Why It Matters

Before the feerate diagram framework, Bitcoin Core's mempool policies relied on heuristic rules that could be gamed or could produce suboptimal outcomes. The ancestor-feerate-based mining algorithm and the BIP 125 replacement rules operated on different models of transaction priority, leading to inconsistencies. A transaction could be accepted as a "better" replacement under RBF rules while actually producing a worse block template.
Feerate diagrams unify these operations under a single mathematical framework, so block building, eviction and replacement all reference the same curve. When a replacement improves the diagram, it improves the block template by definition. When an eviction removes the diagram's tail, it removes the least valuable transactions by definition.
For Bitcoin's fee market, this matters because miners can trust that their mempool policies are aligned with revenue maximisation. Users benefit because fee-bumping strategies like RBF produce predictable results: a higher-feerate replacement will always be accepted if it genuinely improves the mempool.
Layer 2 protocols also benefit. Networks like Lightning and Spark depend on timely on-chain settlement of commitment and penalty transactions. Predictable fee-bumping behaviour, grounded in the feerate diagram model, gives these protocols stronger guarantees that their transactions will be included when needed.

## Partial Ordering Limitations

Because feerate diagram comparison is a partial ordering, some replacement proposals are "incomparable": neither strictly better nor strictly worse. In these cases, the replacement is rejected, even if it might arguably improve the mempool in some dimensions. This conservatism prevents certain valid replacements from being accepted but avoids the risk of making the mempool worse from a miner's perspective.

## Bin-Packing at the Block Boundary

The feerate diagram measures quality at the chunk level, but block templates have a hard size limit. The last few chunks may not fit cleanly within the remaining block space, and the diagram does not account for this tail effect. Two diagrams that appear identical at the chunk level could produce different actual block revenues depending on how their chunks fit the remaining space.

## Computational Complexity

Constructing optimal linearisations, which produce the best possible feerate diagrams, is computationally expensive for large clusters. Bitcoin Core mitigates this by limiting cluster size and using bounded-search algorithms that find good, though not always optimal, linearisations. The default limits in Bitcoin Core cap clusters at 101 kvB in size and 64 transactions.

## Sensitivity to Linearisation Quality

The quality of the feerate diagram depends entirely on the quality of the underlying linearisation. A suboptimal linearisation produces a feerate diagram that understates the mempool's true value. Two implementations using different linearisation algorithms could produce different feerate diagrams for the same set of transactions, leading to divergent replacement and eviction decisions.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.
Part of the [Nuri glossary](https://nuri.com/glossary), which defines 1876 Bitcoin, Lightning, wallet, stablecoin and payment terms.
