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
Merge #1038: PSET: Fix blinded coinjoins with 3 or more parties
3ac7e78 pset, rpc: Better error messages for imbalance failure conditions (Andrew Chow)
b2a7007 pset: verify blind value and asset proofs when signing (Andrew Chow)
a7ef9f3 pset, test: Test a PSET coinjoin workflow (Andrew Chow)
ac580db pset, rpc: Do not fail walletprocesspsbt if missing utxos when blinding (Andrew Chow)
9f94966 pset: Allow GetUnsignedTx to force unblinded values (Andrew Chow)
f9f084f pset: Add missing fields to merging and fix combinepsbt (Andrew Chow)
59f65a3 rpc, pset: Include blinded value and asset proofs in decodepsbt (Andrew Chow)
941c54f pset: Create explicit value and asset proofs during blinding (Andrew Chow)
63c007d pset: blind commitment proofs de/ser (Andrew Chow)
b9a08f3 doc, pset: Add blind commitment proofs (Andrew Chow)
9856f2c pset, doc: Remove requirement to remove blinded amounts and assets (Andrew Chow)
37c925f pset: Do not remove amounts after blinding (Andrew Chow)
Pull request description:
In order for blinded coinjoins with 3 or more parties to work, some fields need to be added, amounts cannot be removed, and some bugs need fixing.
First and foremost is to no longer remove amounts after blinding. Due to a miscommunication, I had believed that part of the goal of PSET was to hide semi private information (such as output amounts) from other parties in the transaction. However this causes the combiner to fail because the unique ID is dependent on those amounts and their commitments. If multiple parties had blinded just their own outputs, then the resulting PSETs would not combine because the amounts had be removed and so the unique ID calculated was incorrect. In order for this combining to work, amounts must be kept after blinding and the unique ID calculation must only use the computed unblinded transaction. This change has also been made to the spec document.
Second is the addition of explicit value and asset proofs. In order to prove that the commitments commit to the given explicit value or asset, explicit value rangeproofs and explicit asset surjection proofs are added to PSET. Each blinded output must have an explicit value rangeproof and explict asset surjection proof after blinding. For issuances, explicit issuance value proofs and explicit reissuance value proofs must be added after blinding. These proofs are verified prior to signing.
Thirdly, in order to make the coinjoin workflow work, a `blind` option is added `walletprocesspsbt` so that users can tell `walletprocesspsbt` to not attempt to blind. This is important because blinding requires all UTXOs to be present, and UTXOs can only be added via a call to `walletprocesspsbt`. Error messages have been added and improved so that users who do things in the wrong order will be less likely to end up with an unusable PSET.
Lastly, a test case has been added for a 3 party coinjoin workflow.
Fixes#1037
ACKs for top commit:
apoelstra:
ACK 3ac7e78
Tree-SHA512: b1fd848c72d8dd779b0f0640d9321b8085d62db494d25f81e3ec90e43c4a4edbe537dec404d8170a7ad057027c07f2b948980907d0849da693b2ca1bf0cf81f6
Copy file name to clipboardExpand all lines: doc/pset.mediawiki
+49-17Lines changed: 49 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ The currently defined elements per-input proprietary types are as folows:
84
84
| None
85
85
| No key data
86
86
| <tt><64-bit int></tt>
87
-
| The explicit little endian 64-bit integer for the value of this issuance. This is mutually exclusive with <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_COMMITMENT</tt>
87
+
| The explicit little endian 64-bit integer for the value of this issuance.
88
88
|
89
89
| 0
90
90
| 2
@@ -94,7 +94,7 @@ The currently defined elements per-input proprietary types are as folows:
94
94
| None
95
95
| No key data
96
96
| <tt><33 byte commitment></tt>
97
-
| The 33 byte Value Commitment. This is mutually exclusive with <tt>PSBT_IN_ISSUANCE_VALUE</tt>.
97
+
| The 33 byte Value Commitment. If provided, <tt>PSBT_ELEMENTS_IN_ISSUANCE_BLIND_VALUE_PROOF</tt> must be provided too.
98
98
|
99
99
| 0
100
100
| 2
@@ -184,7 +184,7 @@ The currently defined elements per-input proprietary types are as folows:
184
184
| None
185
185
| No key data
186
186
| <tt><64-bit int></tt>
187
-
| The value for the inflation keys output to set in this issuance. This is mutually exclusive with <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS</tt>.
187
+
| The value for the inflation keys output to set in this issuance.
188
188
|
189
189
| 0
190
190
| 2
@@ -194,7 +194,7 @@ The currently defined elements per-input proprietary types are as folows:
194
194
| None
195
195
| No key data
196
196
| <tt><33 byte commitment></tt>
197
-
| The 33 byte commitment to the inflation keys output value in this issuance. This is mutually exclusive with <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS</tt>
197
+
| The 33 byte commitment to the inflation keys output value in this issuance. If provided, <tt>PSBT_ELEMENTS_IN_ISSUANCE_BLIND_INFLATION_KEYS_PROOF</tt> must be provided too.
198
198
|
199
199
| 0
200
200
| 2
@@ -228,6 +228,26 @@ The currently defined elements per-input proprietary types are as folows:
| An explicit value rangeproof that proves that the value commitment in <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_COMMITMENT</tt> matches the explicit value in <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE</tt>. If provided, <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_COMMITMENT</tt> must be provided too.
| An explicit value rangeproof that proves that the value commitment in <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS_COMMITMENT</tt> matches the explicit value in <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS</tt>. If provided, <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS_COMMITMENT</tt> must be provided too.
248
+
|
249
+
| 0
250
+
| 2
231
251
|}
232
252
233
253
The currently defined elements per-output proprietary types are as follows:
@@ -248,7 +268,7 @@ The currently defined elements per-output proprietary types are as follows:
248
268
| None
249
269
| No key data
250
270
| <tt><33 byte commitment></tt>
251
-
| The 33 byte Value Commitment for this output. This is mutually exclusive with <tt>PSBT_OUT_VALUE</tt>.
271
+
| The 33 byte Value Commitment for this output. If provided, <tt>PSBT_ELEMENTS_OUT_BLIND_VALUE_PROOF</tt> must be provided too.
252
272
|
253
273
| 0
254
274
| 2
@@ -258,7 +278,7 @@ The currently defined elements per-output proprietary types are as follows:
258
278
| None
259
279
| No key data
260
280
| <tt><32 byte asset tag></tt>
261
-
| The explicit 32 byte asset tag for this output. This is mutually exclusive with <tt>PSBT_ELEMENTS_OUT_ASSET_COMMITMENT</tt>.
281
+
| The explicit 32 byte asset tag for this output.
262
282
|
263
283
| 0
264
284
| 2
@@ -268,7 +288,7 @@ The currently defined elements per-output proprietary types are as follows:
268
288
| None
269
289
| No key data
270
290
| <tt><33 byte commitment></tt>
271
-
| The 33 byte Asset Commitment for this output. This is mutually exclusive with <tt>PSBT_ELEMENTS_OUT_ASSET</tt>.
291
+
| The 33 byte Asset Commitment for this output. If provided, <tt>PSBT_ELEMENTS_OUT_BLIND_ASSET_PROOF</tt> must be provided too.
272
292
|
273
293
| 0
274
294
| 2
@@ -322,10 +342,27 @@ The currently defined elements per-output proprietary types are as follows:
| An explicit value rangeproof that proves that the value commitment in <tt>PSBT_ELEMENTS_OUT_VALUE_COMMITMENT</tt> matches the explicit value in <tt>PSBT_OUT_VALUE</tt>. If provided, <tt>PSBT_ELEMENTS_OUT_VALUE_COMMITMENT</tt> must be provided too.
| An asset surjection proof with this output's asset as the only asset in the input set in order to prove that the asset commitment in <tt>PSBT_ELEMENTS_OUT_ASSET_COMMITMENT</tt> matches the explicit asset in <tt>PSBT_ELEMENTS_OUT_ASSET</tt>. If provided, <tt>PSBT_ELEMENTS_OUT_ASSET_COMMITMENT</tt> must be provided too.
361
+
|
362
+
| 0
363
+
| 2
325
364
|}
326
365
327
-
In addition to these new types, the <tt>PSBT_OUT_AMOUNT</tt> field is no longer required so long as <tt>PSBT_ELEMENTS_OUT_VALUE_COMMITMENT</tt> is present.
328
-
329
366
The PSET Magic Bytes are <tt>0x70736574</tt>
330
367
331
368
===Handling Duplicated Keys===
@@ -373,16 +410,15 @@ A single entity is likely to be both a Creator and Updater.
373
410
PSET requires a role not present in PSBT, the Blinder. Blinders are similar to Signers and own inputs.
374
411
The Blinder adds the blinding data to a transaction.
375
412
376
-
If Bit 0 of <tt>PSBT_ELEMENTS_GLOBAL_TX_MODIFIABLE</tt> is 0, the Blinder must do nothing.
377
-
378
413
For issuance inputs that belong to the Blinder, the Blinder should generate a random blinding factor and create a value commitment for the issuance value.
379
-
It will then add the value commitment in the <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_COMMITMENT</tt>. When it does so, it must remove the <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE</tt> field.
414
+
It will then add the value commitment in the <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_COMMITMENT</tt>.
380
415
The blinder will also add the issuance value rangeproof and the issuance keys rangeproof in their respective fields.
416
+
The blinder will also add the issuance blind value and issuance keys blind value proofs in their respective fields.
381
417
For ease of identifying the blinder for an issuance, the input the issuance is attached to must belong to the blinder for the issuance.
382
418
383
419
For the Blinder's outputs that are to be blinded (i.e. they have a blinding pubkey), the Blinder will create value and asset commitments and put them in their respective fields.
384
-
When they do so, the <tt>PSBT_ELEMENTS_OUT_VALUE</tt> and <tt>PSBT_ELEMENTS_OUT_ASSET</tt> fields must be removed.
385
420
The Blinder will create the Value Rangeproof and Asset Surjection Proof and put them in their respective fields.
421
+
The Blinder will create the blind value and blind asset proofs and put them in their respective fields.
386
422
It will also add the ephemeral pubkey used for ECDH of the nonce for the rangeproof to the <tt>PSBT_ELEMENTS_OUT_ECDH_PUBKEY</tt> field.
387
423
388
424
The blinder will then compute a scalar offset that will be added as a <tt>PSBT_ELEMENTS_GLOBAL_SCALAR</tt>.
@@ -400,17 +436,13 @@ It will then compute a final scalar offset.
400
436
Then it will subtract all of the scalar offsets from the value blinding factor for the last output and the result is the value blinding factor to be used for that last output.
401
437
The creation of the commitments, proofs, and other fields proceeds as usual.
402
438
Once all outputs are blinded, all <tt>PSBT_ELEMENTS_GLOBAL_SCALAR</tt> fields must be removed from the PSET.
403
-
Once all outputs are blinded, Bit 0 of <tt>PSBT_ELEMENTS_GLOBAL_TX_MODIFIABLE</tt> must be set to 0.
404
439
405
440
A single entity is likely to be a Creator, Updater, and Blinder.
406
-
In that case, the PSET should never be output with <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE</tt>, <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS</tt>, <tt>PSBT_ELEMENTS_OUT_VALUE</tt>, or <tt>PSBT_ELEMENTS_OUT_ASSET</tt> except for unblinded issuances and unblinded outputs.
407
441
408
442
===Signer===
409
443
410
444
In addition to the BIP 370 PSBT Signer behavior, PSET specifies some addtional constraints.
411
445
Before signing, the Signer must check whether blinding is complete. If any output contains a blinding pubkey but no commitments or proofs, then it must not sign.
412
-
This is easily done by checking whether Bit 0 of <tt>PSBT_ELEMENTS_GLOBAL_TX_MODIFIABLE</tt> is 1.
0 commit comments