Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Charles-Tim on August 03, 2020, 05:33:54 PM



Title: Replace by fee on bitcoin wallet
Post by: Charles-Tim on August 03, 2020, 05:33:54 PM
I am getting familiar with bitcoin wallet day after day, lately I learned about fee pumping which is also known as replace by fee, it happens in a way bitcoin transaction that is not confirmed can be included early in a block by pumping the fee. This is a very good feature a wallet can have, two wallets I know that have RBF capability are Bitcoin core and Electrum. They are my best bitcoin online wallets.

I also read about using RBF to reverse back transactions if the transaction have zero confirmation, which means scammers can use it easily to reverse bitcoin sent to someone back into their same wallet.

I am not a scammer but I like to know everything in details about bitcoin and bitcoin wallet for the sake of knowledge.

Can someone use RBF to reverse transaction on bitcoin core and electrum wallet? Or only used to pump fee? Or, it is done by another means?



Title: Re: Replace by fee on bitcoin wallet
Post by: Rath_ on August 03, 2020, 05:42:51 PM
Can someone use RBF to reverse transaction on bitcoin core and electrum wallet? Or only used to pump fee? Or, it is done by another means?

With RBF enabled, one can spend the inputs of the initial transaction again. The transaction itself cannot be deleted from the mempool or reversed. Electrum will only allow you to bump the fee, but you can remove the transaction manually by editing the wallet file (this will allow you to create a conflicting transaction) or you can sign a transaction spending the same inputs with a higher fee beforehand and broadcast it after the transaction you want to replace. I haven't tested it out on Bitcoin Core. You probably need to use -zapwallettxes parameter. Edit:

Bitcoin Core makes making Full RBF transactions very easy. Simply go to the transactions list, right click the transaction that is stuck, and choose the "Abandon Transaction" option.

If that option is greyed out, then you must go to the Bitcoin Core datadir and delete the mempool.dat file. Then restart Bitcoin Core with the -walletbroadcast=0 option and then you should be able to use "Abandon Transaction".

If the above two options fail for some reason, then you can start Bitcoin Core with the -zapwallettxes option to clear all unconfirmed transactions from your wallet.

You could also try using wallet.remove_transaction("txid") in the Electrum's console instead of editing the wallet file.


Title: Re: Replace by fee on bitcoin wallet
Post by: AB de Royse777 on August 03, 2020, 06:13:41 PM
Talking about RBF, I remember not long ago a Tx dropped (in the COVID-19 project  (https://bitcointalk.org/index.php?topic=5243099.0)when we paid on a donation) and we did not have any clue. Then we realized one of the input was unconfirmed and that input value was changed when the Tx was RBFed.

In summary this is what happened:

- Transaction 1 sent with small fees
- Transaction 2 sent with whatever fees with having one input from transaction 1

Until Tx 2 is confirmed if anyone do RBF or CPFP then Transaction 2 will drop and you will need to create a new transaction for this.

I hope this helps.

Cheers,



Title: Re: Replace by fee on bitcoin wallet
Post by: o_e_l_e_o on August 03, 2020, 07:12:32 PM
Until Tx 2 is confirmed if anyone do RBF or CPFP then Transaction 2 will drop and you will need to create a new transaction for this.
Emphasis mine - that part is not strictly true.

Lets say you make a transaction which has two outputs - lets call them A and B - which is still unconfirmed. Output A is sent to me, and and output B is change to yourself. I then make a transaction which uses output A as an input, which is also unconfirmed. As either of the two outputs can be used in a CPFP transaction, there are therefore two ways to perform a CPFP on the first transaction:
  • You can spend output B (your change) with a much higher fee. In this case, output A remains unchanged, and so my transaction which is built on output A would still be valid
  • I can spend output A with a much higher fee. I may already have done this with the unconfirmed transaction I have already made. If I broadcast a second higher fee transaction using output A (perhaps a RBF transaction), then my original transaction will become invalid if and when the second one confirms.


Title: Re: Replace by fee on bitcoin wallet
Post by: nc50lc on August 04, 2020, 07:36:20 AM
Until Tx 2 is confirmed if anyone do RBF or CPFP then Transaction 2 will drop and you will need to create a new transaction for this.
Emphasis mine - that part is not strictly true.
-snip-
Correct, but the example may have gone over the head of some  ;D

Alternate explanation:
  • Yes, RBF will create a replacement for Transaction1 which invalidates the previous outputs and will make Transaction2 invalid for "missing input(s)".
  • But, CPFP will not create a replacement, it will just spend the other unconfirmed outputs of Transaction1 [not TX2's input(s)]
    and "anyone" can't CPFP the other outputs but the ones belong to their wallet so it won't invalidate Transaction2 even if they do CPFP.


Title: Re: Replace by fee on bitcoin wallet
Post by: AB de Royse777 on August 04, 2020, 06:38:25 PM
Until Tx 2 is confirmed if anyone do RBF or CPFP then Transaction 2 will drop and you will need to create a new transaction for this.
Emphasis mine - that part is not strictly true.
My bad that I added CPFP, I did not experience with that but with RBF so, I am wrong about CPFP :-P

Correct, but the example may have gone over the head of some  ;D
I had to read the 2nd example more than twice :-D
And we all have done this most of the time (Spent and unconfirmed Tx)