Replace-by-fee (RBF), explained

Replace-by-fee (RBF), explained

What is the replace-by-fee (RBF) policy?

The Bitcoin network’s replace-by-fee (RBF) policy enables users to replace pending (unconfirmed) transactions with new ones with higher transaction costs. 

The RBF policy was proposed in BIP 125 and introduced as a feature in the Bitcoin protocol with the release of Bitcoin Core version 0.12.0, which was released in February 2016. This feature provides flexibility to users who wish to speed up their transactions or modify the fee in reaction to network constraints. 

On Nov. 23, 2023, a Bitcoin user made a transaction at 9:59 am UTC, paying an exceptionally high transaction fee of $3.1 million for transferring 139.42 Bitcoin (BTC). This exorbitant fee set a record as the eighth-highest in Bitcoin’s history. To put it in perspective, the user overpaid 119,980 times the typical transaction fee. There are a couple of factors at play here:

High transaction fee selection

The sender may have purposefully selected a high transaction charge in an attempt to get a quicker confirmation or because they misjudged the fee. 

RBF policy

Users may substitute a higher-fee transaction for an unconfirmed transaction under the replace-by-fee policy. This implies that to guarantee speedier confirmation, the sender may have chosen to replace the initial transaction, which may have had a high cost, with a new one with an even higher fee.

Sender’s unawareness

It’s possible that the sender was not paying close attention to the network circumstances or was not wholly aware of the consequences of their actions. They might not have anticipated that the RBF would lead to a significant transaction fee increase.

Which blockchain networks support RBF?

RBF capability comes in handy when Bitcoin users want to speed up transaction confirmation or modify costs in reaction to shifting network conditions.

Replace-by-fee is a transaction policy embedded in the Bitcoin network protocol and is supported by Bitcoin Core, the reference implementation of the protocol. As mentioned, due to the RBF policy, users can swap out an unconfirmed Bitcoin transaction for a new one with a higher transaction fee.

It is crucial to remember that different wallets and services within the Bitcoin ecosystem may embrace RBF differently. For instance, although RBF is supported by Bitcoin Core, not all wallets may adopt or offer this feature. To ensure that their wallet or service is compatible with the replace-by-fee policy, users should confirm the particular characteristics and guidelines of the platform.

Other RBF rules include that the new transaction must maintain the same outputs as the previous one and have a higher sequence number for each input to use RBF. Additionally, RBF only applies to transactions that have not yet been confirmed; once a transaction is approved, it cannot be undone. However, as not all nodes and miners may support or recognize RBF transactions, its efficacy depends on network conditions and miners’ willingness to prioritize transactions with higher fees.

In addition, specific wallets, such as Trezor, allow users to “Bump Fee” on pending, unconfirmed transactions. Moreover, Crypto.com users can utilize advanced transaction settings to send Ether (ETH) or other ERC-20 tokens, allowing customization of the nonce value, gas price or gas limit. This feature, available in-app version 1.8.2 and above, empowers advanced users to tailor transaction parameters. 

Users can navigate to the advanced settings via the send confirmation screen, adjust values, review the projected network fee and proceed with the transaction. The process includes confirming the customized settings and authorizing the transaction with a passcode and a 2FA code if enabled.

How does the replace-by-fee policy work?

Bitcoin users can expedite transaction confirmation by creating a new transaction with a higher fee, signaled by a unique “sequence number,” which, when broadcasted, may be prioritized by miners, replacing the original transaction.

The state of the network, miners’ rules, and the degree of support from the participating nodes and wallets all affect the effectiveness of the RBF policy. Here’s a detailed explanation of how RBF operates:

Initial transaction confirmation

A Bitcoin transaction is initiated by a user and shared with the network. The transaction sits in the mempool and is pending inclusion in a block by a miner.

Adjustment for transaction fees

The user can initiate a new transaction with a higher fee if they want to expedite the confirmation process or find the fee too low.

Replace-by-fee flag

The new transaction includes a unique “sequence number” in the transaction input, signaling that it is intended to replace a previous transaction. This sequence number is higher than that of the original transaction.

In the context of Bitcoin, the nSequence field, originally designed for “sequence number-based replacement” or “time-locking,” serves two primary purposes. Firstly, for a transaction to be eligible for fee replacement, it must express its replaceability at the time of initial sending. This is accomplished by setting the nSequence field — a component within each transaction — to a value below 0xffffffe.  

In hexadecimal notation, 0xffffffe represents a 32-bit unsigned integer with all bits set to 1 except for the least significant bit. In decimal, this value is equivalent to 4294967294. Secondly, the nSequence field enables relative lock times for transaction inputs, allowing transactions to be updated after the broadcast, providing flexibility for adjustments and facilitating RBF.

Broadcasting the replacement transaction for miners’ consideration

The user broadcasts the replacement transaction to the Bitcoin network. Miners who select transactions for block inclusion may see the replacement transaction with the higher fee. They may decide to include the replacement transaction in a block because they are incentivized to include transactions with greater fees.

Transaction confirmation

The original transaction gets replaced if the replacement transaction is included in the block. The replacement transaction will not be validated and is essentially “bumped” out of the mempool.

How to enable and disable RBF?

To enable RBF in a Bitcoin wallet, users should verify support, access settings, enable the RBF option and adjust fees, while disabling RBF involves accessing settings, disabling the RBF option and ensuring it’s not activated by default.

Enabling RBF

Users must ensure their selected wallet supports RBF before turning this feature on. The wallet settings can usually be accessed in the advanced or transaction preferences section. 

The user should search the settings for an RBF option, typically “Replace-by-Fee” or a similar term and enable this option. Users can then broadcast the transaction to the network and change the transaction fee if there is trouble confirming the transaction.

Version 21.2.2 of the Trezor Suite offers on-device support for the Trezor Model T (firmware 2.3.5 and up) and the Trezor Model One (firmware 1.9.4 and up). Users can use RBF to either finalize the transaction or raise the fee.

RBF by output reduction in Trezor

RBF, by output reduction, deducts the additional charge from the transfer amount rather than the account balance when transmitting the maximum amount of Bitcoin from a single account.

RBF with Trezor devices in Electrum

Users can employ RBF with Trezor devices in Electrum, allowing for the replacement of the original transaction. However, this replacement is only feasible if the initial transaction was executed using Electrum with the “Replace by fee” option enabled, accessible through Tools > Preferences > Replace by fee.

Disabling RBF

On the other hand, the user needs to access wallet settings to disable RBF. Disabling RBF should be possible via the advanced options or transaction preferences. This option may be titled “Replace-by-Fee” or something similar. 

To ensure this functionality is not activated by default in any newly made transactions in the wallet, the user must uncheck the enabled option. The documentation or support resources for the wallet under consideration should be referred to obtain up-to-date and precise information on enabling or disabling RBF.

Disadvantages of replace-by-fee policy

The RBF policy in Bitcoin allows fee adjustments post-transaction but raises concerns of double-spending, user confusion and network congestion.

RBF raises concerns about possible double-spending because users can replace an unconfirmed transaction with a new one with higher fees. This risk makes it difficult for merchants or recipients of transactions to decide which transactions are legitimate, which could result in fraud and misunderstanding. 

RBF can complicate the user experience because people unaware of its operation may inadvertently replace transactions or encounter delays. Furthermore, this feature makes it more difficult for businesses to forecast confirmation timeframes precisely by lowering transaction reliability and predictability. 

The efficiency of the network as a whole may also be impacted by users routinely replacing transactions with extensive fees, which can also cause congestion. Moreover, RBF’s vulnerability to misuse, which would enable unscrupulous parties to take advantage of the system for financial benefit, emphasizes the necessity of its careful use and user education.

Related posts