Bitcoin Forum
April 27, 2024, 05:42:49 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How Replace-By-Fee (RBF) an Child-Pays-For-Parent (CPFP) can speed up confirmati  (Read 420 times)
odolvlobo (OP)
Legendary
*
Offline Offline

Activity: 4298
Merit: 3209



View Profile
January 13, 2021, 08:58:30 PM
Last edit: January 27, 2021, 06:59:35 PM by odolvlobo
Merited by bitmover (3), DdmrDdmr (2), Quickseller (1), ABCbits (1), khaled0111 (1), Upgrade00 (1), Steamtyme (1), SquirrelJulietGarden (1), Serious475 (1)
 #1

This is a technical explanation of how RBF and CPFP work. Sorry, it is not a tutorial because their usage depend on your wallet. Also, note that even if your wallet doesn't support RBF or CPFP, understanding how they work gives you other options.

Replace-By-Fee (RBF)

RBF is straightforward. A stuck transaction is replaced by reusing the same coins in a similar transaction that pays a higher fee. A miner can only confirm one of the two transactions, so they will confirm the one that pays the higher fee. If the fee is high enough, they will confirm it immediately. The lower-fee transaction becomes invalid, so it is just discarded. Generally, your wallet must support RBF, because it normally won't allow you to reuse the same coins in another transaction.

Child-Pays-For-Parent (CPFP)

First, CPFP is based on an important requirement for confirmation. A transaction is funded by previous transactions, so in order for a transaction to be confirmed, the previous transactions that fund it must be confirmed. For example, suppose address Y is funded by this transaction:

     XY

Then, in order to confirm a transaction sending from Y,

     YZ

the transaction XY must be confirmed first. (Side note: both transactions can be confirmed in the same block).

Now, let's say that you spend the bitcoins at address A, sending them to an address B plus a change address C:

     AB + C

You post your transaction, AB + C, with a low fee.

To speed up the transaction's confirmation, the owner of B can use B in a new transaction paying a very high fee, or if the transaction has change, C, you can do the same with C.

     BD, or
     CE

If the transaction fees for BD or CE are high enough, a miner will want to confirm them immediately. But, the miner must also confirm AB +C in order to confirm either one of them, so the miner will confirm it also.

In essence, the follow-up transaction is also paying for the previous transaction. Note: Some wallets do not allow you to spend unconfirmed outputs, i.e. you can't spend B or C until the stuck transaction is confirmed.


From: https://www.reddit.com/r/BitcoinBeginners/comments/kwo7b9/explaining_of_cpfp/

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
1714239769
Hero Member
*
Offline Offline

Posts: 1714239769

View Profile Personal Message (Offline)

Ignore
1714239769
Reply with quote  #2

1714239769
Report to moderator
1714239769
Hero Member
*
Offline Offline

Posts: 1714239769

View Profile Personal Message (Offline)

Ignore
1714239769
Reply with quote  #2

1714239769
Report to moderator
1714239769
Hero Member
*
Offline Offline

Posts: 1714239769

View Profile Personal Message (Offline)

Ignore
1714239769
Reply with quote  #2

1714239769
Report to moderator
According to NIST and ECRYPT II, the cryptographic algorithms used in Bitcoin are expected to be strong until at least 2030. (After that, it will not be too difficult to transition to different algorithms.)
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714239769
Hero Member
*
Offline Offline

Posts: 1714239769

View Profile Personal Message (Offline)

Ignore
1714239769
Reply with quote  #2

1714239769
Report to moderator
SquirrelJulietGarden
Hero Member
*****
Offline Offline

Activity: 1302
Merit: 726



View Profile
January 14, 2021, 01:28:08 AM
 #2

[TUTORIAL]getting a low-fee transaction unstuck by creating a CPFP with electrum

My transaction has been unconfirmed for a long time. What can I do? (electrum.readthedocs.io)

Quote
Create a “Child Pays for Parent” transaction. A CPFP is a new transaction that pays a high fee in order to compensate for the small fee of its parent transaction. It can be done by the recipient of the funds, or by the sender, if the transaction has a change output. To create a CPFP transaction right click on the unconfirmed transaction on the history tab and choose “Child pays for parent”. Set an appropriate fee and click on “OK”. A window will popup with the unsigned transaction. Click on “Sign” and then “Broadcast”.

