Replace-By-Fee (RBF)

2 min read

What Is Replace-By-Fee (RBF)?

RBF stands for Replace-By-Fee. This is a feature in the Bitcoin network that allows a sender to replace their unconfirmed transaction with a different version of that transaction that has a higher transaction fee. RBF allows senders to raise the fee to confirm their transaction faster. This feature is useful in situations when the original transaction is taking too long to get confirmed in a congested network, usually due to its low fee. The increased fee makes it more attractive to miners to prioritize the transaction since they are incentivized by the fees they collect for confirming transactions.

RBF works by allowing the sender to broadcast a new version of their transaction to the network. This new version must have the same inputs as the original transaction. Once the higher fee transaction is confirmed, the original transaction is replaced and dropped from the network if it hasn’t been confirmed yet.

RBF only works while the transaction is in the mempool. As soon as a transaction enters a block, it cannot be replaced by fee. Additionally, when a transaction is first sent, it must specify that it is available to be replaced by fee. This is achieved by setting the nSequence, a small part of each transaction, to any value below 0xfffffffe. The nSequence of a transaction is intended to allow a transaction to be updated after it has been broadcast.