THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Bitcoin RBF Fee Bumping: Replacement Fees, Wallet Safety, and Failure Modes

permalink THAMER
#bitcoin#fee-bumping#feerate#rbf#wallet-safety

An unconfirmed Bitcoin transaction may wait because its feerate is too low for current block-space demand. A wallet can sometimes improve its confirmation prospects by constructing a replacement that spends overlapping inputs and pays a higher fee. This technique is called RBF fee bumping. Its success depends on the receiving node's mempool policy and on network conditions.

The replacement must pay for its own relay

A replacement generally needs to improve the fee economics for nodes that would evict the original transaction. It is not enough to raise the fee rate by a tiny amount if the absolute fee fails a replacement rule or incremental-relay requirement. Additional policy conditions may apply, including limits on evicted descendants and unconfirmed-input relationships.

Fee is calculated as total input value minus total output value. Fee rate is fee divided by virtual transaction size. A wallet must estimate the replacement's new virtual size rather than assuming its original size is unchanged.

Preserve payment intent

A common fee bump reduces the sender's change output to fund a higher miner fee while preserving the recipient's output. If the change is insufficient, the wallet may need different inputs, but adding inputs changes transaction size and can interact with replacement policy. Never silently reduce the recipient amount to fund the fee unless the user explicitly authorized a different payment.

Before signing, compare original and proposed recipient scripts, amounts, change destinations, inputs, fee, and feerate. Confirm that every newly selected input belongs to the intended wallet and that the new change output does not become uneconomic dust.

Replacement versus CPFP

Child-pays-for-parent (CPFP) works differently: a spend of an unconfirmed output offers a fee that incentivizes miners to include its parent. CPFP does not inherently replace the parent's transaction. A sender with a change output or a recipient with a spendable incoming output may be able to use CPFP, subject to mempool package and ancestor/descendant policy.

A wallet may offer both mechanisms, but the availability of either depends on the transaction graph, spend authority, and relay policy. Avoid promising confirmation by a specific block merely because a replacement was accepted.

Failure modes to test

Test insufficient absolute fee, insufficient incremental fee, conflict with many descendants, additional unconfirmed inputs, change turning into dust, and repeated bumps that deplete change. Also test node disagreement: a replacement may be accepted locally while another peer continues relaying the original.

Track the replacement chain of TXIDs while maintaining one logical payment record. If a transaction confirms, stop treating superseded unconfirmed candidates as independent payments. Reorganizations still require normal chain-state reconciliation.

Primary references

BIP125 — Opt-in Full Replace-by-Fee Signaling: https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki

Bitcoin Core RPC reference — bumpfee and testmempoolaccept: https://bitcoincore.org/en/doc/

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects