elements
elements copied to clipboard
pset: add optional asset blinding factor to input and output
In some protocols where blinding is done by different parties, the asset surjection proof for some output might be created by:
- someone who does not own an input with the same asset, or
- someone who does not know the asset blinding factor corresponding to the output asset commitment
This, in general, is the case of LiquiDEX v1 [1], e.g.
- Alice wants to swap
xof assetAforyof assetB - Alice owns a utxo with
xof assetA - Alice creates a spending that utxo and receiving an output
with
yof assetB. - Alice draws at random the asset and value blinding factors for the output, sets the corresponding asset and value commitment. Sets the nonce commitment. Computes and sets the rangeproof.
- Alice computes the scalar offset contribution of the input and output (combined)
- Alice computes the value blind proofs for the input and output
- Alice creates the LiquiDEX proposal using the data obtained above:
{
"version": 1,
"tx": "...",
"inputs": [{
"asset": "aa...",
"satoshi": x,
"assetblinder": "...",
"value_blind_proof": "...",
}],
"outputs": [{
"asset": "bb...",
"satoshi": y,
"assetblinder": "...",
"value_blind_proof": "...",
}],
"scalars": ["..."],
}
- Alice shares the proposal with Bob
- Bob adds more inputs for the asset
Band fees - Bob adds more outputs for the asset
A,Band fees - Bob blinds the transaction, i.e.:
- draws at random abf and vbf for each new output, apart from the last one for which he uses the new inputs contribution and the scalar offset from the proposal to balance the tx.
- creates rangeproofs for each new output
- creates surjection proofs for each (blinded) fee output
- creates surjection proofs for each
Aoutput, note that in general the input asset blinding factor is needed. - creates surjection proofs for each
Boutput, including the one from Alice, which requires the output blinding factor. Note that Alice could not have created the surjection proof since she did not know anyBinput when she created the tx.
Input and output asset blinding factors are the last fields needed to convert LiquiDEX v1 proposals in PSETs (and viceversa).
[1] https://leocomandini.github.io/2022/10/27/liquidexv1.html