Skip to content

Commit 70758e0

Browse files
committed
f remove markdown indentation
1 parent 0512dd2 commit 70758e0

File tree

1 file changed

+97
-97
lines changed

1 file changed

+97
-97
lines changed

src/modules/musig/musig.md

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ API in ways that could lead to accidental signatures or loss of key material.
1212
In MuSig all participants contribute key material to a single signing key,
1313
using the equation
1414

15-
P = sum_i µ_i * P_i
15+
P = sum_i µ_i - P_i
1616

1717
where `P_i` is the public key of the `i`th participant and `µ_i` is a so-called
1818
_MuSig coefficient_ computed according to the following equation
@@ -25,18 +25,18 @@ where H is a hash function modelled as a random oracle.
2525
To produce a multisignature `(s, R)` on a message `m` using verification key
2626
`P`, signers act as follows:
2727

28-
1. Each computes a nonce, or ephemeral keypair, `(k_i, R_i)`. Every participant
29-
communinicates `H(R_i)` to every other participant.
30-
2. Upon receipt of every `H(R_i)`, each participant communicates `R_i` to every
31-
other participant. The recipients check that each `R_i` is consistent with
32-
the previously-communicated hash.
33-
3. Each participant computes a combined nonce
34-
R = sum_i R_i
35-
and shared challenge
36-
e = H(R || P || m)
37-
and partial signature
38-
s_i = k_i + µ_i*x_i*e
39-
where `x_i` is the secret key corresponding to `P_i`.
28+
1. Each computes a nonce, or ephemeral keypair, `(k_i, R_i)`. Every participant
29+
communinicates `H(R_i)` to every other participant.
30+
2. Upon receipt of every `H(R_i)`, each participant communicates `R_i` to every
31+
other participant. The recipients check that each `R_i` is consistent with
32+
the previously-communicated hash.
33+
3. Each participant computes a combined nonce
34+
R = sum_i R_i
35+
and shared challenge
36+
e = H(R || P || m)
37+
and partial signature
38+
s_i = k_i + µ_i*x_i*e
39+
where `x_i` is the secret key corresponding to `P_i`.
4040

4141
The complete signature is then the `(s, R)` where `s = sum_i s_i` and `R = sum_i R_i`.
4242

@@ -72,72 +72,72 @@ signature process, which is also a supported mode) acts as follows.
7272

7373
### Signing Participant
7474

