Glossary

Package RBF (Package Replace-by-Fee)

Package RBF allows a group of related transactions to replace conflicting mempool transactions based on their combined fee rate.

Key Takeaways

  • Package RBF extends standard Replace-by-Fee to transaction groups: a parent and child submitted together can replace conflicting mempool transactions if the package's combined fee rate exceeds the conflicts'.
  • This feature solves a critical problem for Lightning Network and other protocols that use pre-signed transactions: it allows fee bumping a low-fee parent by attaching a high-fee child, even when the parent conflicts with an existing mempool transaction.
  • Package RBF works alongside TRUC (v3) transactions and pay-to-anchor outputs to defend against transaction pinning attacks.

What Is Package RBF?

Package RBF (Package Replace-by-Fee) is a Bitcoin mempool policy that allows a group of related transactions, called a package, to replace conflicting unconfirmed transactions based on their combined fee rate. Standard RBF lets one transaction replace another single transaction that pays a lower fee. Package RBF extends this concept to packages of transactions: typically one parent and one child that are evaluated together.

The motivation comes from protocols like the Lightning Network where commitment transactions are pre-signed by both parties at channel-opening time. Because fees are fixed when these transactions are signed, the pre-signed parent may carry a fee rate too low for current mempool conditions. Without package RBF, the broadcaster has no way to replace a conflicting version already in the mempool by attaching a high-fee child. Package RBF closes this gap by evaluating the parent and child as a unit when deciding whether a replacement improves miner revenue.

Package RBF shipped in a limited form in Bitcoin Core 28.0 (October 2024) as part of the broader package relay initiative. It is restricted to packages containing one parent and one child (1P1C), and is designed to work with TRUC (v3) transactions that enforce strict topology limits.

How It Works

To understand package RBF, it helps to contrast it with standard single-transaction RBF and child-pays-for-parent (CPFP).

Standard RBF Limitations

Under standard Replace-by-Fee (BIP 125), a replacement transaction must pay a higher fee rate and a higher absolute fee than the transaction it replaces. This works well when the sender controls the transaction and can simply create a new version with higher fees. But it fails when the transaction is pre-signed and cannot be modified, which is exactly the situation in Lightning and other contracting protocols.

The CPFP Gap

CPFP allows a child transaction to boost a low-fee parent into a block by spending one of the parent's outputs. Miners evaluate the parent and child together and include both if the combined fee rate meets the threshold. But CPFP alone does not solve the replacement problem: if a conflicting version of the parent is already in the mempool, CPFP cannot replace it because the child spends outputs from a different transaction than the one currently in the mempool.

Package RBF Mechanics

Package RBF bridges this gap. When a node receives a package (parent + child), it evaluates whether the package should replace any conflicting transactions already in the mempool. The process works as follows:

  1. A node receives a package consisting of a parent transaction and a child transaction that spends one of the parent's outputs
  2. The node identifies any existing mempool transactions that conflict with the parent (they spend the same inputs)
  3. Instead of evaluating the parent's fee rate alone, the node calculates the package's combined fee rate across both parent and child
  4. The node checks whether replacing the conflicts with the new package would improve the mempool's feerate diagram: a measure of whether miners would earn more revenue
  5. If the package passes all checks, the conflicting transactions are evicted and the package is accepted into the mempool

Feerate Diagram Test

Traditional RBF uses simple rules: pay more total fees and a higher fee rate. Package RBF uses a more sophisticated test based on the feerate diagram. This diagram represents how much fee revenue miners would collect at every possible block-size threshold. A replacement is accepted only if the new diagram is strictly better than the old one, ensuring that miners are always better off after the replacement.

# Simplified package RBF evaluation logic
#
# Existing mempool: TX_A (parent, 1 sat/vB, 200 vB)
# New package:      TX_B (parent, 0 sat/vB, 200 vB)
#                 + TX_C (child,  50 sat/vB, 100 vB)
#
# TX_A total fee:    200 sats
# Package fee:       0 + 5,000 = 5,000 sats
# Package fee rate:  5,000 / 300 = 16.67 sat/vB
#
# Result: package replaces TX_A because 16.67 > 1 sat/vB
#         and total fees are higher

Topology Restrictions

