diff --git a/zip-0032.html b/zip-0032.html index 16efaece..8bb4bbed 100644 --- a/zip-0032.html +++ b/zip-0032.html @@ -297,6 +297,15 @@ License: MIT \(m_\mathsf{Sapling}\) . +

Note that the master extended key is invalid if + \(\mathsf{ask}_m\) + is + \(0\) + , or if the corresponding + \(\mathsf{ivk}\) + derived as specified in 11 is + \(0\) + .

Sapling child key derivation

As in BIP 32, the method for deriving a child extended key, given a parent extended key and an index @@ -325,7 +334,7 @@ License: MIT \((\mathsf{nk}_{par}, \mathsf{ak}_{par}, \mathsf{ovk}_{par})\) is the full viewing key derived from \((\mathsf{ask}_{par}, \mathsf{nsk}_{par}, \mathsf{ovk}_{par})\) - as described in 11. + as described in 11.

  • Split @@ -363,13 +372,22 @@ License: MIT
  • +

    Note that the child extended key is invalid if + \(\mathsf{ask}_i\) + is + \(0\) + , or if the corresponding + \(\mathsf{ivk}\) + derived as specified in 11 is + \(0\) + .

    Deriving a child extended full viewing key

    Let \(\mathcal{G}^\mathsf{Sapling}\) - be as defined in 14 and let + be as defined in 14 and let \(\mathcal{H}^\mathsf{Sapling}\) - be as defined in 11.

    + be as defined in 11.

    \(\mathsf{CDKfvk}((\mathsf{ak}_{par}, \mathsf{nk}_{par}, \mathsf{ovk}_{par}, \mathsf{dk}_{par}, \mathsf{c}_{par}), i)\) \(\rightarrow (\mathsf{ak}_{i}, \mathsf{nk}_{i}, \mathsf{ovk}_{i}, \mathsf{dk}_{i}, \mathsf{c}_{i})\) @@ -422,10 +440,17 @@ License: MIT +

    Note that the child extended key is invalid if + \(\mathsf{ak}_i\) + is the zero point of Jubjub, or if the corresponding + \(\mathsf{ivk}\) + derived as specified in 11 is + \(0\) + .

    Sapling internal key derivation

    -

    The above derivation mechanisms produce external addresses suitable for giving out to senders. We also want to be able to produce another address derived from a given external address, for use by wallets for internal operations such as change and auto-shielding. Unlike BIP 44 that allows deriving a stream of external and internal addresses in the same hierarchical derivation tree 5, for any external full viewing key we only need to be able to derive a single internal full viewing key that has viewing authority for just internal transfers. We also need to be able to derive the corresponding internal spending key if we have the external spending key.

    +

    The above derivation mechanisms produce external addresses suitable for giving out to senders. We also want to be able to produce another address derived from a given external address, for use by wallets for internal operations such as change and auto-shielding. Unlike BIP 44 that allows deriving a stream of external and internal addresses in the same hierarchical derivation tree 5, for any external full viewing key we only need to be able to derive a single internal full viewing key that has viewing authority for just internal transfers. We also need to be able to derive the corresponding internal spending key if we have the external spending key.

    Deriving a Sapling internal spending key

    Let \((\mathsf{ask}, \mathsf{nsk}, \mathsf{ovk}, \mathsf{dk})\) @@ -435,7 +460,7 @@ License: MIT \(\mathsf{ak}\) and \(\mathsf{nk}\) - as specified in 11. + as specified in 11.

  • Let \(I = \textsf{BLAKE2b-256}(\texttt{"Zcash_SaplingInt"}, \mathsf{EncodeExtFVKParts}(\mathsf{ak}, \mathsf{nk}, \mathsf{ovk}, \mathsf{dk}))\) .
  • @@ -459,11 +484,18 @@ License: MIT \((\mathsf{ask}, \mathsf{nsk_{internal}}, \mathsf{ovk_{internal}}, \mathsf{dk_{internal}})\) . +

    Note that the child extended key is invalid if + \(\mathsf{ak}\) + is the zero point of Jubjub, or if the corresponding + \(\mathsf{ivk}\) + derived as specified in 11 is + \(0\) + .

    Deriving a Sapling internal full viewing key

    Let \(\mathcal{H}^\mathsf{Sapling}\) - be as defined in 11.

    + be as defined in 11.

    Let \((\mathsf{ak}, \mathsf{nk}, \mathsf{ovk}, \mathsf{dk})\) be the external full viewing key.

    @@ -506,7 +538,14 @@ License: MIT
    Diagram of Sapling internal key derivation

    (For simplicity, the proof authorizing key is not shown.)

    -

    This method of deriving internal keys is applied to external keys that are children of the Account level. It was implemented in zcashd as part of support for ZIP 316 8.

    +

    This method of deriving internal keys is applied to external keys that are children of the Account level. It was implemented in zcashd as part of support for ZIP 316 8.

    +

    Note that the internal extended key is invalid if + \(\mathsf{ak}\) + is the zero point of Jubjub, or if the corresponding + \(\mathsf{ivk_{internal}}\) + derived from the internal full viewing key as specified in 11 is + \(0\) + .

    Sapling diversifier derivation

    @@ -616,6 +655,7 @@ License: MIT \(\mathsf{c}_i\) . +

    Note that the resulting child spending key may produce an invalid external FVK, as specified in 12, with small probability. The corresponding internal FVK derived as specified in the next section may also be invalid with small probability.

    Orchard internal key derivation

    As in the case of Sapling, for a given external address, we want to produce another address for use by wallets for internal operations such as change and auto-shielding. That is, for any external full viewing key we need to be able to derive a single internal full viewing key that has viewing authority for just internal transfers. We also need to be able to derive the corresponding internal spending key if we have the external spending key.

    @@ -623,7 +663,10 @@ License: MIT \(\mathsf{ask}\) be the spend authorizing key if available, and let \((\mathsf{ak}, \mathsf{nk}, \mathsf{rivk})\) - be the corresponding external full viewing key, obtained as specified in 12.

    + be the corresponding external full viewing key, obtained as specified in 12.

    +

    Define + \(\mathsf{DeriveInternalFVK^{Orchard}}(\mathsf{ak}, \mathsf{nk}, \mathsf{rivk})\) + as follows:

    -

    Then the expanded internal spending key is +

    The result of applying + \(\mathsf{DeriveInternalFVK^{Orchard}}\) + to the external full viewing key is the internal full viewing key. The corresponding expanded internal spending key is \((\mathsf{ask}, \mathsf{nk}, \mathsf{rivk_{internal}})\) - , and the internal full viewing key is - \((\mathsf{ak}, \mathsf{nk}, \mathsf{rivk_{internal}})\) - .

    + ,

    Unlike Sapling internal key derivation, we do not base this internal key derivation procedure on non-hardened derivation, which is not defined for Orchard. We can obtain the desired separation of viewing authority by modifying only the \(\mathsf{rivk_{internal}}\) field relative to the external full viewing key, which results in different @@ -645,12 +691,13 @@ License: MIT \(\mathsf{ivk_{internal}}\) and \(\mathsf{ovk_{internal}}\) - fields being derived, as specified in 12 and shown in the following diagram:

    + fields being derived, as specified in 12 and shown in the following diagram:

    Diagram of Orchard internal key derivation, also showing derivation from the parent extended spending key
    -

    This method of deriving internal keys is applied to external keys that are children of the Account level. It was implemented in zcashd as part of support for ZIP 316 8.

    +

    This method of deriving internal keys is applied to external keys that are children of the Account level. It was implemented in zcashd as part of support for ZIP 316 8.

    +

    Note that the resulting FVK may be invalid, as specified in 12.

    Orchard diversifier derivation

    As with Sapling, we define a mechanism for deterministically deriving a sequence of diversifiers, without leaking how many diversified addresses have already been generated for an account. Unlike Sapling, we do so by deriving a diversifier key directly from the full viewing key, instead of as part of the extended spending key. This means that the full viewing key provides the capability to determine the position of a diversifier within the sequence, which matches the capabilities of a Sapling extended full viewing key but simplifies the key structure.

    @@ -691,7 +738,7 @@ License: MIT

    Specification: Wallet usage

    -

    Existing Zcash-supporting HD wallets all use BIP 44 5 to organize their derived keys. In order to more easily mesh with existing user experiences, we broadly follow BIP 44's design here. However, we have altered the design where it makes sense to leverage features of shielded addresses.

    +

    Existing Zcash-supporting HD wallets all use BIP 44 5 to organize their derived keys. In order to more easily mesh with existing user experiences, we broadly follow BIP 44's design here. However, we have altered the design where it makes sense to leverage features of shielded addresses.

    Key path levels

    Sapling and Orchard key paths have the following three path levels at the top, all of which use hardened derivation:

    Unlike BIP 44, none of the shielded key paths have a \(change\) @@ -735,7 +782,7 @@ License: MIT payment addresses, because each diversifier has around a 50% chance of being invalid.

    If in certain circumstances a wallet needs to derive independent spend authorities within a single account, they MAY additionally support a non-hardened \(address\_index\) - path level as in 5:

    + path level as in 5: