::

  ZIP: 312
  Title: FROST for Spend Authorization Multisignatures
  Owners: Conrado Gouvea <conrado@zfnd.org>
          Daira-Emma Hopwood <daira-emma@electriccoin.co>
  Original-Authors: Chelsea Komlo
                    Deirdre Connolly
  Status: Draft
  Category: Wallet
  Created: 2022-08-01
  License: MIT
  Discussions-To: <https://github.com/zcash/zips/issues/382>
  Pull-Request: <https://github.com/zcash/zips/pull/662>
                <https://github.com/zcash/zips/pull/895>


Terminology
===========

The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",
"NOT RECOMMENDED", and "MAY" in this document are to be interpreted as described
in BCP 14 [#BCP14]_ when, and only when, they appear in all capitals.

The term "Recovery Protocol" in this document is to be interpreted as described
in [#zip-2005]_.

The term below is to be interpreted as follows:

Unlinkability
  The property of statistical independence of signatures from the
  signers' long-term keys, ensuring that (for perfectly uniform
  generation of Randomizers and no leakage of metadata) it is
  impossible to determine whether two transactions were generated
  by the same party.


Abstract
========

This proposal adapts FROST [#FROST]_, a threshold signature scheme, to make it
support key re-randomization as described in [#protocol-abstractsigrerand]_.
This is a requirement in order for it to be used to implement unlinkable spend
authorization signatures in the Orchard and Sapling shielded protocols, as
deployed in Zcash.


Motivation
==========

In the Zcash protocol, Spend Authorization Signatures are employed to authorize
a transaction. The ability to generate these signatures with the user's private
key is what effectively allows the user to spend funds.

This is a security-critical step, since anyone who obtains access to the private
key will be able to spend the user's funds. For this reason, one interesting
possibility is to ensure that authorization from multiple parties is needed in
order for the transaction to go through. This can be accomplished with threshold
signatures, where the private key is split between parties (or generated already
split using a distributed protocol) in such a way that a threshold (e.g. 2 out
of 3) of them must sign the transaction in order to create the final signature.
This enables scenarios such as users and third-party services sharing custody of
a wallet, or a group of people managing shared funds, for example.

FROST is one of such threshold signature protocols. However, it can't be used
as-is since the Zcash protocol also requires re-randomizing public and private
keys to ensure unlinkability between transactions. This ZIP specifies a variant
of FROST with re-randomization support. This variant is named "Re-Randomized
FROST" and has been described in [#frost-rerandomized]_.


Requirements
============

- All signatures generated by following this ZIP must be verified successfully
  as Sapling or Orchard spend authorization signatures using the appropriate
  validating key.
- The signatures generated by following this ZIP should meet the security
  criteria for Signature with Re-Randomizable Keys as specified in the Zcash
  protocol [#protocol-concretereddsa]_.
- The threat model described below must be taken into account.
- The key generation must be compatible with Quantum Recoverability
  [#zip-2005]_.

Threat Model
------------

In normal usage, a Zcash user follows multiple steps in order to generate a
shielded transaction:

- The transaction is created.
- The transaction is signed with a re-randomized version of the user's spend
  authorization private key.
- The zero-knowledge proof for the transaction is created with the randomizer
  as an auxiliary (secret) input, among others.

When employing re-randomizable FROST as specified in this ZIP, the goal is to
split the spend authorization private key $\mathsf{ask}$ among multiple possible
signers. This means that the proof generation will still be performed by a
single participant, likely the one that created the transaction in the first
place. Note that this user already controls the privacy of the transaction since
they are responsible for creating the proof.

This fits well into the "Coordinator" role from the FROST specification
[#frost-protocol]_. The Coordinator is responsible for sending the message to be
signed to all participants, and to aggregate the signature shares.

With those considerations in mind, the threat model considered in this ZIP is:

- The Coordinator is trusted with the privacy of the transaction (which includes
  the unlinkability property). A rogue Coordinator will be able to break
  unlinkability and privacy, but should not be able to create signed
  transactions without the approval of ``MIN_PARTICIPANTS`` participants, as
  specified in FROST.
- All key share holders are also trusted with the privacy of the transaction,
  thus a rogue key share holder will be able to break its privacy and
  unlinkability.

Caveats concerning the security model for use of FROST keys in a Quantum
Recovery protocol are covered in [#zip-2005-usage-with-frost]_.


Non-requirements
================

- This ZIP does not support removing the Coordinator role, as described in
  [#frost-removingcoordinator]_.
- This ZIP does not prevent key share holders from linking the signing operation
  to a transaction in the blockchain.
- Like the FROST specification [#FROST]_, this ZIP does not require a particular
  key generation procedure, although it does suggest one.
- Network privacy is not in scope for this ZIP, and must be obtained with other
  tools if desired.


Specification
=============

Algorithms in this section are specified using Python pseudo-code, in the same
fashion as the FROST specification [#FROST]_.

We define the following as in [#FROST]_ for a specific FROST ciphersuite:

* Let $G$ be a group of prime order $p$ as described in [#frost-primeordergroup]_,
  with element type $\mathtt{Element}$, identity $I \;{\small ⦂}\; \mathtt{Element}$,
  base element $B \;{\small ⦂}\; \mathtt{Element}$ where $B \neq I$, and scalar type
  $\mathtt{Scalar} = \mathbb{F}_p$.
* Let $\mathtt{Ne}$ and $\mathtt{Ns}$ be the sizes in bytes of a serialized Element
  representation and Scalar representation, respectively.
* Let functions $\mathsf{Scalar} \;{\small ⦂}\; \{ 0 .. p-1 \} \rightarrow \mathtt{Scalar}$,
  $\mathsf{RandomScalar} \;{\small ⦂}\; () \stackrel{\tiny\mathrm{R}}{\rightarrow} \mathtt{Scalar}$,
  $\mathsf{ScalarMult} \;{\small ⦂}\; \mathtt{Element} \times \mathtt{Scalar} \rightarrow \mathtt{Element}$,
  $\mathsf{ScalarBaseMult} \;{\small ⦂}\; \mathtt{Scalar} \rightarrow \mathtt{Element}$,
  $\mathsf{SerializeElement} \;{\small ⦂}\; \mathtt{Element} \rightarrow \mathbb{B}^{{\kern-0.05em\tiny\mathbb{Y}}[\mathtt{Ne}]}$,
  $\mathsf{DeserializeElement} \;{\small ⦂}\; \mathbb{B}^{{\kern-0.05em\tiny\mathbb{Y}}[\mathtt{Ne}]} \rightarrow \mathtt{Element} \cup \{ \bot \}$,
  $\mathsf{SerializeScalar} \;{\small ⦂}\; \mathtt{Scalar} \rightarrow \mathbb{B}^{{\kern-0.05em\tiny\mathbb{Y}}[\mathtt{Ns}]}$,
  $\mathsf{DeserializeScalar} \;{\small ⦂}\; \mathbb{B}^{{\kern-0.05em\tiny\mathbb{Y}}[\mathtt{Ns}]} \rightarrow \mathtt{Scalar} \cup \{ \bot \}$
  also be as described in [#frost-primeordergroup]_ (where "raising an error"
  corresponds to returning $\bot$).

Note that the notation for elliptic-curve scalar multiplication,
$\mathsf{G.ScalarMult}(P, k)$, differs from that used in the Zcash Protocol
Specification, which would use $[k]\, P$ with the group implied by $P$
[#protocol-abstractgroup]_.


Key Generation
--------------

FROST key generation with a trusted dealer is described in [#frost-tdkg]_. That
description does not support key re-randomization but can be adapted to do so,
as described in section 5 of [#frost-rerandomized]_.

.. warning::
    Trusted dealer key generation has the severe disadvantage that it requires
    absolutely trustworthy hardware and software to be used by the dealer in
    order to reliably avoid exposing the private key material. That is, it is
    not sufficient simply to have an individual or organization that is trusted
    by all participants; their entire hardware and software stack also needs to
    be trusted by all participants.

    Since this will often be an unrealistic assumption that partly defeats the
    point of using a threshold signature scheme, trusted dealer key generation
    SHOULD NOT be used.

Instead, it is RECOMMENDED to instead use Distributed Key Generation.

A suitable DKG protocol is COCKTAIL-DKG [#cocktail-dkg]_.
COCKTAIL-DKG assumes that each participant has a static public key known to all
other participants.

The DKG MUST be run over the same group and base point as the FROST ciphersuite
that will use its output: $\mathcal{G}^{\mathsf{Orchard}}$ for
FROST(Pallas, BLAKE2b-512) and $\mathcal{G}^{\mathsf{Sapling}}$ for
FROST(Jubjub, BLAKE2b-512). Otherwise the group public key that the DKG outputs
is not $[\mathsf{ask}]\, \mathcal{G}$ for the shared $\mathsf{ask}$, and is not
a valid $\mathsf{ak}$ for the key shares.

.. note::
    At the time of writing, the published test vectors of the
    ``COCKTAIL(Pallas, BLAKE2b-512)`` ciphersuite of COCKTAIL-DKG, which are
    stated to be current as of v0.2.0 of that specification, are computed over
    the Pallas generator $(-1, 2)$, not over
    $\mathcal{G}^{\mathsf{Orchard}}$, so the output of that ciphersuite cannot
    be used with this ZIP unchanged. A COCKTAIL-DKG ciphersuite over
    $\mathcal{G}^{\mathsf{Orchard}}$ (and one over $\mathcal{G}^{\mathsf{Sapling}}$)
    needs to be defined, either by COCKTAIL-DKG or by this ZIP; this is an open
    issue.

When COCKTAIL-DKG is used, the FROST identifier of participant $i$, for
$1 \leq i \leq n$, is the $\mathtt{Scalar}$ with value $i$.

Other Distributed Key Generation protocols MAY be used.

To define a spending or viewing key that uses FROST, the Orchard and Sapling key
trees [#protocol-orchardkeycomponents]_ [#protocol-saplingkeycomponents]_ are
adjusted as follows:

- The Spend validating key $\mathsf{ak}$ is replaced by the FROST group
  public key `PK` [#frost-protocol]_ when deriving other key components.
- The Spend authorizing key $\mathsf{ask}$ [#protocol-spendauthsig]_ is
  replaced by the logical signing key that corresponds to the group public key
  `PK`. By design, this key is never explicitly constructed (unless trusted
  dealer key generation was used), and instead is represented by any sufficient
  subset of the participant FROST signing key shares `sk_i`.

For both Orchard and Sapling, use of Distributed Key Generation precludes
generating $\mathsf{ask}$ from a spending key $\mathsf{sk}$. Instead the
Distributed Key Generation protocol will output the FROST group public key `PK`
(equivalent to $\mathsf{ak}$).

The remaining parts of the Orchard or Sapling key tree are still derived
from $\mathsf{sk}$ (not to be confused with the FROST signing key shares
$\mathtt{sk\_i}$) as described later in this section.

For the Orchard protocol, § 4.2.3 ‘Orchard Key Components’
[#protocol-orchardkeycomponents]_ requires the last bit (the $\tilde{y}$ bit)
of $\mathsf{repr}_{\mathbb{P}}(\mathsf{ak}^{\mathbb{P}})$ to be $0$. So when
the FROST(Pallas, BLAKE2b-512) ciphersuite is used, after key generation by
either method, if the last bit of $\mathsf{SerializeElement}$(`PK`) is $1$ then
$\mathtt{PK}$ MUST be replaced by $-\mathtt{PK}$, every signing key share
$\mathtt{sk\_i}$ MUST be replaced by $-\mathtt{sk\_i}$, and every public
verifying share $\mathtt{PK\_i}$ MUST be replaced by $-\mathtt{PK\_i}$. Each
participant can perform this replacement locally, since negation preserves the
relation between the shares and the group key. Values recomputed later from the
DKG transcript (for example when a participant restores its key material, or
recomputes a verifying share) are the values before this replacement, so the
replacement MUST be applied again whenever they are recomputed.

When generating FROST key components for the Orchard shielded protocol, the
remaining parts of the Orchard key tree apart from $\mathsf{ask}$ and
$\mathsf{ak}$ SHOULD be generated as described in [#zip-2005-usage-with-frost]_.
The specification there is normative, and is only summarized here. It requires
the participants to privately agree on a value $\mathsf{sk}$ (which is no longer
sufficient by itself for spend authorization), and then use it to obtain the
nullifier deriving key $\mathsf{nk}$, the quantum spending key $\mathsf{qsk}$,
the quantum intermediate key $\mathsf{qk}$, and (using the FROST group public
key in place of $\mathsf{ak}$) $\mathsf{rivk\_ext}$. This process is specified
in § 4.2.3 ‘Orchard Key Components’ [#protocol-orchardkeycomponents]_ as
modified by [#zip-2005-usage-with-frost]_.

Similarly, when generating a FROST key for the Sapling shielded protocol, the
remaining parts of the Sapling key tree apart from $\mathsf{ask}$ and
$\mathsf{ak}$ (that is, $\mathsf{nk}$, $\mathsf{rivk\_ext}$, and further values
derived from them and $\mathsf{ak}$) SHOULD be generated from a common value
$\mathsf{sk}$ (again, not sufficient by itself for spend authorization) as
described in [#protocol-saplingkeycomponents]_.

Regardless of how the Orchard or Sapling key components are generated, the
participants MUST ensure that they have obtained the same values for
$\mathsf{ak}$, $\mathsf{nk}$, and $\mathsf{rivk\_ext}$.

Since Sapling will not be modified to support Quantum Recoverability
[#zip-2005]_, Orchard is RECOMMENDED for new FROST keys.

In order for all participants to agree on the value of $\mathsf{sk}$, one
of the following options SHOULD be used:

- Participants generate a $\mathsf{sk}$ in a contributory manner, for example
  using the method defined in `Contributory Generation of sk`_. This approach
  SHOULD be used to generate $\mathsf{sk}$ if Distributed Key Generation was
  employed.
- One participant generates a random $\mathsf{sk}$ and sends it to the
  others via an encrypted and authenticated channel. This option SHOULD be used
  if trusted dealer key generation was used, and the $\mathsf{sk}$ value
  can be sent along with the FROST shares during key generation. This option is
  NOT RECOMMENDED if Distributed Key Generation was employed.


Randomizer Generation
---------------------

Re-Randomized FROST uses randomizers. This section specifies how they are
generated; this will be required for the Signature Share Generation
specification below.

Two functions are provided to generate randomizers: `randomizer_generate()` and
`randomizer_regenerate()`. Both use helper functions and a constant which are
defined as follows:

- The `encode_group_commitment_list()` function is defined in
  [#frost-listoperations]_. It returns a byte serialization of a
  `commitment_list` value.
- The `random_bytes(n)` function is defined in [#frost-conventions]_ and it
  returns a sequence of `n` bytes sampled uniformly at random.
- The `HR(m)` function is a ciphersuite-generic function that maps an arbitrary
  byte string to a scalar and is instantiated in the `Ciphersuites`_ section.

::

  randomizer_generate():

  Inputs:
  - commitment_list = [(i, hiding_nonce_commitment_i,
    binding_nonce_commitment_i), ...], a list of commitments issued by
    each participant, where each element in the list indicates a
    NonZeroScalar identifier i and two commitment Element values
    (hiding_nonce_commitment_i, binding_nonce_commitment_i). This list
    MUST be sorted in ascending order by identifier.

  Outputs: (randomizer_seed, randomizer), a byte sequence and a Scalar

  def randomizer_generate(commitment_list):
    # Generate a random byte sequence with the size of a serialized scalar.
    randomizer_seed = random_bytes(Ns)
    signing_commitments_enc = encode_group_commitment_list(commitment_list)
    randomizer_input = randomizer_seed || signing_commitments_enc
    return (randomizer_seed, HR(randomizer_input))

::

  randomizer_regenerate():

  Inputs:
  - randomizer_seed = a sequence of Ns bytes
  - commitment_list = [(i, hiding_nonce_commitment_i,
    binding_nonce_commitment_i), ...], a list of commitments issued by
    each participant, where each element in the list indicates a
    NonZeroScalar identifier i and two commitment Element values
    (hiding_nonce_commitment_i, binding_nonce_commitment_i). This list
    MUST be sorted in ascending order by identifier.

  Outputs: randomizer, a Scalar

  def randomizer_regenerate(randomizer_seed, commitment_list):
    signing_commitments_enc = encode_group_commitment_list(commitment_list)
    randomizer_input = randomizer_seed || signing_commitments_enc
    return HR(randomizer_input)


Re-Randomized FROST
-------------------

To add re-randomization to FROST, the signers MUST follow the specification
[#FROST]_ with the following modifications.


Round One - Commitment
''''''''''''''''''''''

Round One is exactly the same as specified [#FROST]_. But for context, it
involves these steps:

- Each signer generates nonces and their corresponding public commitments. A
  nonce is a pair of $\mathtt{Scalar}$ values, and a commitment is a pair of
  $\mathtt{Element}$ values.
- The nonces are stored locally by the signer and kept private for use in the
  second round.
- The commitments are sent to the Coordinator.


Round Two - Signature Share Generation
''''''''''''''''''''''''''''''''''''''

In Round Two of regular FROST, the Coordinator picks a message and sends it to
each signer along with the commitments received in Round One. In Re-Randomized
FROST, the Coordinator MUST additionally call $\mathtt{randomizer\_generate}()$
and send the $\mathtt{randomizer\_seed}$ along with the message and the
commitments. Each participant, upon receiving those values, MUST compute
$\mathtt{randomizer}$ by calling $\mathtt{randomizer\_regenerate}()$ with the
received $\mathtt{randomizer\_seed}$ and commitments.

In Zcash, the message that needs to be signed is the SIGHASH transaction hash.
This by itself does not convey enough information for the signers to decide
whether they want to authorize the transaction or not. Therefore, in addition
to the serialized transaction, more data (such as openings of value commitments,
decryption of note ciphertexts, etc.) needs to be sent from the Coordinator to
the signers. This SHOULD be done by sending a Partially Constructed Zcash Transaction
[#zip-0374]_ over the same encrypted, authenticated channel. In order to sign,
each signer MUST be satisfied that the transaction should be authorized, using
the additional information provided in the PCZT where necessary. That information
MUST be checked for consistency with the transaction and not trusted simply
because the Coordinator is providing it.

Each participant is a Signer in the sense of [#zip-0374-signer]_, and MUST
perform the checks that ZIP 374 requires of a Signer before signing. In
particular, each participant MUST compute the SIGHASH from its own copy of the
PCZT, and MUST NOT sign any other message.

Because the SIGHASH commits to the randomized validating key, which depends on
the $\mathtt{randomizer}$, the Coordinator MUST complete Round One and derive
the $\mathtt{randomizer}$ from its commitments before finalizing the PCZT.
ZIP 374 describes the randomizer as chosen by the Constructor; for a FROST
signing session, the Constructor is the Coordinator, and its choice is the
derivation specified above.

A transaction with several spends of the same FROST key needs one signature per
spend, each under its own randomized validating key. This applies to every
spend whose spend authorization signature is made with the FROST key, whatever
the value of the note spent: a transaction builder can add a zero-valued spend
of the FROST key, for example to pair it with an output, and that spend needs a
signature like any other. It does not apply to dummy spends, which are signed
with their own spend authorizing keys.

Each spend MUST use its own signing session, with its own nonces, commitments,
$\mathtt{randomizer\_seed}$ and $\mathtt{randomizer}$. Each message of a
session MUST identify the session it belongs to, so that the commitments and
the signature share of one spend cannot be taken for those of another. Since
the SIGHASH commits to every randomized validating key, the Coordinator MUST
complete Round One of every session before it derives any
$\mathtt{randomizer}$.

A participant MUST NOT use related or repeated nonces in multiple sessions
(including sessions for the same transaction), because that could allow an
attack on the signing key share(s).

.. raw:: html

   <details>
   <summary>Rationale (click to show/hide)</summary>

The sessions of one transaction sign the same message under different
randomized keys. Each signature share made with the same pair of nonces is
therefore one more linear equation in the two nonces and the participant's
signing key share, and enough of these equations reveal the signing key share.

.. raw:: html

   </details>

Let $\textsf{FROST.sign}$ be the regular FROST signing function with arguments
``(identifier, sk_i, group_public_key, nonce_i, msg, commitment_list)``,
as defined in [#frost-sign]_.

The $\textsf{Rerandomized-FROST.sign}$ function takes an additional input
$\mathtt{randomizer\_seed}$, and adjusts the inputs relative to the
$\mathtt{randomizer}$ computed by $\mathtt{randomizer\_regenerate}()$::

  def Rerandomized-FROST.sign(identifier, sk_i, group_public_key, nonce_i, msg,
                              commitment_list, randomizer_seed):
    randomizer = randomizer_regenerate(randomizer_seed, commitment_list)
    randomized_sk_i = sk_i + randomizer
    randomized_group_public_key = group_public_key + G.ScalarBaseMult(randomizer)
    return FROST.sign(identifier, randomized_sk_i, randomized_group_public_key,
                      nonce_i, msg, commitment_list)

The signer MAY cache $\mathtt{randomizer}$ and
$\mathsf{G.ScalarBaseMult}(\mathtt{randomizer})$ for use in the
$\textsf{Rerandomized-FROST.}$ {aggregate, verify_signature_share}
functions defined below.


Signature Share Verification and Aggregation
''''''''''''''''''''''''''''''''''''''''''''

Let $\textsf{FROST.aggregate}$ be the regular FROST aggregation function with
arguments ``(commitment_list, msg, group_public_key, sig_shares)``, as defined
in [#frost-aggregate]_.

The $\textsf{Rerandomized-FROST.aggregate}$ function takes an additional input
$\mathtt{randomizer}$ computed as above, and adjusts the inputs relative to this
randomizer::

 def Rerandomized-FROST.aggregate(commitment_list, msg, group_public_key, sig_shares,
                                  randomizer):
   randomized_group_public_key = group_public_key + G.ScalarBaseMult(randomizer)
   return FROST.aggregate(commitment_list, msg, randomized_group_public_key, sig_shares)

Similarly, let $\textsf{FROST.verify\_signature\_share}$ be the regular FROST signature
share verification function with arguments
``(identifier, PK_i, comm_i, sig_share_i, commitment_list, group_public_key, msg)``,
as defined also in [#frost-aggregate]_.

The $\textsf{Rerandomized-FROST.verify\_signature\_share}$ function takes an
additional input $\mathtt{randomizer}$ computed as above, and adjusts the inputs
relative to this randomizer::

  def Rerandomized-FROST.verify_signature_share(identifier, PK_i, comm_i, sig_share_i,
                                                commitment_list, group_public_key, msg,
                                                randomizer):
    group_offset = G.ScalarBaseMult(randomizer)
    randomized_PK_i = PK_i + group_offset
    randomized_group_public_key = group_public_key + group_offset
    return FROST.verify_signature_share(identifier, randomized_PK_i, comm_i, sig_share_i,
                                        commitment_list, randomized_group_public_key, msg)


Contributory Generation of sk
-----------------------------

The contributory generation of $\mathsf{sk}$ uses the application payloads and
the application-specific extension of COCKTAIL-DKG [#cocktail-dkg]_. Payloads
are encrypted to their recipients and are not part of the transcript; the
extension is part of the transcript, which is public.

Let $n$ be the number of participants, with identifiers $1 \leq i \leq n$.
Define:

- $\mathsf{H_{sk}}(m)$ as BLAKE2b-256 [#BLAKE]_ with the personalization string
  ``"ZcashFROST_sk_v1"`` applied to $m$;
- $\mathsf{H_{commit}}(m)$ as BLAKE2b-256 with the personalization string
  ``"ZcashFROST_skcmt"`` applied to $m$.

The participants proceed as follows:

- In Round 1, each participant $i$ generates a contribution
  ``contrib_i = random_bytes(32)``, and sets
  $\mathsf{payload}_{i,j} = \mathtt{contrib\_i}$ for every participant $j$,
  including $j = i$. The contribution is unrelated to the participant's FROST
  signing key share `sk_i`, which is never sent.
- After decrypting its Round 2 payloads, each participant computes
  ``sk = H_sk(contrib_1 || contrib_2 || ... || contrib_n)``, with the
  contributions in ascending order of participant identifier. Each contribution
  is exactly 32 bytes, so no length prefixes are needed. A participant MUST
  abort, without signing the transcript, if any decrypted payload is not
  exactly 32 bytes.
- In Round 3, each participant uses ``ext = H_commit(sk)`` as the extension.

The extension is covered by the signatures that every participant makes in
Round 3, so the protocol completes only if all participants computed the same
$\mathsf{sk}$. Since $\mathsf{sk}$ has 256 bits of entropy that is unknown
outside the group, the extension reveals nothing about it. $\mathsf{sk}$ itself
MUST NOT be placed in the extension or anywhere else in the transcript.

.. note::
    COCKTAIL-DKG encrypts payloads with keys derived by elliptic-curve
    Diffie–Hellman. An adversary that records the Round 1 messages or the
    Round 2 broadcast and later obtains a cryptographically relevant quantum
    computer can decrypt them, learn $\mathsf{sk}$, and derive $\mathsf{qsk}$
    from it, which defeats Quantum Recoverability [#zip-2005]_ for that key.
    Implementations SHOULD NOT retain those messages after the ceremony, and
    SHOULD NOT include them in stored recovery data; the transcript, which does
    not contain them, suffices to verify the ceremony. This does not protect
    against a party that records the messages in transit. Quantum-resistant
    encryption of the payloads is an open issue for this ZIP.

    This departs from the backup requirements of COCKTAIL-DKG, whose recovery
    procedure needs the Round 1 ciphertexts addressed to the participant. A
    participant SHOULD instead back up its signing key share and $\mathsf{sk}$
    directly. The transcript and the success certificate contain no secret and
    can be kept with them.

    If the transcript is available on restore, the participant MUST check the
    signing key share against its public verifying share computed from the
    transcript, and $\mathsf{H_{commit}}(\mathsf{sk})$ against the extension.
    Otherwise, $\mathsf{sk}$ can be checked against the $\mathsf{nk}$ and
    $\mathsf{rivk\_ext}$ of the group's full viewing key, and a wrong signing
    key share is detected when the participant first signs, since its signature
    share fails verification.

    Since $\mathsf{qsk}$ can be derived from $\mathsf{sk}$, such a backup MUST
    be protected at least as securely as $\mathsf{qsk}$
    [#zip-2005-usage-with-frost]_. If it is stored or transmitted encrypted,
    the encryption SHOULD NOT rely only on the hardness of discrete logarithms.


Ciphersuites
------------

FROST(Jubjub, BLAKE2b-512)
''''''''''''''''''''''''''

This ciphersuite uses Jubjub for the Group and BLAKE2b-512 for the Hash function
$\mathtt{H}$ meant to produce signatures indistinguishable from RedJubjub
Sapling Spend Authorization Signatures as specified in [#protocol-concretespendauthsig]_.

- Group: Jubjub [#protocol-jubjub]_ with base point $\mathcal{G}^{\mathsf{Sapling}}$
  as defined in [#protocol-concretespendauthsig]_.

  - Order: $r_{\mathbb{J}}$ as defined in [#protocol-jubjub]_.
  - Identity: as defined in [#protocol-jubjub]_.
  - $\mathsf{RandomScalar}()$: Implemented by returning a uniformly random
    $\mathtt{Scalar}$ in the range $[0, \mathsf{G.Order}() - 1]$. Refer to
    [#frost-randomscalar]_ for implementation guidance.
  - $\mathsf{SerializeElement}(P)$: Implemented as
    $\mathsf{repr}_{\mathbb{J}}(P)$ as defined in [#protocol-jubjub]_.
  - $\mathsf{DeserializeElement}(P)$: Implemented as
    $\mathsf{abst}_{\mathbb{J}}(P)$ as defined in [#protocol-jubjub]_, returning
    an error if $\bot$ is returned. Additionally, this function validates that
    the resulting element is in the subgroup of order $r_{\mathbb{J}}$ and is
    not the group identity element, returning an error if either check fails.
  - $\mathsf{SerializeScalar}$: Implemented by outputting the little-endian
    32-byte encoding of the $\mathtt{Scalar}$ value.
  - $\mathsf{DeserializeScalar}$: Implemented by attempting to deserialize a
    $\mathtt{Scalar}$ from a little-endian 32-byte string. This function can
    fail if the input does not represent a $\mathtt{Scalar}$ in the range
    $[0, \mathsf{G.Order}() - 1]$.

- Hash ($\mathtt{H}$): BLAKE2b-512 [#BLAKE]_ (BLAKE2b with 512-bit output and
  16-byte personalization string), and $\mathtt{Nh} = 64$.

  - H1(m): Implemented by computing BLAKE2b-512("FROST_RedJubjubR", m), interpreting
    the 64 bytes as a little-endian integer, and reducing the resulting integer
    modulo $\mathsf{G.Order}()$.
  - H2(m): Implemented by computing BLAKE2b-512("Zcash_RedJubjubH", m), interpreting
    the 64 bytes as a little-endian integer, and reducing the resulting integer
    modulo $\mathsf{G.Order}()$.
    (This is equivalent to $\mathsf{H}^\circledast(m)$, as defined by
    the $\mathsf{RedJubjub}$ scheme instantiated in [#protocol-concretereddsa]_.)
  - H3(m): Implemented by computing BLAKE2b-512("FROST_RedJubjubN", m), interpreting
    the 64 bytes as a little-endian integer, and reducing the resulting integer
    modulo $\mathsf{G.Order}()$.
  - H4(m): Implemented by computing BLAKE2b-512("FROST_RedJubjubM", m).
  - H5(m): Implemented by computing BLAKE2b-512("FROST_RedJubjubC", m).
  - HR(m): Implemented by computing BLAKE2b-512("FROST_RedJubjubA", m), interpreting
    the 64 bytes as a little-endian integer, and reducing the resulting integer
    modulo $\mathsf{G.Order}()$.

Signature verification is as specified in [#protocol-concretespendauthsig]_
for RedJubjub.


FROST(Pallas, BLAKE2b-512)
''''''''''''''''''''''''''

This ciphersuite uses Pallas for the Group and BLAKE2b-512 for the Hash function ``H``
meant to produce signatures indistinguishable from RedPallas Orchard Spend
Authorization Signatures as specified in [#protocol-concretespendauthsig]_.
The same ciphersuite produces spend authorization signatures for actions of the
Ironwood pool [#zip-2005]_, which are also RedPallas signatures.

- Group: Pallas [#protocol-pallasandvesta]_ with base point $\mathcal{G}^{\mathsf{Orchard}}$
  as defined in [#protocol-concretespendauthsig]_.

  - Order: $r_\mathbb{P}$ as defined in [#protocol-pallasandvesta]_.
  - Identity: as defined in [#protocol-pallasandvesta]_.
  - $\mathsf{RandomScalar}()$: Implemented by returning a uniformly random
    $\mathtt{Scalar}$ in the range $[0, \mathsf{G.Order}() - 1]$. Refer to
    [#frost-randomscalar]_ for implementation guidance.
  - $\mathsf{SerializeElement}(P)$: Implemented as $\mathsf{repr}_\mathbb{P}(P)$
    as defined in [#protocol-pallasandvesta]_.
  - $\mathsf{DeserializeElement}(P)$: Implemented as $\mathsf{abst}_\mathbb{P}(P)$
    as defined in [#protocol-pallasandvesta]_, failing if $\bot$ is returned.
    Additionally, this function validates that the resulting element is not the
    group identity element, returning an error if the check fails.
  - $\mathsf{SerializeScalar}$: Implemented by outputting the little-endian
    32-byte encoding of the $\mathtt{Scalar}$ value.
  - $\mathsf{DeserializeScalar}$: Implemented by attempting to deserialize a
    $\mathtt{Scalar}$ from a little-endian 32-byte string. This function can
    fail if the input does not represent a $\mathtt{Scalar}$ in the range
    $[0, \mathsf{G.Order}() - 1]$.

- Hash ($\mathtt{H}$): BLAKE2b-512 [#BLAKE]_ (BLAKE2b with 512-bit output and
  16-byte personalization string), and $\mathtt{Nh} = 64$.

  - H1(m): Implemented by computing BLAKE2b-512("FROST_RedPallasR", m), interpreting
    the 64 bytes as a little-endian integer, and reducing the resulting integer
    modulo $\mathsf{G.Order}()$.
  - H2(m): Implemented by computing BLAKE2b-512("Zcash_RedPallasH", m), interpreting
    the 64 bytes as a little-endian integer, and reducing the resulting integer
    modulo $\mathsf{G.Order}()$.
    (This is equivalent to $\mathsf{H}^\circledast(m)$, as defined by
    the $\mathsf{RedPallas}$ scheme instantiated in [#protocol-concretereddsa]_.)
  - H3(m): Implemented by computing BLAKE2b-512("FROST_RedPallasN", m), interpreting
    the 64 bytes as a little-endian integer, and reducing the resulting integer
    modulo $\mathsf{G.Order}()$.
  - H4(m): Implemented by computing BLAKE2b-512("FROST_RedPallasM", m).
  - H5(m): Implemented by computing BLAKE2b-512("FROST_RedPallasC", m).
  - HR(m): Implemented by computing BLAKE2b-512("FROST_RedPallasA", m), interpreting
    the 64 bytes as a little-endian integer, and reducing the resulting integer
    modulo $\mathsf{G.Order}()$.

Signature verification is as specified in [#protocol-concretespendauthsig]_
for RedPallas.

Rationale
=========

FROST is a threshold Schnorr signature scheme, and Zcash Spend Authorization are
also Schnorr signatures, which allows the usage of FROST with Zcash. However,
since there is no widespread standard for Schnorr signatures, it must be ensured
that the signatures generated by the FROST variant specified in this ZIP can be
verified successfully by a Zcash implementation following its specification. In
practice this entails making sure that the generated signature can be verified
by the $\mathsf{RedDSA.Validate}$ function specified in
[#protocol-concretereddsa]_:

- The FROST signature, when split into $R$ and $S$ in the first step of
  $\mathsf{RedDSA.Validate}$, must yield the values expected by the
  function. This is ensured by defining $\mathsf{SerializeElement}$ and
  $\mathsf{SerializeScalar}$ in each ciphersuite to yield those values.

- The challenge $c$ used during FROST signing must be equal to the challenge
  $c$ computed during $\mathsf{RedDSA.Validate}$. This requires defining the
  ciphersuite H2 function as the $\mathsf{H}^\circledast(m)$ Zcash
  function in the ciphersuites, and making sure its input will be the same.
  Fortunately FROST and Zcash use the same input order ($R$, public key, message)
  so we just need to make sure that $\mathsf{SerializeElement}$ (used to compute
  the encoded public key before passing to the hash function) matches what
  $\mathsf{RedDSA.Validate}$ expects; which is possible since both $R$ and
  $\mathsf{vk}$ (the public key) are encoded in the same way as in Zcash.

- Note that $r$ (and thus $R$) will not be generated as specified in
  $\mathsf{RedDSA.Sign}$. This is not an issue however, since with Schnorr
  signatures it does not matter for the verifier how the $r$ value was chosen,
  it just needs to be a uniformly distributed random element, which is true for
  FROST.

- The above will ensure that the verification equation in
  $\mathsf{RedDSA.Validate}$ will pass, since FROST ensures the exact same
  equation will be valid as described in [#frost-primeorderverify]_.

The second step is adding the re-randomization functionality so that each FROST
signing generates a re-randomized signature:

- Anywhere the public key is used, the randomized public key must be used instead.
  This is exactly what is done in the functions defined above.
- The re-randomization must be done in each signature share generation, such
  that the aggregated signature must be valid under verification with the
  randomized public key. This is shown to be true in [#frost-rerandomized]_.

- The re-randomization procedure must be exactly the same as in
  [#protocol-concretereddsa]_ to ensure that re-randomized keys are uniformly
  distributed and signatures are unlinkable. This is also true; observe that
  $\mathtt{randomizer\_generate}()$ generates the randomizer uniformly at random as
  required by $\mathsf{RedDSA.GenRandom}$; and signature generation is compatible
  with $\mathsf{RedDSA.RandomizePrivate}$, $\mathsf{RedDSA.RandomizePublic}$,
  $\mathsf{RedDSA.Sign}$ and $\mathsf{RedDSA.Validate}$ as explained in the
  previous item.

The security of Re-Randomized FROST with respect to the security assumptions of
regular FROST is shown in [#frost-rerandomized]_.

Regarding the contributory generation of $\mathsf{sk}$: every participant learns
$\mathsf{sk}$ by design, since it is needed to derive the viewing key components.
So a participant that chooses its contribution after seeing the others', for
example by colluding with the Coordinator, can only select $\mathsf{sk}$ among
values that it could compute anyway, and gains nothing that a participant does
not already have. The commitment in the extension serves agreement, not secrecy:
it lets every participant check that all of them derived the same
$\mathsf{sk}$, without placing a value in the public transcript from which
$\mathsf{sk}$ could be recovered.

Regarding randomizer handling, in Zcash, the $\mathtt{randomizer}$ is called
$\alpha$ and is usually generated using the $\mathsf{RedDSA.GenRandom}$ function
as defined in the Zcash specification [#protocol-spendauthsig]_. Note that the
choice of $\alpha$ influences the SIGHASH computation, so it is impossible to
compute the $\mathtt{randomizer}$ based on the message (SIGHASH), as suggested
in [#frost-rerandomized]_. This is not an issue as long as the
$\mathtt{randomizer}$ is generated with the same security properties as
$\mathsf{RedDSA.GenRandom}$. We ensure that by using a very similar approach;
while the original $\mathsf{RedDSA.GenRandom}$ uses $\mathsf{H}^\circledast(T)$
where $T$ is a random byte sequence with a certain size, in this ZIP we
effectively use $\mathsf{H}^\circledast(T || \mathsf{signing\_commitments\_enc})$,
i.e. we concatenate the random bytes with the encoding of the signing
commitments. This preserves the security assumptions and also hedges against
issues in the Coordinator random byte generator and prevents the Coordinator
from fully influencing the randomizer, reducing its trust assumptions.


Reference implementation
========================

The `frost-rerandomized` crate [#crate-frost-rerandomized]_, from version 3.0.0,
implements Re-Randomized FROST over any FROST ciphersuite, including
$\mathtt{randomizer\_generate}()$ and $\mathtt{randomizer\_regenerate}()$ as
specified here. The two ciphersuites of this ZIP are implemented in versions
0.5.x of the `reddsa` crate [#crate-reddsa]_; version 0.6.0 of that crate
removed them, and at the time of writing they are not published elsewhere.


References
==========

.. [#BCP14] `Information on BCP 14 — "RFC 2119: Key words for use in RFCs to Indicate Requirement Levels" and "RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words" <https://www.rfc-editor.org/info/bcp14>`_
.. [#BLAKE] `BLAKE2: simpler, smaller, fast as MD5 <https://blake2.net/#sp>`_
.. [#FROST] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures <https://www.rfc-editor.org/rfc/rfc9591.html>`_
.. [#frost-rerandomized] `Re-Randomized FROST (ePrint 2024/436) <https://eprint.iacr.org/2024/436>`_
.. [#frost-conventions] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Section 2: Conventions and Definitions <https://www.rfc-editor.org/rfc/rfc9591.html#name-conventions-and-definitions>`_
.. [#frost-primeordergroup] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Section 3.1: Prime-Order Group <https://www.rfc-editor.org/rfc/rfc9591.html#name-prime-order-group>`_
.. [#frost-listoperations] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Section 4.3: List Operations <https://www.rfc-editor.org/rfc/rfc9591.html#name-list-operations>`_
.. [#frost-protocol] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Section 5: Two-Round FROST Signing Protocol <https://www.rfc-editor.org/rfc/rfc9591.html#name-two-round-frost-signing-pro>`_
.. [#frost-sign] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Section 5.2: Round Two - Signature Share Generation <https://www.rfc-editor.org/rfc/rfc9591.html#name-round-two-signature-share-g>`_
.. [#frost-aggregate] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Section 5.3: Signature Share Aggregation <https://www.rfc-editor.org/rfc/rfc9591.html#name-signature-share-aggregation>`_
.. [#frost-removingcoordinator] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Section 7.5: Removing the Coordinator Role <https://www.rfc-editor.org/rfc/rfc9591.html#name-removing-the-coordinator-ro>`_
.. [#frost-primeorderverify] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Appendix B: Schnorr Signature Generation and Verification for Prime-Order Groups <https://www.rfc-editor.org/rfc/rfc9591.html#appendix-B>`_
.. [#frost-tdkg] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Appendix C: Trusted Dealer Key Generation <https://www.rfc-editor.org/rfc/rfc9591.html#name-trusted-dealer-key-generati>`_
.. [#frost-randomscalar] `RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures. Appendix D: Random Scalar Generation <https://www.rfc-editor.org/rfc/rfc9591.html#name-random-scalar-generation>`_
.. [#protocol-abstractsigrerand] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 4.1.7.1: Signature with Re-Randomizable Keys <protocol/protocol.pdf#abstractsigrerand>`_
.. [#protocol-abstractgroup] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 4.1.9: Represented Group <protocol/protocol.pdf#abstractgroup>`_
.. [#protocol-saplingkeycomponents] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 4.2.2: Sapling Key Components <protocol/protocol.pdf#saplingkeycomponents>`_
.. [#protocol-orchardkeycomponents] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 4.2.3: Orchard Key Components <protocol/protocol.pdf#orchardkeycomponents>`_
.. [#protocol-spendauthsig] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 4.15: Spend Authorization Signature (Sapling and Orchard) <protocol/protocol.pdf#spendauthsig>`_
.. [#protocol-concretereddsa] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.7: RedDSA, RedJubjub, and RedPallas <protocol/protocol.pdf#concretereddsa>`_
.. [#protocol-concretespendauthsig] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.7.1: Spend Authorization Signature (Sapling and Orchard) <protocol/protocol.pdf#concretespendauthsig>`_
.. [#protocol-jubjub] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.9.3: Jubjub <protocol/protocol.pdf#jubjub>`_
.. [#protocol-pallasandvesta] `Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.9.6: Pallas and Vesta <protocol/protocol.pdf#pallasandvesta>`_
.. [#crate-reddsa] `reddsa Rust crate <https://github.com/ZcashFoundation/reddsa>`_
.. [#crate-frost-rerandomized] `frost-rerandomized Rust crate <https://github.com/ZcashFoundation/frost/tree/main/frost-rerandomized>`_
.. [#cocktail-dkg] `COCKTAIL-DKG: Distributed Key Generation protocol for FROST, version 0.2.1 <https://c2sp.org/cocktail-dkg>`_
.. [#zip-0374] `ZIP 374: Partially Created Zcash Transaction Format <zip-0374.md>`_
.. [#zip-0374-signer] `ZIP 374: Partially Created Zcash Transaction Format — Signer <zip-0374.md#signer>`_
.. [#zip-2005] `ZIP 2005: Quantum recoverability <zip-2005.md>`_
.. [#zip-2005-usage-with-frost] `ZIP 2005: Quantum recoverability - Usage with FROST <zip-2005.md#usage-with-frost>`_