Package RBF is currently restricted to clusters of size two or fewer (one parent and one child). This restriction exists because building accurate feerate diagrams for larger transaction clusters is computationally complex. TRUC transactions enforce this topology constraint by mempool policy: an unconfirmed TRUC transaction may have at most one unconfirmed parent and one unconfirmed child. This tight structure makes package RBF evaluation straightforward and safe to deploy.

Relationship with TRUC and Pay-to-Anchor

Package RBF does not exist in isolation. It is part of a coordinated set of mempool policy changes designed to make fee bumping reliable for contracting protocols:

  • TRUC (v3) transactions (BIP 431) restrict unconfirmed transaction topology to 1-parent-1-child, preventing adversaries from attaching bloated descendants that block replacements
  • Pay-to-anchor outputs provide a standard, anyone-can-spend output that any party can use to attach a CPFP child for fee bumping
  • Package RBF allows the CPFP child to contribute its fees toward replacing a conflicting parent already in the mempool
  • Sibling eviction allows a new child to replace an existing child of the same TRUC parent, preventing an adversary from pinning with a low-fee child

Together, these policies form a complete solution for reliable fee bumping in adversarial environments. The V3 Transactions and Package Relay research article explains how Lightning Network implementations are adopting this stack.

Why It Matters for Lightning

The Lightning Network depends heavily on the ability to broadcast pre-signed transactions and get them confirmed promptly. When a channel force-closes, the broadcasting party publishes a commitment transaction whose fee was set at signing time, potentially days or weeks earlier. If mempool conditions have changed, that fee may be insufficient.

Before package RBF, this created a serious vulnerability: transaction pinning. A malicious counterparty could exploit mempool rules to prevent the honest party from getting their commitment transaction confirmed. For example, an attacker could broadcast their own version of the commitment transaction with a large, low-fee child that consumed the descendant limit, blocking legitimate CPFP attempts.

Package RBF, combined with TRUC and anchor outputs, eliminates this class of attack. The honest party can always attach a high-fee child to their commitment transaction and have the package replace any conflicting transactions, regardless of what the adversary has done.

Use Cases

Lightning Channel Force-Close

When a Lightning channel force-closes, the broadcasting node publishes its commitment transaction. If a conflicting version is already in the mempool, package RBF allows the node to replace it by attaching a high-fee child to its own commitment transaction. This ensures that honest parties can always get their transactions confirmed during disputes.

Pre-Signed Transaction Protocols

Any protocol that uses pre-signed transactions benefits from package RBF. This includes discreet log contracts (DLCs), coinpools, Ark, and other contracting protocols where transaction fees cannot be adjusted after signing.

Submarine Swaps and Atomic Swaps

Cross-layer swap protocols often involve pre-signed refund transactions. Package RBF ensures that these refund transactions can be fee-bumped even if a conflicting transaction exists, making swaps safer under volatile fee conditions.

Wallet Fee Bumping

Even regular wallet users benefit indirectly. The submitpackage RPC in Bitcoin Core allows wallets to submit parent-child packages for evaluation, enabling more reliable fee bumping when standard single-transaction RBF is insufficient.

Risks and Considerations

Limited Scope

Package RBF currently supports only 1-parent-1-child packages. More complex transaction graphs with multiple parents or deeply nested children are not evaluated as packages. The cluster mempool project aims to generalize these rules to arbitrary transaction clusters, but until it is fully deployed, package RBF handles only the simplest case.

Network Adoption

Package RBF is a mempool policy, not a consensus rule. Its benefits depend on a sufficient portion of the network running Bitcoin Core 28.0 or later. Nodes that have not upgraded treat version-3 transactions under older standardness rules, so package RBF's pinning protections apply only on upgraded nodes. As adoption increases, the protections become more reliable.

Complexity for Developers

Implementing package RBF correctly requires understanding the interaction between TRUC topology restrictions, pay-to-anchor output construction, feerate diagram evaluation, and sibling eviction rules. Wallet and protocol developers must handle edge cases around package size limits, child transaction weight budgets, and proper fee estimation for packages.

Not a Complete Pinning Solution

While package RBF addresses several pinning vectors, it does not eliminate all of them. Absolute fee pinning (where an attacker forces the honest party to pay disproportionately high fees) remains a concern, though the feerate diagram test mitigates the worst cases. Full resolution of pinning attacks will likely require the broader cluster mempool framework. See the transaction pinning attacks research article for a deeper analysis.

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.