75-
1. The signer starts the session by calling `secp256k1_musig_session_initialize`.
76-
This function outputs
77-
* an initialized session state in the out-pointer `session`
78-
* an array of initialized signer data in the out-pointer `signers`
79-
* a commitment `H(R_i)` to a nonce in the out-pointer `nonce_commitment32`
80-
It takes as input
81-
* a unique session ID `session_id32`
82-
* (optionally) a message to be signed `msg32`
83-
* the combined public key output from `secp256k1_musig_pubkey_combine`
84-
* the public key hash output from `secp256k1_musig_pubkey_combine`
85-
* the signer's index `i` `my_index`
86-
* the signer's secret key `seckey`
87-
2. The signer then communicates `H(R_i)` to all other signers, and receives
88-
commitments `H(R_j)` from all other signers `j`. These hashes are simply
89-
length-32 byte arrays which can be communicated however is communicated.
90-
3. Once all signers nonce commitments have been received, the signer records
91-
these commitments with the function `secp256k1_musig_session_get_public_nonce`.
92-
This function updates in place
93-
* the session state `session`
94-
* the array of signer data `signers`
95-
taking in as input the list of commitments `commitments` and outputting the
96-
signer's public nonce `R_i` in the out-pointer `nonce`.
97-
4. The signer then communicates `R_i` to all other signers, and receives `R_j`
98-
from each signer `j`. On receipt of a nonce `R_j` he calls the function
99-
`secp256k1_musig_set_nonce` to record this fact. This function checks that
100-
the received nonce is consistent with the previously-received nonce and will
101-
return 0 in this case. The signer must also call this function with his own
102-
nonce and his own index `i`.
103-
These nonces `R_i` are secp256k1 public keys; they should be serialized using
104-
`secp256k1_ec_pubkey_serialize` and parsed with `secp256k1_ec_pubkey_parse`.
105-
5. Once all nonces have been exchanged in this way, signers are able to compute
106-
their partial signatures. They do so by calling `secp256k1_musig_session_combine_nonces`
107-
which updates in place
108-
* the session state `session`
109-
* the array of signer data `signers`
110-
It outputs an auxilary integer `nonce_is_negated` and has an auxilary input
111-
`adaptor`. Both of these may be set to NULL for ordinary signing purposes.
112-
If the signer did not provide a message to `secp256k1_musig_session_initialize`,
113-
a message must be provided now by calling `secp256k1_musig_session_set_msg` which
114-
updates the session state in place.
115-
6. The signer computes a partial signature `s_i` using the function
116-
`secp256k1_musig_partial_sign` which takes the session state as input and
117-
partial signature as output.
118-
7. The signer then communicates the partial signature `s_i` to all other signers, or
119-
to a central coordinator. These partial signatures should be serialized using
120-
`musig_partial_signature_serialize` and parsed using `musig_partial_signature_parse`.
121-
8. Each signer calls `secp256k1_musig_partial_sig_verify` on the other signers' partial
122-
signatures to verify their correctness. If only the validity of the final signature
123-
is important, not assigning blame, this step can be skipped.
124-
9. Any signer, or central coordinator, may combine the partial signatures to obtain
125-
a complete signature using `secp256k1_musig_partial_sig_combine`. This function takes
126-
a signing session and array of MuSig partial signatures, and outputs a single
127-
Schnorr signature.
75+
1. The signer starts the session by calling `secp256k1_musig_session_initialize`.
76+
This function outputs
77+
- an initialized session state in the out-pointer `session`
78+
- an array of initialized signer data in the out-pointer `signers`
79+
- a commitment `H(R_i)` to a nonce in the out-pointer `nonce_commitment32`
80+
It takes as input
81+
- a unique session ID `session_id32`
82+
- (optionally) a message to be signed `msg32`
83+
- the combined public key output from `secp256k1_musig_pubkey_combine`
84+
- the public key hash output from `secp256k1_musig_pubkey_combine`
85+
- the signer's index `i` `my_index`
86+
- the signer's secret key `seckey`
87+
2. The signer then communicates `H(R_i)` to all other signers, and receives
88+
commitments `H(R_j)` from all other signers `j`. These hashes are simply
89+
length-32 byte arrays which can be communicated however is communicated.
90+
3. Once all signers nonce commitments have been received, the signer records
91+
these commitments with the function `secp256k1_musig_session_get_public_nonce`.
92+
This function updates in place
93+
- the session state `session`
94+
- the array of signer data `signers`
95+
taking in as input the list of commitments `commitments` and outputting the
96+
signer's public nonce `R_i` in the out-pointer `nonce`.
97+
4. The signer then communicates `R_i` to all other signers, and receives `R_j`
98+
from each signer `j`. On receipt of a nonce `R_j` he calls the function
99+
`secp256k1_musig_set_nonce` to record this fact. This function checks that
100+
the received nonce is consistent with the previously-received nonce and will
101+
return 0 in this case. The signer must also call this function with his own
102+
nonce and his own index `i`.
103+
These nonces `R_i` are secp256k1 public keys; they should be serialized using
104+
`secp256k1_ec_pubkey_serialize` and parsed with `secp256k1_ec_pubkey_parse`.
105+
5. Once all nonces have been exchanged in this way, signers are able to compute
106+
their partial signatures. They do so by calling `secp256k1_musig_session_combine_nonces`
107+
which updates in place
108+
- the session state `session`
109+
- the array of signer data `signers`
110+
It outputs an auxilary integer `nonce_is_negated` and has an auxilary input
111+
`adaptor`. Both of these may be set to NULL for ordinary signing purposes.
112+
If the signer did not provide a message to `secp256k1_musig_session_initialize`,
113+
a message must be provided now by calling `secp256k1_musig_session_set_msg` which
114+
updates the session state in place.
115+
6. The signer computes a partial signature `s_i` using the function
116+
`secp256k1_musig_partial_sign` which takes the session state as input and
117+
partial signature as output.
118+
7. The signer then communicates the partial signature `s_i` to all other signers, or
119+
to a central coordinator. These partial signatures should be serialized using
120+
`musig_partial_signature_serialize` and parsed using `musig_partial_signature_parse`.
121+
8. Each signer calls `secp256k1_musig_partial_sig_verify` on the other signers' partial
122+
signatures to verify their correctness. If only the validity of the final signature
123+
is important, not assigning blame, this step can be skipped.
124+
9. Any signer, or central coordinator, may combine the partial signatures to obtain
125+
a complete signature using `secp256k1_musig_partial_sig_combine`. This function takes
126+
a signing session and array of MuSig partial signatures, and outputs a single
127+
Schnorr signature.
128128

129129
### Non-signing Participant
130130

131131
A participant who wants to verify the signing process, i.e. check that nonce commitments
132132
are consistent and partial signatures are correct without contributing a partial signature,
133133
may do so using the above instructions except for the following changes:
134134

135-
1. A signing session should be produced using `musig_session_initialize_verifier`
136-
rather than `musig_session_initialize`; this function takes no secret data or
137-
signer index.
138-
2. The participant receives nonce commitments, public nonces and partial signatures,
139-
but does not produce these values. Therefore `secp256k1_musig_session_get_public_nonce`
140-
and `secp256k1_musig_partial_sign` are not called.
135+
1. A signing session should be produced using `musig_session_initialize_verifier`
136+
rather than `musig_session_initialize`; this function takes no secret data or
137+
signer index.
138+
2. The participant receives nonce commitments, public nonces and partial signatures,
139+
but does not produce these values. Therefore `secp256k1_musig_session_get_public_nonce`
140+
and `secp256k1_musig_partial_sign` are not called.
141141

142142
### Verifier
143143

@@ -149,12 +149,12 @@ public key output from `secp256k1_musig_pubkey_combine`.
149149

150150
The signing API supports the production of "adaptor signatures", modified partial signatures
151151
which are offset by an auxiliary secret known to one party. That is,
152-
1. One party generates a (secret) adaptor `t` with corresponding (public) adaptor `T = t*G`.
153-
2. When combining nonces, each party adds `T` to the total nonce used in the signature.
154-
3. The party who knows `t` must "adapt" their partial signature with `t` to complete the
155-
signature.
156-
4. Any party who sees both the final signature and the original partial signatures
157-
can compute `t`.
152+
1. One party generates a (secret) adaptor `t` with corresponding (public) adaptor `T = t*G`.
153+
2. When combining nonces, each party adds `T` to the total nonce used in the signature.
154+
3. The party who knows `t` must "adapt" their partial signature with `t` to complete the
155+
signature.
156+
4. Any party who sees both the final signature and the original partial signatures
157+
can compute `t`.
158158

159159
Using these adaptor signatures, two 2-of-2 MuSig signing protocols can be executed in
160160
parallel such that one party's partial signatures are made atomic. That is, when the other
@@ -165,32 +165,32 @@ Such a protocol can be executed as follows. Consider two participants, Alice and
165165
are simultaneously producing 2-of-2 multisignatures for two blockchains A and B. They act
166166
as follows.
167167

168-
1. Before the protocol begins, Bob chooses a 32-byte auxiliary secret `t` at random and
169-
computes a corresponding public point `T` by calling `secp256k1_ec_pubkey_create`.
170-
He communicates `T` to Alice.
171-
2. Together, the parties execute steps 1-4 of the signing protocol above.
172-
3. At step 5, when combining the two parties' public nonces, both parties call
173-
`secp256k1_musig_session_combine_nonces` with `adaptor` set to `T` and `nonce_is_negated`
174-
set to a non-NULL pointer to int.
175-
4. Steps 6 and 7 proceed as before. Step 8, verifying the partial signatures, is now
176-
essential to the security of the protocol and must not be omitted!
168+
1. Before the protocol begins, Bob chooses a 32-byte auxiliary secret `t` at random and
169+
computes a corresponding public point `T` by calling `secp256k1_ec_pubkey_create`.
170+
He communicates `T` to Alice.
171+
2. Together, the parties execute steps 1-4 of the signing protocol above.
172+
3. At step 5, when combining the two parties' public nonces, both parties call
173+
`secp256k1_musig_session_combine_nonces` with `adaptor` set to `T` and `nonce_is_negated`
174+
set to a non-NULL pointer to int.
175+
4. Steps 6 and 7 proceed as before. Step 8, verifying the partial signatures, is now
176+
essential to the security of the protocol and must not be omitted!
177177

178178
The above steps are executed identically for both signing sessions. However, step 9 will
179179
not work as before, since the partial signatures will not add up to a valid total signature.
180180
Additional steps must be taken, and it is at this point that the two signing sessions
181181
diverge. From here on we consider "Session A" which benefits Alice (e.g. which sends her
182182
coins) and "Session B" which benefits Bob (e.g. which sends him coins).
183183

184-
5. In Session B, Bob calls `secp256k1_musig_partial_sig_adapt` with his partial signature
185-
and `t`, to produce an adaptor signature. He can then call `secp256k1_musig_partial_sig_combine`
186-
with this adaptor signature and Alice's partial signature, to produce a complete
187-
signature for blockchain B.
188-
6. Alice reads this signature from blockchain B. She calls `secp256k1_musig_extract_secret_adaptor`,
189-
passing the complete signature along with her and Bob's partial signatures from Session B.
190-
This function outputs `t`, which until this point was only known to Bob.
191-
7. In Session A, Alice is now able to replicate Bob's action, calling
192-
`secp256k1_musig_partial_sig_adapt` with her own partial signature and `t`, ultimately
193-
producing a complete signature on blockchain A.
184+
5. In Session B, Bob calls `secp256k1_musig_partial_sig_adapt` with his partial signature
185+
and `t`, to produce an adaptor signature. He can then call `secp256k1_musig_partial_sig_combine`
186+
with this adaptor signature and Alice's partial signature, to produce a complete
187+
signature for blockchain B.
188+
6. Alice reads this signature from blockchain B. She calls `secp256k1_musig_extract_secret_adaptor`,
189+
passing the complete signature along with her and Bob's partial signatures from Session B.
190+
This function outputs `t`, which until this point was only known to Bob.
191+
7. In Session A, Alice is now able to replicate Bob's action, calling
192+
`secp256k1_musig_partial_sig_adapt` with her own partial signature and `t`, ultimately
193+
producing a complete signature on blockchain A.
194194

195195
[1] https://eprint.iacr.org/2018/068
196196

0 commit comments

Comments
 (0)