What is Replace by Fee (RBF)?

Replace by Fee (RBF)

Suppose you have sent 12 Bitcoins to your friend in another country with a transaction fee of 0.00001 BTC. But, hours and days passed but your friend didn’t receive BTC. 

Quite a scary thing right? 

Now, you start researching about what happened, why the transaction didn’t take place, etc etc. In such a case, there are two possibilities. 

  1. Low Transaction Fee

Bitcoin network has a few limitations, the block size should not exceed 2 MB. Each miner earns 6.25 BTC and the transaction fees associated with it for mining a block. In such cases, miners will choose those transactions that have high mining fees. Hence, if the transaction does not have enough mining fees, it is rejected by the miners.

  1. Mempool is loaded with transactions

When a lot of people are willing to buy/sell or transfer Bitcoin (due to panic or high discount), the mempool is loaded with huge transaction data. A mempool is the node’s holding area of all the unconfirmed transactions. When you first initiate a transaction, it resides in the mempool until a miner chooses it for mining. 

When the mempool is loaded with transactions, many of them will start betting on high transaction fees. Ultimately, miners will then choose those transactions with higher transaction fees.

What will you do in such cases? 

Obviously, you have to increase your transaction fees. This process is called Replace by Fee. 

Let’s understand more about what is replace by fee. 

What is Replace By Fee (RBF)?

Replace-by-fee is a technique that allows replacing one version of an unconfirmed transaction with another version of a transaction that pays higher transaction fees. RBF was first introduced in BIP125 and its implementation was released in Bitcoin Core 0.12.0. 

Various node software uses different RBF rules causing several variations. BIP125 opt-in RBF as implemented in Bitcoin Core 0.12.0 is the most commonly used RBF today. This version of RBF allows the transaction creator to indicate that they’re willing to allow their transaction to be replaced with a higher-paying version. 

How long can the transaction remain unconfirmed? 

An unconfirmed transaction can stay as it is forever. It means as long as there are people who are paying higher transaction fees, your unconfirmed transaction can stay as it is and will never be included in a block.  

If the waiting time exceeds a very long time, the transaction will end up in a block. In such a case, the block space on the main Bitcoin blockchain becomes scarce. Hence, it becomes impossible to include a transaction with a fee of 1 satoshi/byte. It is possible only when the block subsidy runs out. 

Types of RBF

While you have a brief idea about what is replace-by-fee, it’s time to understand the types of RBF. 

Full RBF: Full RBF allows you to replace a transaction only if the mining fee associated with it is sufficient. 

Opt-in RBF: Opt-in RBF allows you to flag the transactions as replaceable until they are confirmed in a block. But, there is a problem with this RBF, that is the sender should know well in advance that they may wish to replace the transaction before they broadcast it. Many wallets have chosen Opt-in RBF as their default RBF. 

First-seen safe RBF: In first-seen safe RBF, you can replace a transaction with another having higher fees only if the transaction data in the new one is similar to the older one. 

Delayed RBF: The delayed RBF allows you to replace the original transaction after it has not been included in a block for a certain number of blocks. This RBF allows you to give some time to the miners to include their transaction in a block at a lower fee. Hence, it potentially saves your money. 

How does it work? 

A simple concept behind the working of RBF is that you have to pay a small fee to change the fee for the unconfirmed transaction. Suppose you pay 1 satoshi/byte as your fee, which is the lowest fee for a transaction. 

Turn on Replace by Fee

Now, you pass on your transaction to the Bitcoin blockchain and wait for it to be successful. But even after hours and days, the transaction doesn’t be successful and you do not have a single confirmation of the transaction. 

Make the transaction replaceable


You are running short of time, so you broadcast another transaction. This new transaction is similar to the previous one, but it includes higher fees. When miners select this transaction, they will receive higher fees. Now, your transaction is more competitive in the market for block space. Wallets like Electrum and Blockstream Green allows an easy way to use RBF. 

Double Spending

Double spending is a risk when you spend the same Bitcoin twice. It occurs when you send Bitcoins to many people using the same unspent transaction outputs. When you can replace a transaction, then you can change the recipient too. Double spending is quite difficult with replace-by-fee. It is because of the following reasons: 

  • The whole concept of RBF is to include a transaction in a block and confirm it. If the recipient is changed, then the original receiver will know about the alteration. After confirming the transaction, they can see that they are no longer the recipient of that transaction. 
  • There are a few arguments that double-spending is possible with RBF. It is because there is an assumption that the recipients will send you the products without any confirmation. If the assumption was true, you need not replace by fee at the initial stage itself. 
  • Most of the versions of RBF require that the transaction should pay the same outputs as the original transaction. 
  • Hence, you don’t need RBF to double spend. You can simply create multiple transactions using the same inputs. Then you can assign the transaction that sends the bitcoins to yourself with the highest fee. 

Risks involved in Replace by Fee

While RBF has its own specialties, it is also associated with some risk. Suppose you want to purchase some goods from your friend, so you send 1 BTC with 0.0001 BTC as transaction fees. 

After some time you change your mind and you want your money back. As the transaction is still unconfirmed, you decide to replace the original transaction with a new transaction having higher fees and that returns your funds back to your wallet. 

Meanwhile, your friend has already shipped the items to your address. In this case, you will get your items but your fried will not receive funds to complete the transaction. 

Hence, if you have any transaction which is stuck, you can make it process faster by replacing it with a transaction that has a higher fee.