Child pays for parent

From Bitcoin Wiki
(Redirected from CPFP)
Jump to navigation Jump to search

Child pays for parent (CPFP) is a fee-bumping method in which a later transaction spends an output of an unconfirmed parent and pays a high enough feerate that miners prefer to include both. Miners who maximize fees will not mine the child without the parent, because the child is invalid in isolation. The package feerate is the total fees of the ancestor set divided by the total virtual size.

A transaction that underpays relative to current demand may remain in the mempool indefinitely. Replace by fee requires the original sender to re-sign a conflicting transaction. That is impossible if the sender is offline, if the transaction was already finalized by several parties, or if the only remaining output is not controlled by the party that wants confirmation. CPFP lets a receiver, or any party that received an output of the stuck transaction, add fees without changing the parent. Where the parent can still be re-signed, Full RBF and related replace-by-fee policies are often cheaper in transaction count and UTXO churn. CPFP is the available method when those signatures cannot be reproduced.

The child spends at least one output of the unconfirmed parent, usually a change output or a dedicated anchor output (including ephemeral anchors in newer Lightning-style constructions), and includes a high fee. Nodes compute ancestor feerate: for each transaction, the minimum of its own feerate and the feerate of the set containing it and all unconfirmed ancestors. Mining code selects high ancestor-feerate sets first, so a well-paying child can pull a low-fee parent into a block.

Policy limits exist so that CPFP cannot be used to relay arbitrarily large graphs. Historically Bitcoin Core limited a transaction to 25 ancestors and 25 descendants, with a virtual-size cap around 101,000 vB. A malicious counterparty could fill the descendant limit (package-limit pinning), blocking further children. CPFP carve-out allowed one extra small descendant for transactions that look like Lightning commitments, which is why BOLT 3 used two keyed anchors. Cluster mempool replaces ancestor and descendant limits with a cluster size limit and removes carve-out. TRUC transactions instead allow a single child of limited size.

Package relay is required when the parent itself is below the node's minimum relay feerate. Without it, peers will not accept the parent, so they never see the child. Bitcoin Core 28.0 began pairing a low-feerate parent with a child opportunistically over the existing transaction relay protocol (1-parent-1-child). Version 31.0 allows that parent to pay zero fee even when it is not a TRUC transaction, provided the child pays for the package. Wallets that only estimate a single-transaction feerate via Fee estimation still need CPFP or RBF when that estimate turns out too low after broadcast.

Bitcoin Core's mining and mempool logic have used ancestor scoring for many releases. Wallet RPCs can create a CPFP bump from a local unconfirmed output. Lightning nodes bump commitments by spending anchor outputs. Some exchanges and block explorers offer a CPFP service that spends a customer's change. Cluster mempool (Bitcoin Core 31.0) orders by chunk feerate after linearizing each cluster, which is a more accurate form of the same idea.

See also

External links