Table of Contents
Note: This post has been written by a WazirX Warrior as a part of the “WazirX Warrior program.”
So you want to better understand Bitcoin’s Replace-by-Fee, right?
Confused with questions like –
How does RBF work?
Does it make Double Spending easier? Is it even safe?
In this article, we will be focusing on what does RBF mean in Bitcoin.
What is RBF (Replace By Fee)?
RBF is a way using which we can un-stuck a stuck Bitcoin Transaction.
So what does stuck bitcoin transaction mean?
Usually, if the sender did not pay enough amount of mining fees, the transactions get stuck.
We know, miners get the mining fees plus the block reward (6.25BTC) for mining a Bitcoin block. Now, when we initiate a transaction, it resides with the mempool until a miner chooses it for mining.
Must be thinking, how the miners decide which transactions to remain in mempool and which one to choose?
The answer is that the block space in the bitcoin blockchain is limited to 2MB, so miners will include transactions with a higher fee associated with them in the Next block.
That’s why we have to wait for hours or even, in some cases, days to get our transactions confirmed. That is what we don’t want. Moreover, we cannot cancel those unconfirmed transactions, and the locked coins cannot be used again for payments within that period.
What are the options we have in this situation?
- Wait for confirmations, which may take few hours or even days
2. Wait for the transactions to get canceled. If no miners choose it, the transaction will be excluded. Then we can reuse the coins.
3. Replace the old transaction by paying higher fees. This is known as RBF or replace by fee.
So, RBF is a way to fix a stuck Bitcoin transaction by paying higher fee when we are in a hurry to get the transaction done.
How does it work?
Let’s understand the whole process, using this example, Akash wants to send 1 BTC to Swarnava and paid 0.0001 BTC as fee. As the fee is low compared to the market standard, miners ignored this transaction, and it remains in the mempool for hours. Now, when Swarnava starts demanding his BTC, Akash decides to replace the previous transaction by using the “Replace–By–Fee” feature with the same output to the same BTC address but this time with a relatively higher mining fee.
As the mining fee makes sense to the miners now, this time, the transaction will be mined. Cool, Right?
But, this RBF feature can generate a double-spending problem if not used properly. So what do you think, how one bitcoin can be spent twice?
What is Double Spending?
In simpler terms, double spending is when we use the same Bitcoin twice. That’s scary, right?
Let’s resolve it.
It’s not possible to spend the same coin twice because there is no extra Bitcoin generated for the transaction. The whole argument about RBF making double-spending possible assumes that the recipient delivers the product before the transaction even gets confirmed.
Yes! Let’s understand this.
When we replace a transaction, we have the option to change the recipient address too. Now, what if someone deliberately uses lower fees in the first place, and after the product got shipped, he broadcasted another transaction with higher fees and changed the recipient address to his own? Remember, this is only possible for unconfirmed transactions. But, in this case, the sender scammed the receiver by using the RBF feature. He will get the products as it is already shipped but paid no money.
Notice that, here, the Bitcoin is not double spent, as the receiver didn’t wait for the transaction to confirm and delivered the product; the sender got a chance to scam him.
Conclusion: So should we use RBF or not?
Nowadays, most versions of RBF allow transactions that have all the outputs the same as the original transaction. RBF has many benefits, for say, you are not in a hurry to send money. So you have initiated a transaction with lower fees. Now, if any need arises you can increase fees by using RBF. It saves money. Isn’t it? There is a possibility that the transaction will be processed within a few hours with lower fees.
Here are a few things a receiver needs to keep in mind. At least wait for 6 confirmations before accepting it as valid. Always note, whether the RBF or “Replacement” feature is ‘ON’ on the transaction or not.
If it is ‘ON’ and the transaction is taking time, you can request the sender to increase the fees also.
Finally, RBF is an opt-in feature and not mandatory by any means. People can use it for specific situations.