NUT-11: SIG_ALL sign aggregated message all inputs and ouptuts#149
NUT-11: SIG_ALL sign aggregated message all inputs and ouptuts#149
SIG_ALL sign aggregated message all inputs and ouptuts#149Conversation
SIG_ALL sign aggregated message all inputs and ouptuts
Co-authored-by: gudnuf <108303703+gudnuf@users.noreply.github.com>
I think we should do that in NUT-0 |
11.md
Outdated
| ### Multisig | ||
|
|
||
| If the tag `n_sigs` is a positive integer, the mint will also consider signatures from public keys specified in the `pubkeys` tag additional to the public key in `Secret.data`. If the number of valid signatures is greater or equal to the number specified in `n_sigs`, the transaction is valid. | ||
| If the tag `n_sigs` is a positive integer, the mint will require valid signatures from `n_sigs` public keys contained in the `Secret.data` field and the `pubkeys` tag. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Have made some suggestions to clarify the multisig logic.
EDIT: Have PR'd these suggestions (#272)
|
|
||
| If the `locktime` is in the past and a tag `refund` is present, the `Proof` is spendable only if a valid signature by one of the the `refund` pubkeys is provided in `Proof.witness.signatures` and, depending on the signature flag, in `BlindedMessage.witness.signatures`. | ||
| If the `locktime` is in the past and a tag `refund` is present, the `Proof` is spendable only if valid signatures are given by the `refund` pubkeys. The | ||
|
|
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
11.md
Outdated
| ### Multisig | ||
|
|
||
| If the tag `n_sigs` is a positive integer, the mint will also consider signatures from public keys specified in the `pubkeys` tag additional to the public key in `Secret.data`. If the number of valid signatures is greater or equal to the number specified in `n_sigs`, the transaction is valid. | ||
| If the tag `n_sigs` is a positive integer, the mint will require valid signatures from `n_sigs` public keys contained in the `Secret.data` field and the `pubkeys` tag. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
11.md
Outdated
| #### Complex Example | ||
|
|
||
| This is an example `secret` that locks a `Proof` with a Pay-to-Pubkey (P2PK) condition that requires 2-of-3 signatures from the public keys in the `data` field and the `pubkeys` tag. If the `timelock` has passed, the `Proof` becomes spendable with a single signature from the public key in the `refund` tag. The signature flag `sigflag` indicates that signatures are necessary on the `inputs` and the `outputs` of a transaction. | ||
| This is an example `Secret` that locks a `Proof` with a Pay-to-Pubkey (P2PK) condition that requires 2-of-3 signatures from the public keys in the `data` field and the `pubkeys` tag. If the `timelock` has passed, the `Proof` becomes spendable with a single signature from the public key in the `refund` tag. The signature flag `sigflag` indicates that signatures are necessary on the `inputs` and the `outputs` of the transaction this `Proof` is spent by. |
There was a problem hiding this comment.
Would be good to add a second refund public key to make it clear the tag supports multiple keys.
Suggestion:
... becomes spendable with a single signature from one of the two public keys in the refund tag.
|
NOTE: maybe it would be convenient to include a limit of |
c99ce7b to
353c522
Compare
|
CDK PR: cashubtc/cdk#862 |
* Clarifications to multisig * Distinguish between Locktime MultiSig and Refund MultiSig
This PR specifies the signature flag
SIG_ALLfor swap and for melt transactions involving P2PK-locked or HTLC-locked inputs. It also adds a new tag for P2PK (also used in HTLC) calledn_sigs_refundthat specifies the signature threshold for therefundpubkeys (enforced after a timelock).SIG_ALLmeans that the witness of the first input must be a signature on an concatenated message of the formproof.secret_n.. . || output.B'_n...in the case of a swap covering all of the inputs'secretfields and all of the outputs' blinded message fieldsB_. In the case of a melt, we also need to include thequote_idin the signed message.Aggregation for
swapIf a swap transaction has
ninputs andmoutputs, the message to sign becomes:Aggregation for
meltFor a melt transaction, the message to sign is composed of all the inputs, the quote ID being paid, and the [NUT-08][08] blank
outputs.If a melt transaction has
ninputs,mblank outputs, and a quote IDquote_id, the message to sign becomes:Here,
||denotes string concatenation. TheB_of each output is a hex string.Changes:
n_sigs_refundBlindedMessage.witnessoutput witnessTodo:
/swapor also for/melt(for both signature flags)SIG_ALLtest vectorsSIG_ALL.Tracking:
SIG_ALLsignature flag for P2PK nutshell#735)