So you want to better understand Replace by Fee, huh?
Wondering how RBF works?
Does it make double spending easier?
Is it even safe to use replace by fee?
In this article, we demystify RBF and its alternatives so you can use it to get more out of your magical internet money.
By the end, you’ll be a transaction replacing master.
RBF is a way for someone who is experiencing a stuck Bitcoin transaction to get it ‘un-stuck’.
How does a transaction get stuck?
Usually a transaction gets stuck because the sender did not pay a high enough fee. Block space on the Bitcoin blockchain is limited.
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
RBF is a way for a sender to fix a stuck transaction if they are in a hurry to get their transaction through.
There are many different variants of RBF, And 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.
Let’s say you set your fee to 1 satoshi/byte. This is currently the lowest fee you can set for a transaction.
You broadcast your transaction to Bitcoin blockchain. And you wait, and wait, and wait…and nothing happens.
The recipient still has not had a single confirmation on this transaction. You are stuck at 0 conf.
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 have wondered if RBF makes double spending easier.
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.
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.
If you don’t have interest in doing replace by fee or are wanting other options, you have a few to choose from.
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.
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.
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.
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.
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.
This version of RBF has few restrictions. Simply pay the fee of both the original and new transaction and it goes through.
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.
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.
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.
Before RBF existed, it was possible to change a broadcasted transaction. The only thing that changed after RBF was that there was an added cost beyond the higher fee.
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.
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.
No, fees are not a tax on Bitcoin users. They are simply what people pay to use the Bitcoin network.
You must pay both fees so that there is an added cost to replacing a transaction. This prevents DoS attacks on the Bitcoin network.
Altcoins have cheaper fees but much less security than Bitcoin.