███▄▀██▄▄
░░▄████▄▀████ ▄▄▄
░░████▄▄▄▄░░█▀▀
███ ██████▄▄▀█▌
░▄░░███▀████
░▐█░░███░██▄▄
░░▄▀░████▄▄▄▀█
░█░▄███▀████ ▐█
▀▄▄███▀▄██▄
░░▄██▌░░██▀
░▐█▀████ ▀██
░░█▌██████ ▀▀██▄
░░▀███
▄▄██▀▄███
▄▄▄████▀▄████▄░░
▀▀█░░▄▄▄▄████░░
▐█▀▄▄█████████
████▀███░░▄░
▄▄██░███░░█▌░
█▀▄▄▄████░▀▄░░
█▌████▀███▄░█░
▄██▄▀███▄▄▀
▀██░░▐██▄░░
██▀████▀█▌░
▄██▀▀██████▐█░░
███▀░░
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
January 14, 2021, 08:59:34 AM
Merited by DdmrDdmr (2), bitmover (2)
 #3

A couple of additions/things I would clarify.

RBF is straightforward. You replace a stuck transaction by reusing the same coins in a similar transaction that pays a higher fee.
You only need to reuse a single one of the inputs in the previous transaction, not all of them. Some or even the majority of the coins can be left untouched by the replacement transaction. As long as one of the inputs is used, the entire first transaction becomes invalid.

If the transaction fees for BD or CE are high enough, a miner will want to confirm them immediately. But in order to confirm them, the miner must also confirm AB +C.
The way to work out the appropriate fee to pay for a CPFP transaction is to add the size of both transactions (the unconfirmed one you are trying to speed up plus the new one you are about to make) in vbytes, multiply by the current "going rate" for a fast confirmation, subtract the absolute fee already paid by the first transaction, and use that number as the absolute fee for your new transaction. This will usually mean your second transaction pays a much higher fee rate than seems necessary, but will put the average fee rate of your two transactions together around the appropriate rate.

For example:

Let's say the current fee rate for a fast confirmation is 50 sats/vbyte.

Let's say AB + C is 300 vbytes in size and pays 5 sats/vbyte in fees, working out to 1,500 sats.
You are going to make transaction BD, which will be 200 vbytes in size.

Both transactions together will be 300 + 200 = 500 vbytes. At a fee rate of 50 sats/vbytes, this means a total fee of 25,000 sats. Your first transaction already pays 1,500 sats, so your second transaction will require a fee of 23,500 sats. This will work out as 23,500/200 = 117.5 sats/vbyte.

If you are trying to confirm a chain of unconfirmed transactions, then you need to take in to account the size of all of them.
Charles-Tim
Legendary
*
Offline Offline

Activity: 1526
Merit: 4816



View Profile
January 14, 2021, 11:35:08 AM
 #4

To speed up the transaction's confirmation, the owner of B can use B in a new transaction paying a very high fee, or if your transaction has change, C, you can do the same with C.
It depends, there are some cases the B will find it impossible to use CPFP, if the wallet of B can not be able to spend unconfirmed transaction, this will not be possible, I will like if you can include this to the OP board to make it more clear. In order for b to be able to use CPFP, the wallet should be able to spend unconfirmed transaction, just like on electrum wallet. But, in all cases, A will be able to use CPFP in any circumstances so far their is enough funds from the previous UTXO in his balance to perform another transaction into his another wallet address or to another address with high fee.

.
HUGE
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
khaled0111
Legendary
*
Offline Offline

Activity: 2506
Merit: 2834


Top Crypto Casino


View Profile WWW
January 15, 2021, 08:55:05 PM
 #5

What if A's wallet doesn't allow spending unconfirmed outputs?  Smiley
@op, imo, you should remove the (X,Y,Z)->A part as it only complicates things for newbies.
I always flag my transactions as RBF whenever possible since replacing by fee is cheaper than paying for parents. The only inconvenience with rbf is that it cancels the original transaction and creates a new one with a totally different txid.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Charles-Tim
Legendary
*
Offline Offline

Activity: 1526
Merit: 4816



View Profile
January 16, 2021, 04:18:11 PM
 #6

What if A's wallet doesn't allow spending unconfirmed outputs?  Smiley
Noncustodial wallet nature will allow A wallet to spend UTXO. I mean if wallet A is noncustodial, it will be able to spend UTXO. Although I am not sure, correct me if wrong.

