-
Notifications
You must be signed in to change notification settings - Fork 399
Spec for PSET #951
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
Spec for PSET #951
Conversation
|
Thanks! I think we are going to change this to make it based off of PSBT2, which should simplify a lot of the transaction-hacking (and perhaps PSBT2 will have a "psbt ID" that we can make stay constant even after reblinding...maybe). Useful to have this PR so that we can iterate on that independently of the code review. |
doc/pset.mediawiki
Outdated
|
|
||
| The currently defined elements per-input proprietary types are as folows: | ||
|
|
||
| * Type: Issuance Value <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE = 0x00</tt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I wrong, but this maybe should be called PSET_ and not PSBT_ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote in a comment to the previous PR (#900 (comment)) why I think that PSBT_ELEMENTS_... is better than PSET_... and it seems that my arguments were accepted
|
|
||
| The Blinder can identify which outputs it should blind by checking the <tt>PSBT_ELEMENTS_OUT_BLINDER_INDEX</tt>. | ||
| Using that index, the Blinder should inspect the input at that same index. | ||
| If that input belongs to the Blinder, then the output is to be blinded by it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The language here is not entirely clear here IMHO. Unless I don't understand what it mean: the output is to be blinded by it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An output O has an int I_i which is the index of an input. If a blinder owns the input at I_i, it must also blind the output O.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that this makes it possible to define a specific blinder for each output. But why is this necessary? Is it a problem if the blinder has no input in the transaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, reading it I thought "it" was about the input, but it means the Blinder. So all good
|
Let's say we want to support use-cases where multiple parties adds inputs and interactively sign (coinjoin, swaps) and is acceptable that the last party adding inputs/outputs (ie. SIGHASH_ALL) will cover the Blinder role knowing therefore the blinding keys of others (or asset/amount blinders): We want to have a dedicated field for sharing these secrets in the PSET or this is out of scope and we will leave to be a construction coinjoin/swap protocols will build on top? |
|
The recipients can learn the blinding factors of their outputs in the usual way (using the rangeproof sidechannel), so PSET doesn't need to worry about this. |
Pardon, what's a rangeproof "sidechannel" ? Also here it's the blinder (which may or not may be one of the recipients) that needs to get blinders somehow from other parties. |
|
@tiero the "rangeproof sidechannel" is a mechanism in Elements that lets you encrypt data into a rangeproof with no additional space, such that the recepient can decrypt. This is currently used in Liquid so that senders can create blinded outputs and then communicate the blinding factors to the recipients. |
|
Doc needs update to be based on PSBT2 BIP-0370 https://github.com/achow101/bips/blob/psbt2/bip-0370.mediawiki ... should be fairly minor stuff but will let us clean up the "replace explicit outputs with blinded ones" workflow.g |
|
Opened a PR to this branch over here achow101#2 Will start working on implementing this on rust-elements and elements-miniscript, and in parallel @achow101 will work on building something on top of #935, with the goal of getting some test vectors so that everyone else can start moving forward again (and we can do a libwally implementation). Sorry for the delays on this, I keep promising to go over this and coordinate things and then getting pulled into other stuff. |
3b0435a to
3c3487c
Compare
|
I have updated this to use the formatting used in BIPs 174 and 370. Additionally this has been updated to be dependent on BIP 370 and PSET will only work with PSBTv2. One notable change is that |
2445805 to
81beac4
Compare
sanket1729
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the elements Taproot sighash, we also a global blockchain_genesis_hash in order to avoid reuse of signatures across blockchains. I think we should add a pset global proprietary field for it as it would needed to construct the Sighash Message
| | 2 | ||
| |- | ||
| | Peg-in Witness | ||
| | <tt>PSBT_ELEMENTS_IN_PEG_IN_WITNESS = 0x09</tt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name makes it seem that the type of the value should Witness, but it is shown as a script. How does this work for segwit transactions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this question does not make sense, and pegin transactions input only have witness in ScriptSig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a CScriptWitness: https://github.com/ElementsProject/elements/blob/master/src/pegins.cpp#L521
| ! Versions Allowing Inclusion | ||
| |- | ||
| | Value Commitment | ||
| | <tt>PSBT_ELEMENTS_OUT_VALUE_COMMITMENT = 0x01</tt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proprietary fields for Input, Global start from 0x00. Is there any special reason why this starts from 0x01?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally, the output's value was in field 0x00. However with the move to PSBTv2, this was no longer necessary and I removed that field. I just didn't change the rest of the field numbers. I don't feel strongly about keeping these, but it does make implementation easier to not change them.
|
@achow101 How is the serialization for range proof and surjection proofs Should we add separate fields for those? I only see proprietary fields for issuances/pegins in inputs. In a common workflow, the user would need to rewind the rangeproof in order to get the value/asset. |
|
Or is the type of |
Currently neither the range proof nor the surjection proof is provided in the input UTXOs. I don't see why the surjection proof would be required, but for the rangeproof, the only reason to have it is to be able to get the encrypted blinding factor from it. However since the range proof is really large, I am hesitant to put it there in its entirety. Instead, we could have a field for the encrypted blinding factor. The ecdh pubkey is already stored in |
Owning the blinding private key and a a call to any explorer/node, anyone can get the proofs and unblind it. Especially if wallets implements slip77, just the script is enough to derive the blinding from the seed/master blind key |
I think the scenario is for offline blinders which don't have access to any nodes. After all, the point of a PSET is to have everything for signing and blinding, no need to call a node. |
That's true, I am more in favor to put asset/value blinders then. This could unlock indeed more advanced cooperative multi-party blinding/unblinding |
The purpose of this rework of PSET is to avoid having to put asset and value blinders into the PSET. The blinding factors are supposed to be secret, while PSETs can be passed around to untrusted entities. Having the blinding factors in the PSET destroys the privacy preserving aspects of elements, so I don't think it makes a lot of sense to have them in. What workflows does having the blinding factors in the PSET enable? |
|
@achow101 Sorry, I meant encrypted of course, ref: your comment before
The main advantage would be cooperative blinding for swaps/coin join (ie. I don't trust the input you giving to contain what you claim), but yeah there could be other means to do it, on top of PSET without including in it |
|
@achow101, This would be an optional field, and only the users who really care about applications that require rewinding the proofs would use it. Here is one simple scenario where this might be useful. The user has an SW watch-only software that wants to confirm a receiving confidential transaction. The SW provides the 1) Rangeproof, 2) the
w.r.t to surjection proofs, you are right that these are not needed.
The current |
|
I think we should add the extra field. As Sanket observes,
Both of these problems are "temporary" in that they'll be eliminated by Bulletproofs. |
|
I've added an additional field where the UTXO's rangeproof can be specified. |
|
Thanks, @achow101. For the full utility of the use-case that I described above, we need three things.
we also need the public key from the receiver address. Is it also possible to add optional pubkey |
I'm not sure that updaters will necessarily know this. The blinding pubkey is not stored publicly anywhere and I'm not sure that updaters would necessarily be able to derive the blinding pubkey for an output. AFAIU, blinders should know how their blinding pubkeys are derived so a blinder can try to unwind every rangeproof. The ones where the unwinding is successful are the inputs that the blinder owns. |
|
@sanket1729 @achow101 think we should merge this since both PSET implementations are nearing completion? |
|
Fine by me |
sanket1729
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACk 8e19dfa
Adds the document specifying the new PSET format that #900 implements.
Pulled out of #900