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
When the payjoin sender posts the original PSBT to the receiver, he can optionally specify the following HTTP query string parameters:
125
125
@@ -139,9 +139,9 @@ If the receiver does not support the version of the sender, they should send an
139
139
140
140
* <code>additionalfeeoutputindex=</code>, if the sender is willing to pay for increased fee, this indicate output can have its value substracted to pay for it.
141
141
142
-
If the <code>additionalfeeoutputindex</code> is out of bounds or pointing to the payment output meant for the receiver, the receiver should ignore the parameter.
142
+
If the <code>additionalfeeoutputindex</code> is out of bounds or pointing to the payment output meant for the receiver, the receiver should ignore the parameter. See [[#fee-output|fee output]] for more information.
143
143
144
-
* <code>maxadditionalfeecontribution=</code>, if the sender is willing to pay for increased fee, an integer defining the maximum amount in satoshis that the sender is willing to contribute towards fees for the additional inputs. <code>maxadditionalfeecontribution</code> must be ignored if set to less than zero.
144
+
* <code>maxadditionalfeecontribution=</code>, if the sender is willing to pay for increased fee, an integer defining the maximum amount in satoshis that the sender is willing to contribute towards fees for the additional inputs. <code>maxadditionalfeecontribution</code> must be ignored if set to less than zero. See [[#fee-output|fee output]] for more information.
145
145
146
146
Note that both <code>maxadditionalfeecontribution=</code> and <code>additionalfeeoutputindex=</code> must be specified and valid for the receiver to be allowed to decrease an output belonging to the sender.
147
147
This fee contribution can't be used to pay for anything else than additional input's weight.
@@ -187,6 +187,44 @@ Instead those errors or messages can only appear in debug logs.
187
187
188
188
It is advised to hard code the description of the well known error codes into the sender's software.
189
189
190
+
===<span id="fee-output"></span>Fee output===
191
+
192
+
In some situation, the sender might want to pay some additional fee in the payjoin proposal.
193
+
If such is the case, the sender must use both [[#optional-params|optional parameters]] <code>additionalfeeoutputindex=</code> and <code>maxadditionalfeecontribution=</code> to indicate which output and how much the receiver can substract fee.
194
+
195
+
There is several cases where a fee output is useful:
196
+
197
+
* The sender's original transaction's fee rate is at the minimum accepted by the network, aka <code>minimum relay transaction fee rate</code>, which is typically 1 satoshi per vbyte.
198
+
199
+
In such case, the receiver will need to increase the fee of the transaction after adding his own inputs to not drop below the minimum relay transaction fee rate.
200
+
201
+
* The sender's wallet software is using round fee rate.
202
+
203
+
If the sender's fee rate is always round, then a blockchain analyst can easily spot the transactions of the sender involving payjoin by checking if, when removing a single input to the suspected payjoin transaction, the resulting fee rate is round.
204
+
To prevent this, the sender can agree to pay more more fee so the receiver make sure that the payjoin transaction fee is also round.
205
+
206
+
* The sender's transaction is time sensitive.
207
+
208
+
When a sender pick a specific fee rate, the sender expects the transaction to be confirmed after a specific amount of time. But if the receiver adds an input without bumping the fee of the transaction, the payjoin transaction fee rate will be lower, and thus, longer to confirm.
209
+
210
+
Our recommendation for <code>maxadditionalfeecontribution=</code> is <code>originalPSBTFeeRate * vsize(sender_input_type)</code>.
211
+
212
+
{| class="wikitable"
213
+
!sender_input_type
214
+
!vsize(sender_input_type)
215
+
|-
216
+
|P2WPKH
217
+
|68
218
+
|-
219
+
|P2PKH
220
+
|148
221
+
|-
222
+
|P2SH-P2WPKH
223
+
|91
224
+
|}
225
+
226
+
227
+
190
228
===Receiver's original PSBT checklist===
191
229
192
230
The receiver needs to do some check on the original PSBT before proceeding:
@@ -216,7 +254,7 @@ The sender should check the payjoin proposal before signing it to prevent a mali
216
254
If a fee output exists, (ie, <code>maxadditionalfeecontribution=</code> and <code>additionalfeeoutputindex=</code> have been set by the sender), the sender must checks:
217
255
* The amount that was substracted from the output's value is less or equal to <code>maxadditionalfeecontribution</code>. Let's call this amount <code>actual contribution</code>.
218
256
* The <code>actual contribution</code> is less or equals to the difference of absolute fee between the payjoin proposal and the original PSBT. (This make sure the contribution actually goes to fee)
219
-
* The <code>actual contribution</code> is less or equals to <code>originalPSBTFeeRate * vsize(count(original_psbt_inputs) - count(payjoin_proposal_inputs))</code>. (This make sure the contributiion only pays for additional inputs)
257
+
* The <code>actual contribution</code> is less or equals to <code>originalPSBTFeeRate * vsize(sender_input_type) * (count(original_psbt_inputs) - count(payjoin_proposal_inputs))</code>. (This make sure the contribution only pays for additional inputs, see [[#fee-output|Fee output]] section)
220
258
221
259
The sender must be careful to only sign the inputs that were present in the original PSBT and nothing else.
222
260
@@ -245,7 +283,7 @@ To be properly relayed, a Bitcoin transaction needs to pay at least 1 satoshi pe
245
283
When blocks are not full, the original transaction might already at the minimum relay fee rate (currently 1 satoshi per virtual byte), so if the receiver adds their own input, they need to make sure the fee is increased such that the rate does not drop below the minimum relay fee rate.
246
284
In such case, the sender must set both <code>maxadditionalfeecontribution=</code> and <code>additionalfeeoutputindex=</code>.
247
285
248
-
The recommended value <code>maxadditionalfeecontribution=</code> is <code>minFeeRate * vsize(1 input)</code>.
286
+
See the [[#fee-output|Fee output]] section for more information.
249
287
250
288
We also recommend the sender to set <code>minfeerate=</code>, as the sender's node policy might be different from the receiver's policy.
251
289
@@ -257,7 +295,7 @@ If the payjoin transaction's fee was not increased by the added size, then those
257
295
Not only would those transactions stand out by not having a round fee (like 1.87 sat/b), but any suspicion of payjoin could be confirmed by checking if removing one input would create a round fee rate.
258
296
In such case, the sender must set both <code>maxadditionalfeecontribution=</code> and <code>additionalfeeoutputindex=</code>.
259
297
260
-
The recommended value <code>maxadditionalfeecontribution=</code> is <code>feerate * vsize(1 input)</code>.
298
+
The recommended value <code>maxadditionalfeecontribution=</code> is explained in the [[#fee-output|Fee output]] section.
261
299
We also recommend the sender to set <code>minfeerate=</code>, as the sender's node policy might be different from the receiver's policy.
0 commit comments