RBF (Replace By Fee) in Bitcoin Transactions

Key Takeaways

  • RBF allows you to change the fee paid on a bitcoin transaction.
  • RBF is helpful in a case where you don't pay a high enough fee.
  • By increasing the fee with RBF, you can get the transactions 'unstuck'

What is RBF (Replace By Fee)

what is rbf

RBF is a way for someone who is experiencing a stuck Bitcoin transaction to get it ‘un-stuck’.

How does a transaction get stuck?

The transaction isn’t actually stuck, it’s more like other higher fee paying transactions are jumping in front of it.

A transaction can feel stuck because the sender did not pay a high enough fee. Block space on the Bitcoin blockchain is limited so higher fee transactions get priority.

Miners need a way to decide which transactions get into the next block and which ones remain in the mempool. To decide this, a market exists.

Generally, those who pay the highest fees make it into the next block.

If a sender sets his fees too low, his block may take a very long time to make it into a block and confirm.

Sustained high fees have happened before:

2017 highest bitcoin fees chart
There were weeks in 2017 where any transactions that paid less than $20 or more did not make it into a block

RBF is a way for a sender to fix a stuck transaction if they are in a hurry to get their transaction through.

How Does RBF Work?

There are many different variants of RBF. We will discuss those in more detail later.

But, generally speaking, RBF works by paying a fee to change the fee for the stuck transaction.

That may sound confusing, but it’s actually pretty simple:

  1. Let’s say you set your fee to 1 satoshi/byte. This is currently the lowest fee you can set for a transaction.
  2. You broadcast your transaction to Bitcoin blockchain. And you wait, and wait, and wait…and nothing happens.
  3. The recipient still has not had a single confirmation on this transaction. You are stuck at 0 confirmations.

You need this transaction to go through fast, so you broadcast a new transaction.

This new transaction is identical to the old one, except it pays a higher fee. When miners include this transaction, they will get the higher fees from your replacement transaction and the fees from the original, low-fee transaction.

Because of this, your transaction is more competitive in the market for block space.

Many wallets offer an easy way to use RBF, such as Electrum and Blockstream Green.


blockstream green replace by fee feature
Blockstream Green's replace by fee option called "Increase Fee"

RBF Alternatives

If you don’t have interest in doing replace by fee or are wanting other options, you have a few to choose from.

Accelerator Services

Many mining pools offer transaction acceleration. Using this arrangement, you pay mining pools an extra fee directly to include your low fee transaction in the next block they mine.

viabtc accelerator service
ViaBTC is one of the most famous mining pools offering accelerator services - not recommended

Using accelerators is not recommended since you must rely on a third party instead of the base bitcoin protocol and with no added benefit.

We recommend using either RBF or CPFP, explained next.

ViaBTC is based on China. Right now, there is no European, UK, Canadian or US based accelerator but this will likely change soon.

Child Pays for Parent (CPFP)

In a child pays for parent arrangement, the receiver of a stuck transaction pays the higher fee. To do this, he broadcasts a new transaction (the child) spending from one of the unconfirmed outputs of first transaction (the parent). This ‘child’ transaction promises a very high fee, incentivizing miners to include the low-fee parent ASAP.

Difference Between RBF and CPFP

RBF means the sender pays more to get the transaction confirmed faster. Use RBF if you are the sender needing a transaction to go through faster.

CPFP means the recipient pays more to get the transaction confirmed faster. Use CPFP if you are the receiver needing a transaction to go through faster.

Variants of RBF

Since node’s control which RBF they support, it’s up to each node to decide which RBFs they see as valid and not valid. It is therefore possible that some nodes will reject your RBF while others will not.

green circle icon

Full RBF

This version of RBF has few restrictions. Simply pay the fee of both the original and new transaction and it goes through.

blue flag icon

Opt-in RBF

This RBF requires that a sender flag a transaction as allowing replacement before being sent. The problem with this RBF is that a sender must know ahead of time that they may want to replace the transaction before they broadcast it. For this reason, many wallets elect to use Opt-in RBF as default.

human eye icon

First-Seen-Safe RBF

This is the RBF mentioned previously regarding double spends. Using this RBF, the sender may only replace the transaction if the new transaction pays all the same outputs as the first one.

This RBF was created specifically to counter erroneous claims that RBF made double spend attacks easier.

in a hurry icon

Delayed RBF

This RBF requires that the original transaction may only be replaced after it has not been included in a block for a certain number of blocks.

This RBF allows a sender to give miners time to include their transaction in a block at a lower fee, thereby potentially saving the sender money.

FAQ

How does RBF prevent DoS attacks?

down arrow

Why would paying more fees be a good thing?

To answer this question, it helps to understand a little bit about how networks work.

All networks (but especially decentralized ones like Bitcoin's) have a limited bandwidth. Every time you broadcast a transaction, nodes on the network need to receive that broadcast. Node's can only receive so much data at a time.

Before RBF, an attacker could create as many replacement transactions as he wanted at no additional cost. The only cost he paid was for the transaction that was eventually mined. Anyone could then 'spam' the network with millions of replacement transactions in what is called a DoS (Denial of Service) attack.

By adding additional costs to replacing a transaction, DoS attacks at scale are VERY expensive and thus unlikely.

How long can a Bitcoin transaction stay unconfirmed?

down arrow

Theoretically, Bitcoin transactions can stay unconfirmed for forever. As long as there are enough people offering to pay higher fees than you are, your transaction will never be included in a block.

In practice though, if you wait long enough, any transaction will likely end up in a block - at least for now. In the future, block space on the main Bitcoin blockchain may become very scarce. If so, it may be impossible to get your transaction included with fees set at 1sat/byte. This is especially true once the block subsidy runs out.

Why do I have to pay both transaction fees when I use RBF?

down arrow

You must pay both fees so that there is an added cost to replacing a transaction. This prevents DoS attacks on the Bitcoin network.

Who uses RBF?

down arrow

Many exchanges use RBF. One example is Coinbase, who often need to speed up large transactions for their users.

How Does RBF Prevent Double Spending?

Many have wondered if RBF makes double spending easier.


QUICK REVIEW

Double spending is when someone spends the same Bitcoins twice. They achieve this by sending Bitcoins to many people from the same UTXO's (unspent transaction outputs).


After all, if you can replace a transaction, then you could change the recipient too.

There are a few reasons double spending is not made easier by replace by fee.

First, the whole point of RBF is to get a transaction included in a block and confirmed. If you change the recipient on the transaction, then the original receiver will know about it. Once the transaction is confirmed, they can see they are no longer the recipient on that transaction.

The argument that RBF makes double spending possible assumes that the recipient will send you your products without any confirmation. But if that were the case, you wouldn’t need replace by fee in the first place. And merchants can just require at least one confirmation before releasing product.

how a double spend works
A double spend visualized

Additionally, most versions of RBF require that the transaction must pay all the same outputs as the original transaction. More on that below.

Finally, you don’t need RBF to double spend anyway. You can just create multiple transactions using the same inputs. From there, you assign the transaction that sends the bitcoins to yourself with the highest fee.

Many wallets also make double spends simple out of the box. For instance, electrum’spaytomany” option. And Bitcoin Core offers “abandontransaction”.

bitcoin cores fee bump feature
Bitcoin Core's Fee Bump and abandontransaction options
Article Sources

BuyBitcoinWorldWide writers are subject-matter experts and base their articles on firsthand information, like interviews with experts, white papers or original studies and experience. We also use trusted research and studies from other well-known sources. You can learn more about our editorial guidelines.

  1. Resending a TX with RBF - Github, https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/05_2_Resending_a_Transaction_with_RBF.md
  2. Bitcoin Optech - Replace-by-fee (RBF), https://bitcoinops.org/en/topics/replace-by-fee/

About the Author


colin aulds

Colin Aulds is a founder at 10NetZero, an off-grid Bitcoin mining company. He is the former VP and founder at Billfodl, a Bitcoin wallet backup company, as well as PrivacyPros, a blog dedicated to helping every day people improve their privacy. He also runs the popular Unhashed Podcast. Colin holds a bachelors degree from Belmont University (BBA).


bitbo
Get Bitcoin charts, data and stats with Bitbo.
bitbo.io