Fee Bumping
When a transaction is stuck in the mempool because the fee rate is too low, you can increase the effective fee using Replace-by-Fee (RBF) or Child Pays for Parent (CPFP). This page is a developer-focused guide: when to use which, how to signal RBF, and how to build replacement or child transactions in code. For the protocol rules and fee market, see Transaction Fees and Mempool.
| Situation | Use |
|---|---|
| You are the sender and control the inputs | RBF: Create a replacement transaction that pays a higher fee (must meet BIP 125 rules). |
| You are the recipient and the sender did not enable RBF (or you cannot replace) | CPFP: Spend an output of the stuck transaction with a high-fee child so miners include both. |
| Lightning or other L2 | Implementations use both RBF and CPFP (and package RBF where available) to bump commitment or HTLC transactions. |
To allow RBF, the original transaction must signal replaceability: at least one input has nSequence < 0xfffffffe (e.g. 0xfffffffd). Then you can broadcast a replacement that spends the same inputs, pays strictly higher fee (and higher fee rate), and obeys BIP 125 (no new unconfirmed inputs, no new outputs, no reduced output amounts). Full RBF (replace any unconfirmed tx) is a policy option on some nodes; see Transaction Fees.
Enabling RBF on an Input
Creating a Replacement (RBF) Transaction
Build a new transaction with the same inputs and same outputs (or reduced change to pay higher fee). Sign again and broadcast. The replacement must pay a higher total fee and higher fee rate than the original.
If you received an output from the stuck transaction, you can create a child transaction that spends that output and attaches a high fee. Miners evaluate the package (parent + child) by combined fee and size; a high-fee child makes the package profitable so they include both.
Creating a CPFP Child Transaction
Package relay and package RBF allow nodes to accept and relay a package (e.g. parent + child) as a unit and, for package RBF, to replace a package with a new one. These are optional node policies (e.g. Bitcoin Core); they help Lightning and other L2 protocols fee-bump reliably. See Transaction Fees for links to BIPs.
- Transaction Fees - RBF/CPFP rules and fee market
- Transaction Construction - Building and signing transactions
- Mempool - How unconfirmed transactions are stored and selected
- Fee Estimation - Getting a target fee rate