I always flag my transactions as RBF whenever possible since replacing by fee is cheaper than paying for parents. The only inconvenience with rbf is that it cancels the original transaction and creates a new one with a totall
o_e_l_e_o also well explained this above how CPFP can have higher transaction if compared to RBF, but not all wallets support RBF, in this case you can use CPFP. Or, this is another instance, assuming I want to send bitcoin to someone, and I told him I do not have enough funds for the fee but still insist me to send it with lower fee, the person can later see it frustrating if the transaction not confirmed and later pump the fee himself. Also, people can choose transaction not to support RBF even on electrum, this can be a mistake from a newbie, in this case also, CPFP can be the alternative to get the transaction confirmed fast.

But, I too will suggest wallet like electrum that support RBF, just like you meant. Just very easy to use RBF to pump fee on electrum wallet.

.
HUGE
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
January 16, 2021, 04:51:45 PM
Merited by Charles-Tim (1)
 #7

I mean if wallet A is noncustodial, it will be able to spend UTXO. Although I am not sure, correct me if wrong.
If the person in question is using a non-custodial wallet, in which they have access to their private keys, then they will be able to spend an unconfirmed input one way or another. If their particular wallet software does not support doing this, then they can always import their seed phrase or private keys in to a wallet which does support it, such as Electrum, and do it from there.

I obviously can't say that every non-custodial wallet will allow the user to spend unconfirmed inputs since I have not tested every non-custodial wallet.

Also, people can choose transaction not to support RBF even on electrum, this can be a mistake from a newbie
There are a number of reasons you may want to disable RBF. There are quite a few merchants which will accept zero confirmation transaction as long as RBF is disabled, but will not if RBF is enabled (for obvious reasons). Further, most payment processors which generate an address for you to pay for an order will automatically detect the first transaction to that address and monitor it for confirmations. If you use RBF, your first transaction will be cancelled, your order will be cancelled, and your replacement transaction will go unnoticed by the processor, and you will need to email their support to sort it out.
RapTarX
Hero Member
*****
Offline Offline

Activity: 1358
Merit: 850



View Profile
January 16, 2021, 06:58:35 PM
 #8

Nicely presented. Just sharing my one written on Child-Pays-For-Parent long ago- https://bitcointalk.org/index.php?topic=5198274.0

Also, people can choose transaction not to support RBF even on electrum, this can be a mistake from a newbie
There are a number of reasons you may want to disable RBF. There are quite a few merchants which will accept zero confirmation transaction as long as RBF is disabled
Bitrefill accepts zero-confirmation tx only if RBF isn't enabled. The last time I used Bitrefill was a bad experience for this as I used to use RBF and didn't have enough fund to bump the fee.

bitmover
Legendary
*
Online Online

Activity: 2282
Merit: 5901


bitcoindata.science


View Profile WWW
October 31, 2023, 08:15:52 PM
 #9

Replace-By-Fee (RBF)

RBF is straightforward. A stuck transaction is replaced by reusing the same coins in a similar transaction that pays a higher fee. A miner can only confirm one of the two transactions, so they will confirm the one that pays the higher fee. If the fee is high enough, they will confirm it immediately. The lower-fee transaction becomes invalid, so it is just discarded. Generally, your wallet must support RBF, because it normally won't allow you to reuse the same coins in another transaction.

This was the first time I made this kind of transaction. Just googled about it and found this topic.

Very easy and straightforward in Electrum, just as odolvlobo mentioned.



Just right click on the unconfirmed transaction and choose increase fee. The old transaction simple disappeared.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
SquirrelJulietGarden
Hero Member
*****
Offline Offline

Activity: 1302
Merit: 726



View Profile
November 01, 2023, 02:03:08 AM
Merited by o_e_l_e_o (4)
 #10

This was the first time I made this kind of transaction. Just googled about it and found this topic.

Very easy and straightforward in Electrum, just as odolvlobo mentioned.



Just right click on the unconfirmed transaction and choose increase fee. The old transaction simple disappeared.
I am very surprised that you did not use this RBF (Increase fee/ Bump fee) after many years. You had to understand about Bitcoin mempools very well that I know you did. But you also have to very lucky that mempools never sudden increase after you broadcast your transaction and you also have good patience to wait for confirmation in such situations of mempool sudden increase.

I did not see you mention in your post and screenshot and I assume you did not know about it.

In Electrum wallet, when you click on Increase fee, you will have to choose to deduct the bump fee from a transaction value or don't deduct it. If in your initial transaction broadcast, you use all coin in your wallet, you will see an error. I am not have any pending transaction at the moment and I don't remember exact descriptions for two options. Preserved payment and another option.



