You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v2 receiver should disable output substitution #843
BIP 77 specifies that it must be disabled in the URI for a v1 compatible receiver, because the directory acts as an unsecured payjoin server from the standpoint of BIP 78 senders, who do not use end to end encryption.
However, it appears that in #466 the corresponding field was renamed disable_output_substitution, and was later renamed back to output_substitution in the PayjoinExtras struct, but the value of false was retained, and this incorrect behavior has apparently survived a few refactorings... While I'm reasonably confident this is indeed just a bug, I didn't get to the bottom of how this confusion was introduced, so it's possible I missed something, so @DanGould can you please confirm this wasn't intentional? I kind of got lost what with the same boolean blindness that motivated the change to an enum in the first place looking at the history and it seems simpler to ask.
So it looks like there are actually multiple bugs in the implementation:
v2 receivers should always specify pjos=0 in the bitcoin URI. Currently this is elided by default (implicitly enables output substitution).
v2 senders should effectively ignore the receiver pjos parameter, since everything is e2e authenticated so there is no theft risk, and we want to allow tx cut-through/etc. Currently v2 senders use the v1 SenderBuilder which respects the receiver pjos preference
I also think BIP77 should be updated to explicitly state that the pjos should only be respected by v1 senders. A v2 sender may still disallow output substitution by specifying the disableoutputsubstitution query param.
v2 receivers should only heed the sender's output substitution preference and ignore the pjos BIP21 param. This may already be the case but we should double check.
So it looks like there are actually multiple bugs in the implementation:
Agreed
I also think BIP77 should be updated to explicitly state that the pjos should only be respected by v1 senders. A v2 sender may still disallow output substitution by specifying the disableoutputsubstitution query param.
v2 receivers should only heed the sender's output substitution preference and ignore the pjos BIP21 param. This may already be the case but we should double check.
What do you mean ignore the pjos BIP21 param? they don't parse it, so i don't think there's anything to ignore?
The unsecured payment server argument makes sense for the pjos parameter in the URI.
However, there may be reasons for both sender and receiver to want to disable, for example needing the payment address to be fixed (e.g. for record keeping or scripting reasons).
Although the new mechanism only accounts for transmitting sender's preferences to the recveiver, the receiver doesn't need to transmit their preference to the sender, they can just substitute or not on their turn. The explicit signalling is only really needed for the unsecured server scenario, ensuring that the sender does not sign a malicious txn.
So i think for the receiver's API we can bikeshed the code so the field name has sender or something for the receiver's struct, and clarify in the spec that the receiver's choice WRT substituting or not is just up to wallets?
Activity
spacebear21 commentedon Jul 2, 2025
So it looks like there are actually multiple bugs in the implementation:
pjos=0in the bitcoin URI. Currently this is elided by default (implicitly enables output substitution).pjosparameter, since everything is e2e authenticated so there is no theft risk, and we want to allow tx cut-through/etc. Currently v2 senders use the v1 SenderBuilder which respects the receiver pjos preferencepjosshould only be respected by v1 senders. A v2 sender may still disallow output substitution by specifying thedisableoutputsubstitutionquery param.pjosBIP21 param. This may already be the case but we should double check.Our v2 receiver did ensure that it would not substitute outputs for a v1 sender, so there's a small win at least!
nothingmuch commentedon Jul 2, 2025
Agreed
What do you mean ignore the pjos BIP21 param? they don't parse it, so i don't think there's anything to ignore?
The unsecured payment server argument makes sense for the
pjosparameter in the URI.However, there may be reasons for both sender and receiver to want to disable, for example needing the payment address to be fixed (e.g. for record keeping or scripting reasons).
Although the new mechanism only accounts for transmitting sender's preferences to the recveiver, the receiver doesn't need to transmit their preference to the sender, they can just substitute or not on their turn. The explicit signalling is only really needed for the unsecured server scenario, ensuring that the sender does not sign a malicious txn.
So i think for the receiver's API we can bikeshed the code so the field name has
senderor something for the receiver's struct, and clarify in the spec that the receiver's choice WRT substituting or not is just up to wallets?spacebear21 commentedon Jul 2, 2025
I misspoke here, I wasn't sure if the receiver remembered their own signaled preference, but I see they just apply the sender's params.
Fix `pjos` handling in v2 receiver and sender (#847)
Fix `pjos` handling in v2 receiver and sender (#847)