2

I was reading this github gist about rbf improvements written by glozow. I had difficulty understanding parts of it. The main confusion I have is for this paragraph:

BIP125#2 can be bypassed by creating intermediary transactions to be replaced together. Anyone can simply split a 1-input 1-output transaction off from the replacement transaction, then broadcast the transaction as is. This can always be done, and quite cheaply. More details in this comment.

The BIP125#2 is:

The replacement transaction may only include an unconfirmed input if that input was included in one of the original transactions. (An unconfirmed input spends an output from a currently-unconfirmed transaction.)

Which from what I deduce, it basically means that a replacement transaction can only have one input of an unconfirmed transaction output. Is my understanding correct?

I also have taken a look on the comment glozow mentioned in the gist, but that doesn't helped me understanding how is it possible for one to bypass the restriction. Can someone explain it in simple language to me?

Thanks in advance

1 Answer 1

4

Replacement transaction using unconfirmed inputs

Which from what I deduce, it basically means that a replacement transaction can only have one input of an unconfirmed transaction output. Is my understanding correct?

The phrasing of BIP125#2 may not be the clearest. The short answer is that, no, this is not correct; specifically, a replacement transaction can have more than one unconfirmed input[1].

However, BIP125#2 requires that each of those unconfirmed inputs must be one of those that the transaction(s)[2] you are replacing has as an input.

Bypassing BIP125#2 with a 1-input 1-output transaction

Reproducing the scenario from the comment in question:

A and B are unconfirmed transactions in a mempool.

A user wants to replace A with a transaction C by spending at least one of the UTXOs that A is attempting to spend[3].

Case 1

The user wants C to spend an unconfirmed output from B, perhaps to assist with increasing the fee-rate of C compared to A. However, according to BIP125#2, C can not have an unconfirmed input that is not one of the inputs of A. So C can not spend the unconfirmed output of B.

Case 2

Knowing the limitations in Case 1, the user instead creates a new intermediate 1-input 1-output transaction C* that just spends an unconfirmed output from B. Now, the user can construct a transaction C that replaces both A and C*. Supposing that the fees are sufficient, this is now possible to do as the only unconfirmed inputs of C are from the transactions it is replacing, namely, A and C.

Once replaced, we have the effect of C having replaced A and spending an unconfirmed output of B.


[1]: An unconfirmed input is any input spending an unconfirmed UTXO. (Stated in parentheses in BIP125#2).

[2]: You can replace more than one transaction with a single transaction.

[3]: Not one of its outputs as this wouldn't be a replacement. We're talking about actually "double-spending" A here. At the end of a replacement, A should no longer be in the mempool as the two transactions conflict.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.