|
| 1 | +Notes on the frost module API |
| 2 | +=========================== |
| 3 | + |
| 4 | +The following sections contain additional notes on the API of the frost module |
| 5 | +(`include/secp256k1_frost.h`). A usage example can be found in |
| 6 | +`examples/frost.c`. |
| 7 | + |
| 8 | +# API misuse |
| 9 | + |
| 10 | +Users of the frost module must take great care to make sure of the following: |
| 11 | + |
| 12 | +1. The dealer establishes a secure communications channel with each participant |
| 13 | + and uses that channel to transmit shares during key generation. |
| 14 | +2. A unique set of coefficients per key generation session is generated in |
| 15 | + `secp256k1_frost_share_gen`. See the corresponding comment in |
| 16 | + `include/secp256k1_frost.h` for how to ensure that. |
| 17 | +3. The `pubnonces` provided to `secp256k1_frost_nonce_process` are sorted by |
| 18 | + the corresponding lexicographic ordering of the x-only pubkey of each |
| 19 | + participant, and the `pubkeys` provided to `secp256k1_frost_nonce_process` |
| 20 | + are sorted lexicographically. |
| 21 | +4. A unique nonce per signing session is generated in |
| 22 | + `secp256k1_frost_nonce_gen`. See the corresponding comment in |
| 23 | + `include/secp256k1_frost.h` for how to ensure that. |
| 24 | +5. The `secp256k1_frost_secnonce` structure is never copied or serialized. See |
| 25 | + also the comment on `secp256k1_frost_secnonce` in |
| 26 | + `include/secp256k1_frost.h`. |
| 27 | +6. Opaque data structures are never written to or read from directly. Instead, |
| 28 | + only the provided accessor functions are used. |
| 29 | +7. If adaptor signatures are used, all partial signatures are verified. |
| 30 | + |
| 31 | +# Key Generation |
| 32 | + |
| 33 | +1. A trusted dealer generates shares with `secp256k1_frost_shares_trusted_gen` |
| 34 | + and distributes a share and the public key to each participant using a |
| 35 | + secure channel. |
| 36 | + |
| 37 | +# Tweaking |
| 38 | + |
| 39 | +A (Taproot) tweak can be added to the resulting public key with |
| 40 | +`secp256k1_xonly_pubkey_tweak_add`, after converting it to an xonly pubkey if |
| 41 | +necessary with `secp256k1_xonly_pubkey_from_pubkey`. |
| 42 | + |
| 43 | +An ordinary tweak can be added to the resulting public key with |
| 44 | +`secp256k1_ec_pubkey_tweak_add`, after converting it to an ordinary pubkey if |
| 45 | +necessary with `secp256k1_frost_pubkey_get`. |
| 46 | + |
| 47 | +Tweaks can also be chained together by tweaking an already tweaked key. |
| 48 | + |
| 49 | +# Signing |
| 50 | + |
| 51 | +1. Optionally add a tweak by calling `secp256k1_frost_pubkey_tweak` and then |
| 52 | + `secp256k1_frost_pubkey_xonly_tweak_add` for a Taproot tweak and |
| 53 | + `secp256k1_frost_pubkey_ec_tweak_add` for an ordinary tweak. |
| 54 | +2. Generate a pair of secret and public nonce with `secp256k1_frost_nonce_gen` |
| 55 | + and send the public nonce to the other signers. |
| 56 | +3. Process the aggregate nonce with `secp256k1_frost_nonce_process`. |
| 57 | +4. Create a partial signature with `secp256k1_frost_partial_sign`. |
| 58 | +5. Verify the partial signatures (optional in some scenarios) with |
| 59 | + `secp256k1_frost_partial_sig_verify`. |
| 60 | +6. Someone (not necessarily the signer) obtains all partial signatures and |
| 61 | + aggregates them into the final Schnorr signature using |
| 62 | + `secp256k1_frost_partial_sig_agg`. |
| 63 | + |
| 64 | +The aggregate signature can be verified with `secp256k1_schnorrsig_verify`. |
| 65 | + |
| 66 | +Note that steps 1 to 3 can happen before the message to be signed is known to |
| 67 | +the signers. Therefore, the communication round to exchange nonces can be |
| 68 | +viewed as a pre-processing step that is run whenever convenient to the signers. |
| 69 | +This disables some of the defense-in-depth measures that may protect against |
| 70 | +API misuse in some cases. Similarly, the API supports an alternative protocol |
| 71 | +flow where generating the key (see Key Generation above) is allowed to happen |
| 72 | +after exchanging nonces (step 2). |
| 73 | + |
| 74 | +# Verification |
| 75 | + |
| 76 | +A participant who wants to verify the partial signatures, but does not sign |
| 77 | +itself may do so using the above instructions except that the verifier skips |
| 78 | +steps 2 and 4. |
0 commit comments