TeachMeBitcoin

Replace-By-Fee (RBF)

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

Replace-By-Fee (RBF) Mechanics

Replace-By-Fee (RBF) is a protocol feature that allows a user to "bump" the fee of a transaction that is stuck in the mempool due to low fees. This is enabled via the Sequence field.

1. Signaling RBF (BIP 125)

To signal that a transaction is replaceable, at least one input in the transaction must have a sequence number less than 0xffffffff - 1 (specifically 0xfffffffd or lower).

2. The Replacement Rules

For a new transaction to replace an existing one in the mempool, it must satisfy several criteria:

  1. Higher Fee: The new transaction must pay a higher absolute fee than the one it replaces.

  2. Higher Feerate: The new transaction must also have a higher fee per byte (sat/vB).

  3. Conflict: The new transaction must spend at least one of the same inputs as the original.

  4. No New Unconfirmed Parents: To prevent spam, the replacement cannot introduce too many new unconfirmed dependencies.

3. Why Use RBF?

4. Security Considerations

Merchants who accept "0-confirmation" payments (unconfirmed transactions) must check if the transaction signals RBF.

Signaling Sequence Value Status
Max / Final 0xffffffff RBF Disabled
Opt-in RBF 0xfffffffd RBF Enabled
BIP 68 lock 0x00000001 RBF Enabled + Timelock

In the next section, we will look at Relative Timelocks (BIP 68).

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!