Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[USING] fix PayJoin #805

Merged
merged 5 commits into from
May 10, 2020
Merged

Conversation

MaxHillebrand
Copy link
Collaborator

@MaxHillebrand MaxHillebrand commented May 2, 2020

This ready for review branch adds some minor fixes to the PayJoin chapter, mainly that it works over clearnet too.
also adds a link to bip79 with a link to the btcpay spec for how our implementation differs.

@MaxHillebrand MaxHillebrand added ready for review Waiting for review and discussion using wasabi Regarding the using wasabi pillar labels May 2, 2020
@MaxHillebrand MaxHillebrand requested a review from yahiheb May 2, 2020 08:24
RiccardoMasutti
RiccardoMasutti previously approved these changes May 2, 2020
[BIP 79: Bustapay: A Practical CoinJoin Protocol](https://github.com/bitcoin/bips/blob/master/bip-0079.mediawiki)

Wasabi deviates from BIP 79 in some aspects.
The exact details of the implementation are [documented here](https://docs.btcpayserver.org/features/payjoin/payjoin-spec)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Wasabi support BIP79?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly, yes.
There are some differences, mainly using PSBT instead of raw transactions.
The couple deviations are in the btcpay server spec.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But Wasabi doesn't support receiver side does it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. But this doesn't mean that it is strictly compliant with BIP79.
For example, another thing with BIP79 is that the URI has a bp=xxx extension for bustapay.
Wasabi doesn't recognize this, I think, but only the BTCPay spec of pj=xxx for PayJoin.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then maybe we shouldn't add this to the supported BIPs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, we also have BIP158 on there, but we don't 100% support it, cause we have segwit v0 single pubkey filters, not the basic filters.

I think, that if we support the general idea / most of the details of a BIP, then we should reference it here.

BTCPay might open a new BIP with the updated specifics. If they do, then we should of course link to this one.

FYI, the changes really are minimal...

- The standard way of letting a sender know where to send a bustapay transaction is done via a bip21 encoded address. The key value "bpu" (short for "BustaPayUrl") should be used. An example of such address would be bitcoin:2NABbUr9yeRCp1oUCtVmgJF8HGRCo3ifpTT?bpu=https://bp.bustabit.com/submit It is highly encouraged that urls are kept short. 
+ The standard way of letting a sender know where to send a bustapay transaction is done via a bip21 encoded address. The key value "pj" (short for "payjoin URL") should be used. An example of such address would be bitcoin:2NABbUr9yeRCp1oUCtVmgJF8HGRCo3ifpTT?pj=https://example.com/submit It is highly encouraged that urls are kept short.

- Step 1. Sender creates a bitcoin transaction paying the receiver
+ Step 1. Sender creates a bitcoin transaction OR PSBT paying the receiver
+ While we also support the use of raw transaction instead of PSBT, we strongly advise against it.

- This transaction must use segwit for all inputs, and be fully valid and signed. The transaction must be eligible for propagation on the network (but not done so at this stage) 
+ If using PSBT, the PSBT must be finalized with witness UTXO information.
+ If using transactions, the transaction must use segwit for all inputs, and be fully valid and signed. The transaction must be eligible for propagation on the network (but not done so at this stage

- Step 2. Sender gives the "template transaction" to the receiver
+ Step 2. If using PSBT, sender gives "original PSBT" to the receiver, in base64 or hex format. 
+ If using transactions, sender gives "original transaction" to the receiver, in hex format.
- This is done via an HTTP POST request, sent to a "[bustapay] url" 
+ This is done via an HTTP POST request, sent to a "[payjoin] url" 

Step 3. Receiver processes the transaction and returns a partially signed coinjoin

- The receiver validates the transaction, and pays himself. The receiver then adds one or more of his own inputs (known as the contributed inputs) and (optionally) increases the output that pays himself (generally by the sum of the contributed inputs). Doing so creates a partial transaction, which the receiver returns to the sender. It is called such as it requires the sender to re-sign his own inputs. 
+ The receiver extracts the transaction, optionally verifying it is valid. (by calling testmempoolaccept on the extracted transaction)
+ The receiver extracts the feerate, adds one of his inputs and decreases the change output of the payer by the increased fee difference his input added such that the feerate is the same as the "orginal PSBT" or "original transaction".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation. I am just trying to make sure that we add what we really support.
I remember @nopara73 removing some bips before, so that is why I thought we shouldn't add it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WalletWasabi/WalletWasabi#3639 (comment)

Does this change anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, I don't think so...

docs/using-wasabi/PayJoin.md Outdated Show resolved Hide resolved
docs/using-wasabi/PayJoin.md Outdated Show resolved Hide resolved
docs/using-wasabi/PayJoin.md Outdated Show resolved Hide resolved
Co-authored-by: yahiheb <52379387+yahiheb@users.noreply.github.com>
@MaxHillebrand MaxHillebrand merged commit c701ad7 into WalletWasabi:master May 10, 2020
@MaxHillebrand MaxHillebrand deleted the fix-payjoin branch May 10, 2020 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review Waiting for review and discussion using wasabi Regarding the using wasabi pillar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants