In this article, we will be focusing on Bitcoin’s Replace By Fee ( also known as RBF). This feature was proposed in BIP125 and implemented in Bitcoin Core 0.12.0. It has seen a lot of controversies and is open to debate. So, let’s dive in.
Also Read: A Candid Explanation of Bitcoin
What is Replace By Fee?
In simple words, by enabling RBF in a transaction, if a transaction doesn’t get mined, it can be resent by the sender with a higher mining fee with keeping the input data of the UTXO(Unspent Transaction Output) same as before.
Let’s understand RBF using an example.
Consider two people named Alice and Bob. Alice is in urgent need of Bitcoins, so he asks Bob to send 1 BTC.
Bob is willing to pay 0.000001 BTC as the mining fees. So, he signs the transaction and waits for it to get mined by the miners. Hours passed by, but the transaction didn’t get confirmed.
Also Read: What is Bitcoin mining?
After 72 hours, Bob came to know that miners didn’t pick his transaction. There are two possible reasons for miner not picking a transaction.
Note: When you create a Bitcoin transaction, it goes into Mempool. Transactions reside in Mempool before miners pick them.
Low Transaction Fee
In the Bitcoin network, there are certain limitations. The block size cannot exceed 2 MB. Each miner gets 12.5 BTC for successfully mining a block along with the mining fees. So, Miners usually pick transactions that have a high mining fee to maximize their profit and to compensate for the resources used during mining. If a transaction does not have enough mining fees, it will be rejected by the miners.
Mempool has a lot of transaction
Let’s say a lot of people started buying bitcoin, and the mempool gets loaded with a tremendous amount of transaction data. To make the transaction faster, many would bet high transaction fees.
So, in those cases, transactions with moderate transaction fees will not be picked by bitcoin miners.
Now, let’s say Bob has enabled the Replace By Fee feature(Which is provided by most of the bitcoin wallets) while signing the transaction. Initially, he sends 0.000001 BTC as mining fees. His transaction didn’t get mined. Since he had enabled RBF, he now has the option to use the same inputs of the UTXO to make another transaction with a higher mining fee.
As this is an emergency, So Bob decides to hike the transaction fee to 0.001 BTC. This time the transaction was mined because the miners found the mining fees lucrative.
What are the different types of RBF?
- Full RBF: This allows a transaction to be replaced with a new transaction as long as the mining fee associated with it is sufficient.
- Opt-in RBF: RBF can be optional in some cases. It usually depends on the wallet you are using. You have the option to either enable RBF or not.
- First-seen-safe RBF: In this case, one is allowed to initiate another transaction with a higher fee only if the transaction data in the new one is identical to the older one.
Double spending with RBF
Suppose a malicious user has ordered an item from an online shop, and he paid using bitcoin (RBF enabled) with a low transaction fee. He informs the shop keeper that the transaction will be approved soon.
So, the shopkeeper sents the item hoping that the transaction will be mined. Considering the malicious user used Full RBF or Opt-in-RBF, he can use the same input of the UTXO to send the same amount to his own account. This leads to double-spending.
The above video highlights the problem with RBF. That’s why RBF has been criticized hugely. So, it is highly advised to wait for at least six confirmations to consider a transaction is valid and be cautious about transactions marked with RBF.
Let us know your opinion about the Replace by Fee feature in Bitcoin and should every wallet enable it?
If you want to learn more about the Crypto ecosystem, sign up for the weekly newsletter.