My Bitcoin transaction is not confirming, what can I do?

███▄▀██▄▄
░░▄████▄▀████ ▄▄▄
░░████▄▄▄▄░░█▀▀
███ ██████▄▄▀█▌
░▄░░███▀████
░▐█░░███░██▄▄
░░▄▀░████▄▄▄▀█
░█░▄███▀████ ▐█
▀▄▄███▀▄██▄
░░▄██▌░░██▀
░▐█▀████ ▀██
░░█▌██████ ▀▀██▄
░░▀███
▄▄██▀▄███
▄▄▄████▀▄████▄░░
▀▀█░░▄▄▄▄████░░
▐█▀▄▄█████████
████▀███░░▄░
▄▄██░███░░█▌░
█▀▄▄▄████░▀▄░░
█▌████▀███▄░█░
▄██▄▀███▄▄▀
▀██░░▐██▄░░
██▀████▀█▌░
▄██▀▀██████▐█░░
███▀░░
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
November 01, 2023, 09:00:16 AM
 #11

I am not have any pending transaction at the moment and I don't remember exact descriptions for two options. Preserved payment and another option.
The current options are "Preserve payment" or "Decrease payment".

However, these options were simplified from the older three options in version 4.4.6. Since in bitmover's screenshots he is still using 4.3.4, he will see the old options as follows:
- "decrease change, or add new inputs, or decrease any outputs"
- "decrease change, or decrease any outputs"
- "decrease payment"
Jon_Hodl
Member
**
Offline Offline

Activity: 216
Merit: 93

Humble Bitcoin Stacktivist


View Profile WWW
November 01, 2023, 10:55:10 PM
 #12

Good writeup. I would also include that replace by fee can only be done with the inputs (sending address) and child pays for parent can only be done by one of the outputs (receiving addresses).

Both are really powerful functions and I use them all the time. Sparrow Wallet supports both of them which is one of the many reasons why it is the only desktop wallet that I ever recommend to anyone.

I'm here to chew bubblegum and stack sats....and I'm all out of bubblegum. - Learn More About Bitcoin: What Is Bitcoin?
SquirrelJulietGarden
Hero Member
*****
Offline Offline

Activity: 1302
Merit: 726



View Profile
November 02, 2023, 08:19:32 AM
Last edit: November 02, 2023, 09:54:13 AM by SquirrelJulietGarden
 #13

Good writeup. I would also include that replace by fee can only be done with the inputs (sending address) and child pays for parent can only be done by one of the outputs (receiving addresses).
[TUTORIAL] getting a low-fee transaction unstuck by creating a CPFP with electrum

Quote
Both are really powerful functions and I use them all the time. Sparrow Wallet supports both of them which is one of the many reasons why it is the only desktop wallet that I ever recommend to anyone.
To avoid inconvenience from Child Pay For Parents, because you won't always have access to private keys or receiving address, you must always tick on Replace-by-Fee in your non custodial wallet. Default, wallet software turns it on but make sure you check it is on or off. If you turned it off in the past, forgot about it, you might have trouble in future.

███▄▀██▄▄
░░▄████▄▀████ ▄▄▄
░░████▄▄▄▄░░█▀▀
███ ██████▄▄▀█▌
░▄░░███▀████
░▐█░░███░██▄▄
░░▄▀░████▄▄▄▀█
░█░▄███▀████ ▐█
▀▄▄███▀▄██▄
░░▄██▌░░██▀
░▐█▀████ ▀██
░░█▌██████ ▀▀██▄
░░▀███
▄▄██▀▄███
▄▄▄████▀▄████▄░░
▀▀█░░▄▄▄▄████░░
▐█▀▄▄█████████
████▀███░░▄░
▄▄██░███░░█▌░
█▀▄▄▄████░▀▄░░
█▌████▀███▄░█░
▄██▄▀███▄▄▀
▀██░░▐██▄░░
██▀████▀█▌░
▄██▀▀██████▐█░░
███▀░░
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
November 02, 2023, 11:14:35 AM
 #14

If you turned it off in the past, forgot about it, you might have trouble in future.
Full RBF is now widespread. You can fairly easily replace a transaction with a higher fee transaction, even if the original is opted out of opt-in RBF. You can see all recent full RBF replacements here: https://mempool.space/rbf#fullrbf
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!