diff --git a/zip-0032.html b/zip-0032.html
index d02a8a27..1ef6bc1c 100644
--- a/zip-0032.html
+++ b/zip-0032.html
@@ -35,9 +35,9 @@ License: MIT
The initial parts of the specification define (mostly) equivalent, but independent, systems for deriving a tree of key components from a single seed, for the following shielded pools (which have different internal key structures):
Sapling
-
Sprout (for compatibility, effectively unused)
Orchard
+
Previous versions of this document also defined a similar derivation system for the Sprout shielded pool. This has been removed since it was never used, and is unlikely to be used given that zcashd no longer generates Sprout addresses (and neither Zebra nor the mobile SDKs have ever done so).
The last part shows how to use these trees in the context of existing BIP 44 5 wallets.
This specification complements the existing use by some Zcash wallets of BIP 32 and BIP 44 for transparent Zcash addresses, and is not intended to deprecate that usage (privacy risks of using transparent addresses notwithstanding).
@@ -187,11 +187,6 @@ License: MIT
\(i' = i + 2^{31}\)
) as in BIP 44 5:
-
- \(\mathsf{CDKsk}(\mathsf{CDKsk}(\mathsf{CDKsk}(m_\mathsf{Sprout}, a'), b), c)\)
- is written as
- \(m_\mathsf{Sprout} / a' / b / c\)
-
\(\mathsf{CDKfvk}(\mathsf{CDKfvk}(\mathsf{CDKfvk}(m_\mathsf{Sapling}, a), b), c)\)
is written as
@@ -544,100 +539,8 @@ License: MIT
is the least nonnegative integer yielding a valid diversifier.
-
Specification: Sprout key derivation
-
For completeness, we define a system for deriving a tree of Sprout key components. It is unlikely that this will garner much usage once Sapling activates, but is presented for those users who may require it.
-
Sprout extended keys
-
Due to the way Sprout keys are constructed and used, it is not possible to derive incoming viewing keys or payment addresses in parallel with spending keys. Nor is it possible to implement non-hardened derivation. We therefore only define and derive Sprout extended spending keys.
-
We represent a Sprout extended spending key as
- \((\mathsf{a_{sk}, c})\)
- , where
- \(\mathsf{a_{sk}}\)
- is the normal Sprout spending key, and
- \(\mathsf{c}\)
- is the chain code.
-
-
Sprout helper functions
-
Let
- \(\mathsf{EncodeASK}(\mathsf{a_{sk}})\)
- be the 32-byte encoding of
- \(\mathsf{a_{sk}}\)
- in the raw encoding of a Sprout spending key (excluding lead bytes) as specified in 17.
-
Let
- \(\mathsf{DecodeASK}(ASK)\)
- be the result of clearing the 4 most significant bits of the first byte of
- \(ASK\)
- , and decoding the 32-byte result according to the inverse of
- \(\mathsf{EncodeASK}\)
- .
-
-
Sprout master key generation
-
Let
- \(S\)
- be a seed byte sequence of a chosen length, which MUST be at least 32 and at most 252 bytes.
Check whether
- \(i \geq 2^{31}\)
- (whether the child is a hardened key).
-
-
If so (hardened child): let
- \(I = \mathsf{PRF^{expand}}(\mathsf{c}_{par}, [\texttt{0x80}]\)
- \(||\,\mathsf{EncodeASK}(\mathsf{a}_{\mathsf{sk},par})\)
- \(||\,\mathsf{I2LEOSP}_{32}(i))\)
- .
-
If not (normal child): return failure.
-
-
-
Split
- \(I\)
- into two 32-byte sequences,
- \(I_L\)
- and
- \(I_R\)
- .
-
Use
- \(\mathsf{DecodeASK}(I_L)\)
- as the child spending key
- \(\mathsf{a}_{\mathsf{sk},i}\)
- .
-
Use
- \(I_R\)
- as the child chain code
- \(\mathsf{c}_i\)
- .
-
-
There is no support for internal key derivation for Sprout.
-
-
Specification: Orchard key derivation
-
The derivation mechanism for Sapling addresses specified above incurs significant complexity to support non-hardened derivation. In the several years since Sapling was deployed, we have seen no use cases for non-hardened derivation appear. With that in mind, we define Orchard key derivation very similarly to Sprout above: only hardened derivation is supported.
+
The derivation mechanism for Sapling addresses specified above incurs significant complexity to support non-hardened derivation. In the several years since Sapling was deployed, we have seen no use cases for non-hardened derivation appear. With that in mind, we only support hardened key derivation for Orchard.
Orchard extended keys
We represent an Orchard extended spending key as
\((\mathsf{sk, c}),\)
@@ -720,7 +623,7 @@ 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.
Let
\(K = \mathsf{I2LEBSP}_{256}(\mathsf{rivk})\)
@@ -742,12 +645,12 @@ 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:
-
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.
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.
@@ -788,9 +691,9 @@ 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
-
Sprout, Sapling, and Orchard key paths have the following three path levels at the top, all of which use hardened derivation:
+
Sapling and Orchard key paths have the following three path levels at the top, all of which use hardened derivation:
\(purpose\)
@@ -801,7 +704,7 @@ License: MIT
) following the BIP 43 recommendation. It indicates that the subtree of this node is used according to this specification.
\(coin\_type\)
- : a constant identifying the cryptocurrency that this subtree's keys are used with. For compatibility with existing BIP 44 implementations, we use the same constants as defined in SLIP 44 6. Note that in keeping with that document, all cryptocurrency testnets share
+ : a constant identifying the cryptocurrency that this subtree's keys are used with. For compatibility with existing BIP 44 implementations, we use the same constants as defined in SLIP 44 6. Note that in keeping with that document, all cryptocurrency testnets share
\(coin\_type\)
index
\(1\)
@@ -810,7 +713,7 @@ License: MIT
\(account\)
: numbered from index
\(0\)
- in sequentially increasing manner. Defined as in BIP 44 5.
+ in sequentially increasing manner. Defined as in BIP 44 5.
Unlike BIP 44, none of the shielded key paths have a
\(change\)
@@ -832,7 +735,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:
Orchard supports diversified addresses with the same spending authority (like Sapling). A group of such addresses shares the same full viewing key and incoming viewing key, and so creating as many unlinkable addresses as needed does not increase the cost of scanning the block chain for relevant transactions.
The above key path levels include an account identifier, which in all user interfaces is represented as a "bucket of funds" under the control of a single spending authority. Therefore, wallets implementing Orchard ZIP 32 derivation MUST support the following path for any account in range
@@ -872,7 +767,7 @@ License: MIT
Sapling Full Viewing Key Fingerprints and Tags
A "Sapling full viewing key fingerprint" of a full viewing key with raw encoding
\(\mathit{FVK}\)
- (as specified in 18) is given by:
\(\mathsf{BLAKE2b}\text{-}\mathsf{256}(\texttt{“ZcashSaplingFVFP”}, \mathit{FVK})\)
@@ -881,22 +776,10 @@ License: MIT
It MAY be used to uniquely identify a particular Sapling full viewing key.
A "Sapling full viewing key tag" is the first 4 bytes of the corresponding Sapling full viewing key fingerprint. It is intended for optimizing performance of key lookups, and MUST NOT be assumed to uniquely identify a particular key.
-
Sprout Address Fingerprints and Tags
-
A "Sprout address fingerprint" of a Sprout payment address with raw encoding
- \(\mathit{ADDR}\)
- (as specified in 16, including the lead bytes) is given by:
It MAY be used to uniquely identify a particular Sprout payment address.
-
A "Sprout address tag" is the first 4 bytes of the corresponding Sprout address fingerprint. It is intended for optimizing performance of address lookups, and MUST NOT be assumed to uniquely identify a particular address.
-
Orchard Full Viewing Key Fingerprints and Tags
An "Orchard full viewing key fingerprint" of a full viewing key with raw encoding
\(\mathit{FVK}\)
- (as specified in 20) is given by:
\(\mathsf{BLAKE2b}\text{-}\mathsf{256}(\texttt{“ZcashOrchardFVFP”}, \mathit{FVK})\)
@@ -921,7 +804,7 @@ License: MIT
Specification: Key Encodings
-
The following encodings are analogous to the xprv and xpub encodings defined in BIP 32 for transparent keys and addresses. Each key type has a raw representation and a Bech32 7 encoding.
+
The following encodings are analogous to the xprv and xpub encodings defined in BIP 32 for transparent keys and addresses. Each key type has a raw representation and a Bech32 7 encoding.
Sapling extended spending keys
A Sapling extended spending key
\((\mathsf{ask, nsk, ovk, dk, c})\)
@@ -986,38 +869,6 @@ License: MIT
.
When encoded as Bech32, the Human-Readable Part is zxviews for the production network, or zxviewtestsapling for the test network.
-
Sprout extended spending keys
-
A Sprout extended spending key
- \((\mathsf{a_{sk}, c})\)
- , at depth
- \(depth\)
- , with parent address tag
- \(parent\_addr\_tag\)
- and child number
- \(i\)
- , is represented as a byte sequence:
For the master extended spending key,
- \(depth\)
- is
- \(0\)
- ,
- \(parent\_addr\_tag\)
- is 4 zero bytes, and
- \(i\)
- is
- \(0\)
- .
-
When encoded as Bech32, the Human-Readable Part is zxsprout for the production network, or zxtestsprout for the test network. Sprout extended spending keys are encoded using Bech32 even though other Sprout keys and addresses are encoded using Base58Check.
-
Orchard extended spending keys
An Orchard extended spending key
\((\mathsf{sk, c})\)
@@ -1045,9 +896,30 @@ License: MIT
\(0\)
.
When encoded as Bech32, the Human-Readable Part is secret-orchard-extsk-main for Mainnet, or secret-orchard-extsk-test for Testnet.
-
We define this encoding for completeness, however given that it includes the capability to derive child spending keys, we expect that most wallets will only expose the regular Orchard spending key encoding to users 21.
+
We define this encoding for completeness, however given that it includes the capability to derive child spending keys, we expect that most wallets will only expose the regular Orchard spending key encoding to users 21.
+
Values reserved due to previous specification for Sprout
+
The following values were previously used in the specification of hierarchical derivation for Sprout, and therefore SHOULD NOT be used in future Zcash-related specifications:
+
+
the BLAKE2b-256 personalizations
+
+
+ \(\texttt{“ZcashIP32_Sprout”}\)
+ , formerly specified for derivation of the master key of the Sprout tree;
+
+ \(\texttt{“Zcash_Sprout_AFP”}\)
+ , formerly specified for generation of Sprout address fingerprints;
+
+
+
the
+ \(\mathsf{PRF^{expand}}\)
+ prefix
+ \(\texttt{0x80}\)
+ , formerly specified for Sprout child key derivation;
+
the Bech32 Human-Readable Parts zxsprout and zxtestsprout, formerly specified for Sprout extended spending keys on Mainnet and Testnet respectively.
+
+
Test Vectors
TBC
diff --git a/zip-0032.rst b/zip-0032.rst
index 27282aee..2e6c00c9 100644
--- a/zip-0032.rst
+++ b/zip-0032.rst
@@ -43,9 +43,12 @@ tree of key components from a single seed, for the following shielded pools (whi
key structures):
- Sapling
-- Sprout (for compatibility, effectively unused)
- Orchard
+Previous versions of this document also defined a similar derivation system for the Sprout shielded pool.
+This has been removed since it was never used, and is unlikely to be used given that `zcashd` no longer
+generates Sprout addresses (and neither `Zebra` nor the mobile SDKs have ever done so).
+
The last part shows how to use these trees in the context of existing BIP 44 [#bip-0044]_ wallets.
This specification complements the existing use by some Zcash wallets of BIP 32 and BIP 44 for transparent
@@ -137,7 +140,6 @@ specifications), which is the opposite of BIP 32.
We adapt the path notation of BIP 32 [#bip-0032]_ to describe shielded HD paths, using prime marks (:math:`'`) to
indicate hardened derivation (:math:`i' = i + 2^{31}`) as in BIP 44 [#bip-0044]_:
-- :math:`\mathsf{CDKsk}(\mathsf{CDKsk}(\mathsf{CDKsk}(m_\mathsf{Sprout}, a'), b), c)` is written as :math:`m_\mathsf{Sprout} / a' / b / c`
- :math:`\mathsf{CDKfvk}(\mathsf{CDKfvk}(\mathsf{CDKfvk}(m_\mathsf{Sapling}, a), b), c)` is written as :math:`m_\mathsf{Sapling} / a / b / c`.
@@ -335,66 +337,12 @@ The default diversifier for a Sapling extended key is defined to be :math:`d_j`,
least nonnegative integer yielding a valid diversifier.
-Specification: Sprout key derivation
-====================================
-
-For completeness, we define a system for deriving a tree of Sprout key components. It is unlikely that this
-will garner much usage once Sapling activates, but is presented for those users who may require it.
-
-Sprout extended keys
---------------------
-
-Due to the way Sprout keys are constructed and used, it is not possible to derive incoming viewing keys or
-payment addresses in parallel with spending keys. Nor is it possible to implement non-hardened derivation.
-We therefore only define and derive Sprout extended spending keys.
-
-We represent a Sprout extended spending key as :math:`(\mathsf{a_{sk}, c})`, where :math:`\mathsf{a_{sk}}`
-is the normal Sprout spending key, and :math:`\mathsf{c}` is the chain code.
-
-Sprout helper functions
------------------------
-
-Let :math:`\mathsf{EncodeASK}(\mathsf{a_{sk}})` be the 32-byte encoding of :math:`\mathsf{a_{sk}}` in the
-raw encoding of a Sprout spending key (excluding lead bytes) as specified in [#protocol-sproutspendingkeyencoding]_.
-
-Let :math:`\mathsf{DecodeASK}(ASK)` be the result of clearing the 4 most significant bits of the first byte
-of :math:`ASK`, and decoding the 32-byte result according to the inverse of :math:`\mathsf{EncodeASK}`.
-
-Sprout master key generation
-----------------------------
-
-Let :math:`S` be a seed byte sequence of a chosen length, which MUST be at least 32 and at most 252 bytes.
-
-- Calculate :math:`I = \mathsf{BLAKE2b}\text{-}\mathsf{512}(\texttt{“ZcashIP32_Sprout”}, S)`.
-- Split :math:`I` into two 32-byte sequences, :math:`I_L` and :math:`I_R`.
-- Use :math:`\mathsf{DecodeASK}(I_L)` as the master spending key :math:`\mathsf{a}_{\mathsf{sk},m}`.
-- Use :math:`I_R` as the master chain code :math:`\mathsf{c}_m`.
-
-Sprout child key derivation
----------------------------
-
-:math:`\mathsf{CDKsk}((\mathsf{a}_{\mathsf{sk},par}, \mathsf{c}_{par}), i)`:math:`\rightarrow (\mathsf{a}_{\mathsf{sk},i}, \mathsf{c}_i)`
-
-- Check whether :math:`i \geq 2^{31}` (whether the child is a hardened key).
-
- - If so (hardened child): let
- :math:`I = \mathsf{PRF^{expand}}(\mathsf{c}_{par}, [\texttt{0x80}]`:math:`||\,\mathsf{EncodeASK}(\mathsf{a}_{\mathsf{sk},par})`:math:`||\,\mathsf{I2LEOSP}_{32}(i))`.
- - If not (normal child): return failure.
-
-- Split :math:`I` into two 32-byte sequences, :math:`I_L` and :math:`I_R`.
-- Use :math:`\mathsf{DecodeASK}(I_L)` as the child spending key :math:`\mathsf{a}_{\mathsf{sk},i}`.
-- Use :math:`I_R` as the child chain code :math:`\mathsf{c}_i`.
-
-There is no support for internal key derivation for Sprout.
-
-
Specification: Orchard key derivation
=====================================
The derivation mechanism for Sapling addresses specified above incurs significant complexity to support
non-hardened derivation. In the several years since Sapling was deployed, we have seen no use cases for
-non-hardened derivation appear. With that in mind, we define Orchard key derivation very similarly to
-Sprout above: only hardened derivation is supported.
+non-hardened derivation appear. With that in mind, we only support hardened key derivation for Orchard.
Orchard extended keys
---------------------
@@ -500,8 +448,8 @@ altered the design where it makes sense to leverage features of shielded address
Key path levels
---------------
-Sprout, Sapling, and Orchard key paths have the following three path levels at the top, all of which use
-hardened derivation:
+Sapling and Orchard key paths have the following three path levels at the top, all of which use hardened
+derivation:
- :math:`purpose`: a constant set to :math:`32'` (or :math:`\texttt{0x80000020}`) following the BIP 43
recommendation. It indicates that the subtree of this node is used according to this specification.
@@ -550,13 +498,6 @@ they MAY additionally support a non-hardened :math:`address\_index` path level a
`zcashd` version 4.6.0 and later uses this to derive "legacy" Sapling addresses from a mnemonic seed phrase
under account :math:`\mathtt{0x7FFFFFFF}`, using hardened derivation for :math:`address\_index`.
-Sprout key path
----------------
-
-Wallets implementing Sprout ZIP 32 derivation MUST support the following path:
-
-* :math:`m_\mathsf{Sprout} / purpose' / coin\_type' / account' / address\_index`.
-
Orchard key path
----------------
@@ -596,20 +537,6 @@ A "Sapling full viewing key tag" is the first 4 bytes of the corresponding Sapli
fingerprint. It is intended for optimizing performance of key lookups, and MUST NOT be assumed to
uniquely identify a particular key.
-Sprout Address Fingerprints and Tags
-------------------------------------
-
-A "Sprout address fingerprint" of a Sprout payment address with raw encoding :math:`\mathit{ADDR}` (as specified in
-[#protocol-sproutpaymentaddrencoding]_, including the lead bytes) is given by:
-
-* :math:`\mathsf{BLAKE2b}\text{-}\mathsf{256}(\texttt{“Zcash_Sprout_AFP”}, \mathit{ADDR})`.
-
-It MAY be used to uniquely identify a particular Sprout payment address.
-
-A "Sprout address tag" is the first 4 bytes of the corresponding Sprout address fingerprint. It is
-intended for optimizing performance of address lookups, and MUST NOT be assumed to uniquely identify
-a particular address.
-
Orchard Full Viewing Key Fingerprints and Tags
----------------------------------------------
@@ -677,23 +604,6 @@ is 4 zero bytes, and :math:`i` is :math:`0`.
When encoded as Bech32, the Human-Readable Part is ``zxviews`` for the production
network, or ``zxviewtestsapling`` for the test network.
-Sprout extended spending keys
------------------------------
-
-A Sprout extended spending key :math:`(\mathsf{a_{sk}, c})`, at depth :math:`depth`, with
-parent address tag :math:`parent\_addr\_tag` and child number :math:`i`, is represented as a
-byte sequence:
-
-* :math:`\mathsf{I2LEOSP}_{8}(depth)`:math:`||\,parent\_addr\_tag`:math:`||\,\mathsf{I2LEOSP}_{32}(i)`:math:`||\,\mathsf{c}`:math:`||\,\mathsf{EncodeASK}(\mathsf{a_{sk}})`.
-
-For the master extended spending key, :math:`depth` is :math:`0`, :math:`parent\_addr\_tag`
-is 4 zero bytes, and :math:`i` is :math:`0`.
-
-When encoded as Bech32, the Human-Readable Part is ``zxsprout`` for the production
-network, or ``zxtestsprout`` for the test network. Sprout extended spending keys
-are encoded using Bech32 even though other Sprout keys and addresses are encoded
-using Base58Check.
-
Orchard extended spending keys
------------------------------
@@ -713,6 +623,25 @@ spending keys, we expect that most wallets will only expose the regular Orchard
users [#protocol-orchardspendingkeyencoding]_.
+Values reserved due to previous specification for Sprout
+========================================================
+
+The following values were previously used in the specification of hierarchical derivation
+for Sprout, and therefore SHOULD NOT be used in future Zcash-related specifications:
+
+* the BLAKE2b-256 personalizations
+
+ * :math:`\texttt{“ZcashIP32_Sprout”}`, formerly specified for derivation of the master
+ key of the Sprout tree;
+ * :math:`\texttt{“Zcash_Sprout_AFP”}`, formerly specified for generation of Sprout
+ address fingerprints;
+
+* the :math:`\mathsf{PRF^{expand}}` prefix :math:`\texttt{0x80}`, formerly specified for
+ Sprout child key derivation;
+* the Bech32 Human-Readable Parts ``zxsprout`` and ``zxtestsprout``, formerly specified for
+ Sprout extended spending keys on Mainnet and Testnet respectively.
+
+
Test Vectors
============