From e89b60e5a26ea58ebff72f20a5bbffbfbcbe382b Mon Sep 17 00:00:00 2001
From: Paul Dann For every new Asset, there MUST be a new and unique Asset Identifier, denoted
+ Every Asset has a globally-unique Asset Identifier, denoted
\(\mathsf{AssetId}\!\)
- . We define this to be a globally unique pair
- \(\mathsf{AssetId} := (\mathsf{ik}, \mathsf{asset\_desc})\!\)
- , where
- \(\mathsf{ik}\)
- is the issuance key and
- \(\mathsf{asset\_desc}\)
- is a byte string. A given Asset Identifier is used across all Zcash protocols that support ZSAs -- that is, the OrchardZSA protocol and potentially future Zcash shielded protocols. For this Asset Identifier, we derive an Asset Digest,
- \(\mathsf{AssetDigest}\!\)
- , which is simply is a
- \(\textsf{BLAKE2b-512}\)
- hash of the Asset Identifier. From the Asset Digest, we derive a specific Asset Base within each shielded protocol using the applicable hash-to-curve algorithm. This Asset Base is included in shielded notes. Let DefineSpecification: Asset Identifier, Asset Digest, and Asset Base
- ![]()
-
-
From the Asset Identifier, we derive an Asset Digest
where
-Define
-In the case of the OrchardZSA protocol, we define
-where - \(\mathsf{GroupHash}^\mathbb{P}\) - is defined as in 31.
+ \(\mathsf{EncodeAssetId}(\mathsf{AssetId})\) + is a canonical encoding scheme for the Asset Identifier. +From the Asset Digest, we derive a specific Asset Base that represents the Custom Asset within each shielded protocol:
+This Asset Base is included in shielded notes within the shielded protocol.
The relations between the Asset Identifier, Asset Digest, and Asset Base are shown in the following diagram:
@@ -319,13 +289,38 @@
(resp.
\(\mathsf{Protocol}\!\)
) in the subscript (resp. superscript) when the Asset Identifier (resp. Protocol) is clear from the context.
- Wallets MUST NOT display just the - \(\mathsf{asset\_desc}\) - string to their users as the name of the Asset. Some possible alternatives include:
-Assets issued using the protocol specified in this ZIP are scoped to the + \(\mathsf{ik}\) + that issued them. Within that scope, Asset Identifier uniqueness is obtained by way of an asset description, + \(\mathsf{asset\_desc}\!\) + , which includes any information pertaining to the issuance. + \(\mathsf{asset\_desc}\) + is a non-empty byte sequence which SHOULD be a well-formed UTF-8 code unit sequence according to Unicode 15.0.0 or later.
+Define
+We define Asset Identifiers for assets issued under this ZIP as
+and define their canonical encoding as
+Note that the initial + \(\mathtt{0x00}\) + byte is a version byte, enabling future ZIPs to specify alternative issuance protocols and Asset Identifiers.
+Wallets MUST NOT display just the + \(\mathsf{asset\_desc}\) + string to their users as the name of the Asset. Some possible alternatives include:
+In the case of the OrchardZSA protocol, we define
+where + \(\mathsf{GroupHash}^\mathbb{P}\) + is defined as in 31.
+In an earlier version of this ZIP, the asset description was a direct component of the Asset Identifier, and was stored on-chain in each issuance transaction. The Asset Identifier and issuance transactions now instead include a collision-resistant hash of the asset description, for the following reasons:
+It is necessary to ensure that the balance of any issued Custom Asset never becomes negative within a shielded pool, along the lines of ZIP 209 8. However, unlike for the shielded ZEC pools, there is no individual transaction field that directly corresponds to both the issued and burnt amounts for a given Asset. Therefore, we require that all nodes maintain a record of the current amount in circulation for every issued Custom Asset, and update this record based on the issuance and burn transactions processed. This allows for efficient detection of balance violations for any Asset, in which case we specify a consensus rule to reject the transaction or block.
We limit the total issuance of any Asset to a maximum of diff --git a/rendered/zip-0230.html b/rendered/zip-0230.html index c10ed734c..f30ea2e7f 100644 --- a/rendered/zip-0230.html +++ b/rendered/zip-0230.html @@ -560,16 +560,10 @@
variesassetDescSizecompactSizeassetDescSizeasset_descbyte[assetDescSize]assetDescSize bytes which SHOULD be a well-formed UTF-8 code unit sequence according to Unicode 15.0.0 or later.32assetDescHashbyte[32]variesZIP: 233
-Title: Network Sustainability Mechanism: Burning
+Title: Network Sustainability Mechanism: Removing Funds From Circulation
Owners: Jason McGee <jason@shieldedlabs.net>
Zooko Wilcox <zooko@shieldedlabs.net>
+ Mark Henderson <mark@shieldedlabs.net>
Tomek Piotrowski <tomek@eiger.co>
Mariusz Pilarek <mariusz@eiger.co>
Paul Dann <paul@eiger.co>
@@ -49,9 +50,6 @@ Terminology
-“Burning” - The method by which ZEC/TAZ becomes unavailable for circulation
-on the network.
-
\(\mathsf{MAX\_MONEY}\), as defined in § 5.3 ‘Constants’ 5,
is the total ZEC/TAZ supply cap measured in zatoshi, corresponding to
21,000,000 ZEC. This is slightly larger than the supply cap for the current
@@ -60,11 +58,11 @@
TerminologyAbstract 
-This ZIP proposes the introduction of a mechanism to voluntarily burn funds,
-removing those funds entirely from circulation on the network. This mechanism,
-in combination with ZIP 234 6 and ZIP 235 7, comprises a
-long-term strategy for the sustainability of the network. We will refer to the
-combined effects of these three ZIPs as the “Network Sustainability Mechanism”.
+This ZIP proposes the introduction of a mechanism to voluntarily remove funds
+entirely from circulation on the network. This mechanism, in combination with
+ZIP 234 6 and ZIP 235 7, comprises a long-term strategy for
+the sustainability of the network. We will refer to the combined effects of
+these three ZIPs as the “Network Sustainability Mechanism”.
Motivation 
@@ -72,32 +70,35 @@ Motivation\(\mathsf{MAX\_MONEY}\). This lays necessary groundwork for extending the
-block subsidy system, which currently has a clear final end date.
-
- Benefits to ZEC Holders: Burning funds reduces the supply of ZEC,
-benefiting network users in proportion to their holdings without requiring
-them to opt into any scheme, introducing extra risk, active oversight, or
-accounting complexity.
+- Long Term Consensus Sustainability: By enabling the removal of funds from
+circulation, the network gains the ability to create “headroom” between the
+chain value and \(\mathsf{MAX\_MONEY}\). This lays necessary groundwork for
+extending the block subsidy system, which currently has a clear final end
+date.
+- Benefits to ZEC Holders: Removing funds from circulation reduces the
+circulating supply of ZEC. To the extent that this potentially contributes to
+an increase in the value of remaining ZEC, it can be argued to benefit network
+users in proportion to their holdings — without requiring them to opt into any
+scheme, introducing extra risk, active oversight, or accounting complexity.
Specification 
-Burn amount 
+Transaction Field 
-Each transaction gains a \(\mathsf{burn\_amount}\) property, specifying the
-value in zatoshis that is burned when the transaction is mined. The burned value
-subtracts from the remaining value in the “transparent transaction value pool”
-as described in § 3.4 ‘Transactions and Treestates’ 8.
+Each transaction gains a \(\mathsf{zip233\_amount}\) property, specifying the
+value in zatoshis that is removed from circulation when the transaction is
+mined. The value removed from circulation subtracts from the remaining value in
+the “transparent transaction value pool” as described in § 3.4 ‘Transactions and
+Treestates’ 8.
-\(\mathsf{burn\_amount}\) does not result in an output being produced in any
+
\(\mathsf{zip233\_amount}\) does not result in an output being produced in any
chain value pool, and therefore from the point at which the transaction is
-applied to the global chain state, \(\mathsf{burn\_amount}\) is subtracted from the
-issued supply. It is unavailable for circulation on the network at least through
-to the end of the block in which the transaction is mined. ZIP 234 6
-specifies a potential mechanism by which the burned funds would again become
-available.
+applied to the global chain state, \(\mathsf{zip233\_amount}\) is subtracted from
+the issued supply. It is unavailable for circulation on the network at least
+through to the end of the block in which the transaction is mined. ZIP 234
+6 specifies a potential mechanism by which the funds removed from
+circulation would again become available.
Changes to ZIP 230 9
@@ -117,22 +118,22 @@ Changes to ZIP 230 Bytes
Name
Data Type
- Description
+ Description
burnAmount zip233Amount uint64 The \(\mathsf{burn\_amount}\) of a transaction is defined to be the value of the
-burnAmount field if present, and otherwise 0.
The \(\mathsf{zip233\_amount}\) of a transaction is defined to be the value of the
+zip233Amount field if present, and otherwise 0.
Notes:
@@ -140,31 +141,32 @@Make a change to § 3.4 ‘Transactions and Treestates’ 8 -implementing the specification in Burn amount.
+implementing the specification in [ZIP-233 Amount].In § 7.1 ‘Transaction Encoding and Consensus’ 11, add:
-[NU7 onward] \(\mathsf{burn\_amount}\) MUST be in the range \(\{ 0 .. \mathsf{MAX\_MONEY} \}\).
+[NU7 onward] \(\mathsf{zip233\_amount}\) MUST be in the range \(\{ 0 .. \mathsf{MAX\_MONEY} \}\).
Relative to the sighash algorithm defined in ZIP 244, the sighash algorithm
that applies to v6 transactions differs by appending the encoding of
-\(\mathsf{burn\_amount}\) to the Common Transaction Fields that are the input
+\(\mathsf{zip233\_amount}\) to the Common Transaction Fields that are the input
to the digest in T.1: header_digest 13:
-@@ -181,11 +183,11 @@T.1f: burn_amount (8-byte little-endian burn amount) +T.1f: zip233_amount (8-byte little-endian amount to remove from circulation)
An explicit value distinguishes the burned ZEC from the transaction fee. -Explicitness also ensures any arithmetic flaws in any implementations are more -likely to be observed and caught immediately.
+An explicit value distinguishes the funds to remove from circulation from +the transaction fee. Explicitness also ensures any arithmetic flaws in any +implementations are more likely to be observed and caught immediately.
ZIP 235: Burn 60% of Transaction Fees ↩︎
+ZIP 235: Remove 60% of Transaction Fees From Circulation ↩︎
The terms “Block Subsidy”, “Issuance”, and “Burning” are to be interpreted -as described in ZIP 233. 6
+The terms “Block Subsidy” and “Issuance” are to be interpreted as described in +ZIP 233. 6
Let \(\mathsf{PostBlossomHalvingInterval}\) be as defined in 7.
@@ -74,8 +75,8 @@\(\mathsf{MoneyReserveAfter}(\mathsf{height}) =\) The value of the Money Reserve +after the specified block height.
+The block height will be chosen by the following criteria:
This selection is intended to achieve Key Objective 6 while still being at -a constant, predictable height. An alternative would be to have a dynamic -“latch”-style activation, which would calculate the activation height by -testing the “less than” conditional with every block after the second halving. -We prefer the pre-defined constant height parameter, to give everyone more -time certainty at the cost of issuance level certainty.
- -The difference in up-front calculation versus dynamic calculation is in -whether or not burns are accounted for (since future burns cannot be -calculated up-front). This means with the pre-defined constant parameter -approach, issuance will jump up some amount at activation. This amount -should be equivalent to all ZEC burnt prior to that height times -\(\mathsf{BLOCK\_SUBSIDY\_FRACTION}\). For example, if a total of 100,000 ZEC -were burnt prior to the pre-defined constant activation height, then at -activation the issuance would be larger than BTC-style issuance by -\(100\_000\textsf{ ZEC} \cdot \mathsf{BLOCK\_SUBSIDY\_FRACTION}\), -which we calculate equals \(0.04126\) ZEC. This example is chosen to -demonstrate that a very large burn amount (much larger than expected) would -elevate issuance by a relatively small amount. For this reason, we believe -a pre-defined constant is a better approach to achieving Key Objective 6 -than a “dynamic latch” logic because it is so much simpler to implement -and reason about.
- -\(\mathsf{MoneyReserveAfter}(\mathsf{height}) =\) The value of the Money Reserve -after the specified block height.
-At the \(\mathsf{DEPLOYMENT\_BLOCK\_HEIGHT}\), nodes should switch from the current issuance @@ -191,6 +169,31 @@
The selection is intended to achieve Key Objective 6 while still being at +a constant, predictable height. An alternative would be to have a dynamic +“latch”-style activation, which would calculate the activation height by +testing the “less than” conditional with every block after the second halving. +We prefer the pre-defined constant height parameter, to give everyone more +time certainty at the cost of issuance level certainty.
+ +The difference in up-front calculation versus dynamic calculation is +in whether or not funds removed from circulation are accounted for +(since funds removed from circulation in the future cannot be calculated +up-front). This means with the pre-defined constant parameter approach, +issuance will jump up some amount at activation. This amount should be +equivalent to all ZEC removed from circulation prior to that height times +\(\mathsf{BLOCK\_SUBSIDY\_FRACTION}\). For example, if a total of 100,000 ZEC were +burnt prior to the pre-defined constant activation height, then at activation +the issuance would be larger than BTC-style issuance by \(100\_000\textsf{ ZEC} +\cdot \mathsf{BLOCK\_SUBSIDY\_FRACTION}\), which we calculate equals \(0.04126\) +ZEC. This example is chosen to demonstrate that a very large amount removed from +circulation (much larger than expected) would elevate issuance by a relatively +small amount. For this reason, we believe a pre-defined constant is a better +approach to achieving Key Objective 6 than a “dynamic latch” logic because it is +so much simpler to implement and reason about.
+Let \(\mathsf{IntendedMoneyReserveFractionRemainingAfterFourYears} = 0.5\).
@@ -203,9 +206,9 @@The largest possible value in the Money Reserve is \(\mathsf{MAX\_MONEY}\), in the -theoretically possible case that all issued funds are burned. If this happened, -the largest interim sum in the block subsidy calculation would be -\(\mathsf{MAX\_MONEY} \cdot 4126 / 10\_000\_000\_000\).
+theoretically possible case that all issued funds are removed from circulation. +If this happened, the largest interim sum in the block subsidy calculation would +be \(\mathsf{MAX\_MONEY} \cdot 4126 / 10\_000\_000\_000\).This uses 62.91 bits, which is just under the 63-bit limit for signed two’s complement 64-bit integer amount types.
@@ -243,9 +246,9 @@Last block is 47917869 in ~113.88 years
-indicates that, assuming that no ZEC is ever burned, the Money Reserve will be -depleted after 113.88 years, and the block subsidy will be 0 ZEC after that -point.
+indicates that, assuming that no ZEC is ever removed from circulation, the Money +Reserve will be depleted after 113.88 years, and the block subsidy will be 0 ZEC +after that point.
This fragment of the output:
@@ -266,7 +269,8 @@This ZIP is proposed to activate with Network Upgrade 7. 10 -It MUST be deployed at the same time or after ZIP 233 (“NSM: Burning” 6).
+It MUST be deployed at the same time or after ZIP 233 (“NSM: Removing Funds From +Circulation” 6).ZIP: 235
-Title: Burn 60% of Transaction Fees
+Title: Remove 60% of Transaction Fees From Circulation
Owners: Jason McGee <jason@shieldedlabs.net>
Zooko Wilcox <zooko@shieldedlabs.net>
+ Mark Henderson <mark@shieldedlabs.net>
Tomek Piotrowski <tomek@eiger.co>
Mariusz Pilarek <mariusz@eiger.co>
Paul Dann <paul@eiger.co>
@@ -45,58 +46,59 @@ Terminology“ZEC/TAZ” refers to the native currency of Zcash on a given network, i.e.
ZEC on Mainnet and TAZ on Testnet.
-The terms “Block Subsidy”, “Issuance”, and “Burning” are to be interpreted
-as described in ZIP 233. 6
+The terms “Block Subsidy” and “Issuance” are to be interpreted as described in
+ZIP 233. 6
Abstract 
-This ZIP proposes to burn 60% of transaction fees, while the remaining 40% is
-directed as before, providing a deflationary effect, and building the groundwork
-for long-term support of the Zcash network via the new block subsidy rules
-proposed by ZIP 234 7.
+This ZIP proposes to remove 60% of transaction fees from circulation, while
+the remaining 40% is directed as before, providing a deflationary effect, and
+building the groundwork for long-term support of the Zcash network via the new
+block subsidy rules proposed by ZIP 234 7.
Motivation 
-ZIP 233 (“Network Sustainability Mechanism: Burning” 6) describes a
-method by which ZEC can be burned to support network sustainability.
+ZIP 233 (“Network Sustainability Mechanism: Removing Funds From Circulation”
+6) describes a method by which ZEC can be removed from circulation to
+support network sustainability.
By introducing a requirement that a certain proportion of transaction fees be
-burned, we ensure that ZEC will be removed from circulating supply to contribute
-to the long-term sustainability of the network as described below:
+removed from circulation, we aim to contribute to the long-term sustainability
+of the network as described below:
Benefits to the Network 
- Network Sustainability: This mechanism involves temporarily reducing the
supply of ZEC, similar to asset burning in Ethereum’s EIP-1559 8,
-but with long-term sustainability benefits, as the burned funds effectively
-boost future mining rewards, making it an attractive option for current and
-future Zcash users.
+but with long-term sustainability benefits, as the funds removed from
+circulation effectively boost future mining rewards, making it an attractive
+option for current and future Zcash users.
- Incentivizing Transaction Inclusion: By maintaining a 40% share of
transaction fees for miners, we continue incentivizing miners to prioritize
including transactions in their blocks. This helps ensure the continued
efficient processing of transactions and supports a robust and responsive
network.
-- Aligning Interests: Burning transaction fees aligns the interests
-of miners with the long-term health of the network, incentivizing them
-to prioritize security and efficiency. As miners focus on maintaining a
+
- Aligning Interests: Removing transaction fees from circulation aligns the
+interests of miners with the long-term health of the network, incentivizing
+them to prioritize security and efficiency. As miners focus on maintaining a
robust network, overall adoption and usage can increase, leading to higher
transaction volumes in the long run. This structure discourages short-term
profit-seeking behaviors, as miners benefit more from a stable and thriving
ecosystem than from engaging in malicious activities that could undermine the
network’s reputation and security.
-- Future-Proofing the Network: Burning a portion of transaction fees
-is a forward-looking approach that prepares the Zcash network for future
-challenges and opportunities. It establishes a financial buffer that can be
-instrumental in addressing unforeseen issues and seizing strategic advantages
-as the Zcash ecosystem evolves.
+- Future-Proofing the Network: Removing a portion of transaction fees from
+circulation is a forward-looking approach that prepares the Zcash network for
+future challenges and opportunities. It establishes a financial buffer that
+can be instrumental in addressing unforeseen issues and seizing strategic
+advantages as the Zcash ecosystem evolves.
Requirements 
For a given block, the coinbase transaction MUST have a \(\mathsf{burn\_amount}\), +
For a given block, the coinbase transaction MUST have a \(\mathsf{zip233\_amount}\), as defined in 6, that is greater than or equal to \(\mathsf{floor}(\mathsf{transactionFees} \cdot 6 / 10)\).
@@ -125,14 +127,14 @@There is no explicit mechanism in prior transaction versions to burn the -required funds. Since \(\mathsf{burn\_amount} = 0\) for transaction versions -prior to v6, absent the rule about the coinbase transaction version it -would be technically possible to satisfy the constraint on \(\mathsf{burn\_amount}\) -with earlier versions than v6, but only when \(\mathsf{transactionFees} = 0\). -That would introduce a corner case in the transaction consensus rules that -is not useful, since it is expected that the \(\mathsf{transactionFees}\) -will normally be non-zero.
+There is no explicit mechanism in prior transaction versions to remove +the required funds from circulation. Since \(\mathsf{zip233\_amount} = 0\) +for transaction versions prior to v6, absent the rule about the coinbase +transaction version it would be technically possible to satisfy the constraint +on \(\mathsf{zip233\_amount}\) with earlier versions than v6, but only when +\(\mathsf{transactionFees} = 0\). That would introduce a corner case in the +transaction consensus rules that is not useful, since it is expected that the +\(\mathsf{transactionFees}\) will normally be non-zero.
If 60% of these fees burned, that would be 210.864 ZEC per year. 11
+If 60% of these fees are removed from circulation, that would be 210.864 ZEC per +year. 11
Further ZIPs may be proposed to burn ZEC in various ways to support network -sustainability, including but not limited to:
+Further ZIPs may be proposed to remove ZEC from circulation in various ways to +support network sustainability, including but not limited to:
The implementation of this ZIP MUST be deployed at the same time or after -ZIP 233 (“NSM: Burning” 6), and ZIP 234 (“NSM: Issuance Smoothing” -7).
+ZIP 233 (“NSM: Removing Funds From Circulation” 6), and ZIP 234 (“NSM: +Issuance Smoothing” 7).ZIP 233: Network Sustainability Mechanism: Burning ↩︎
+ZIP 233: Network Sustainability Mechanism: Removing Funds From Circulation ↩︎
The key words "MUST", "MUST NOT", "SHOULD", "RECOMMENDED", and "MAY" in this document are to be interpreted as described in BCP 14 1 when, and only when, they appear in all capitals.
-"Jubjub" refers to the elliptic curve defined in 15.
+"Jubjub" refers to the elliptic curve defined in 14.
+A "cryptovalue" is a high-entropy value used in a cryptographic protocol that is not necessarily a key.
A "chain code" is a cryptovalue that is needed, in addition to a spending key, in order to derive descendant keys and addresses of that key.
-The terms "Testnet" and "Mainnet" are to be interpreted as described in section 3.12 of the Zcash Protocol Specification 10.
+The terms "Testnet" and "Mainnet" are to be interpreted as described in section 3.12 of the Zcash Protocol Specification 9.
This proposal defines a mechanism for extending hierarchical deterministic wallets, as described in BIP 32 2, to support Zcash's shielded addresses.
@@ -54,7 +55,7 @@At present, no such equivalent exists for Zcash's shielded addresses. This is of particular concern for hardware wallets; all currently-marketed devices only store a seed internally, and have trained their users to only backup that seed. Given that the Sapling upgrade will make it feasible to use hardware wallets with shielded addresses, it is desirable to have a standard mechanism for deriving them.
Most of the notation and functions used in this ZIP are defined in the Zcash protocol specification 9. They are reproduced here for convenience:
+Most of the notation and functions used in this ZIP are defined in the Zcash protocol specification 8. They are reproduced here for convenience:
The following algorithm standardized in 22 is used:
+The following algorithm standardized in 21 is used:
Let \(\mathcal{G}^\mathsf{Sapling}\) - be as defined in 14 and let + be as defined in 13 and let \(\mathcal{H}^\mathsf{Sapling}\) - be as defined in 11.
+ be as defined in 10.\(\mathsf{CKDfvk}((\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})\) @@ -446,7 +447,7 @@ \(\mathsf{ak}_i\) is the zero point of Jubjub, or if the corresponding \(\mathsf{ivk}\) - derived as specified in 11 is + derived as specified in 10 is \(0\!\) .
Let \(\mathcal{H}^\mathsf{Sapling}\) - be as defined in 11.
+ be as defined in 10.Let \((\mathsf{ak}, \mathsf{nk}, \mathsf{ovk}, \mathsf{dk})\) be the external full viewing key.
@@ -540,12 +541,12 @@(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 23.
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 + derived from the internal full viewing key as specified in 10 is \(0\!\) .
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 now have a general hardened-only derivation process that retains compatibility with existing derivation path semantics (to enable deriving the same path across multiple contexts).
+The functions defined in this section are intended for internal use by context-specific mechanisms in subsequent sections, rather than for direct use.
Let \(\mathsf{Context}\) @@ -631,21 +633,58 @@
As well as the integer child index + \(i\!\) + , the child key derivation function defined here supports a byte sequence + \(\mathsf{tag}\) + and a + \(\mathsf{full\_width\_leaf}\) + flag ( + \(\!0\) + representing + \(\mathsf{false}\!\) + , + \(1\) + representing + \(\mathsf{true}\!\) + ). Each triple + \((i, \mathsf{tag}, \mathsf{full\_width\_leaf})\) + produces an independent output.
+The + \(\mathsf{tag}\) + and + \(\mathsf{full\_width\_leaf}\) + inputs are reserved for use by Registered child key derivation; for other uses + \(\mathsf{tag}\) + MUST be + \([\,]\) + and + \(\mathsf{full\_width\_leaf}\) + MUST be + \(\mathsf{false}\) + ( + \(\!0\!\) + ).
- \(\mathsf{CKDh}^\mathsf{Context}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i)\) - \(\rightarrow (\mathsf{sk}_i, \mathsf{c}_i)\) + \(\mathsf{CKDh}^\mathsf{Context}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, \mathsf{full\_width\_leaf})\) + \(\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})\) :
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.
+Note that the resulting child spending key may produce an invalid external FVK, as specified in 11, with small probability. The corresponding internal FVK derived as specified in the next section may also be invalid with small probability.
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.
@@ -718,7 +747,7 @@ \(\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 11.Define \(\mathsf{DeriveInternalFVK^{Orchard}}(\mathsf{ak}, \mathsf{nk}, \mathsf{rivk})\) as follows:
@@ -727,7 +756,7 @@ \(K = \mathsf{I2LEBSP}_{256}(\mathsf{rivk})\!\) .
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.
+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 23.
+Note that the resulting FVK may be invalid, as specified in 11.
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.
@@ -790,54 +819,129 @@In some contexts there is a need for deriving arbitrary keys with the same derivation path as existing key material (for example, deriving an arbitrary account-level key), without the need for ecosystem-wide coordination. The following instantiation of the hardened key generation process may be used for this purpose.
+In the context of a particular application protocol defined by a ZIP, there is sometimes a need to define an HD subtree that will not collide with keys derived for other protocols, as far as that is possible to assure by following the ZIP process 22.
+Within this subtree, the application protocol may use derivation paths related to those used for existing key material — for example, to derive an account-level key. The following instantiation of the hardened key generation process may be used for this purpose.
+It is strongly RECOMMENDED that implementors ensure that documentation of the usage and derivation paths of the application protocol's key tree in the corresponding ZIP is substantially complete, before public deployment of software or hardware using this mechanism. The ZIP process allows for subsequent updates and corrections.
Let \(\mathsf{ContextString}\) be a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
We instantiate the hardened key generation process with the following constants:
Let + \(S\) + be a seed byte sequence of a chosen length, which MUST be at least 32 and at most 252 bytes.
+The registered subtree root is obtained as:
++ \(\mathsf{RegKD}(\mathsf{ContextString}, \mathsf{S}, \mathsf{ZipNumber})\) + \(\rightarrow (\mathsf{sk}_{subtree}, \mathsf{c}_{subtree})\) + :
+Note: The intermediate key + \((\mathsf{sk}_{m}, \mathsf{c}_{m})\) + would grant the ability to derive the subtree root for application protocols defined in any ZIP using the same + \(\mathsf{ContextString}\) + and seed. This is a potentially dangerous scope of grant since it cannot be known what future protocols will use this mechanism; therefore, + \((\mathsf{sk}_{m}, \mathsf{c}_{m})\) + SHOULD NOT be used or stored directly without careful consideration of security consequences.
+As well as the integer child index + \(i\!\) + , the child key derivation function defined here supports a byte sequence + \(\mathsf{tag}\!\) + ; each pair + \((i, \mathsf{tag})\) + produces a different child key. If an explicit tag is not required, + \(\mathsf{tag}\) + is set to the empty byte sequence.
+Note: The tag MUST use an unambiguous encoding within the given context. It is RECOMMENDED to use a prefix-free encoding, which may require the use of length fields if multiple fields need to be encoded.
++ \(\mathsf{CKDreg}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag})\) + \(\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})\) + :
+If the application protocol requires a 64-byte cryptovalue (for example, to avoid an entropy bottleneck in its subsequent operations), then a similar process to Registered child key derivation above can be used to obtain such a cryptovalue at a given child index; again with optional tag. The same considerations about encoding of the + \(\mathsf{tag}\) + apply as above.
++ \(\mathsf{CKDfw}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag})\) + \(\rightarrow \mathsf{K}_{child}\) + :
+For compatibility with existing deployments, we also define a mechanism to derive ad-hoc key trees for private use by applications, without ecosystem coordination. This was called "arbitrary key derivation" in previous iterations of this ZIP, but that term caused confusion as to the applicability of the mechanism.
+Since there is no guarantee of non-collision between different application protocols, and no way to tie these key trees to well-defined specification or documentation processes, use of this mechanism is NOT RECOMMENDED for new protocols.
+Let + \(\mathsf{ContextString}\) + be a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
+We instantiate the hardened key derivation process with the following constants:
+Let \(S\) be a seed byte sequence of a chosen length, which MUST be at least 32 and at most 252 bytes.
-The master extended arbitrary key is:
+The master extended ad-hoc key is:
- \(m_\mathsf{Arbitrary} = \mathsf{MKGh}^\mathsf{Arbitrary}([\mathsf{length}(\mathsf{ContextString})]\,||\,\mathsf{ContextString}\,||\,[\mathsf{length}(S)]\,||\,S)\!\) + \(m_\mathsf{Adhoc} = \mathsf{MKGh}^\mathsf{Adhoc}([\mathsf{length}(\mathsf{ContextString})]\,||\,\mathsf{ContextString}\,||\,[\mathsf{length}(S)]\,||\,S)\!\) .
\(\mathsf{CKDarb}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i)\) \(\rightarrow (\mathsf{sk}_i, \mathsf{c}_i)\) :
If the context requires a 64-byte key (for example, to avoid an entropy bottleneck in its particular subsequent operations), and +
Note: a previous iteration of this ZIP suggested that, if \(i\) - is the last element of an HD path, the concatenation + is the last element of an HD path (i.e. no extension of this path is used), then the concatenation \(\mathsf{sk}_i\,||\,\mathsf{c}_i\) - MAY be used as a key. In this case, - \((\mathsf{sk}_i, \mathsf{c}_i)\) - MUST NOT be given as input to - \(\mathsf{CKDarb}\) - (this is a restatement of the requirement that - \(i\) - is the last element of an HD path).
+ could be used as a 64-bit key. This is NOT RECOMMENDED, because it is difficult to define safe APIs that enforce the restriction that a given node in the key tree must not be used both in this way and to derive further child keys. Full-width child cryptovalue derivation provides a safe way to obtain the same functionality for new application protocols.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.
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\) @@ -881,7 +985,7 @@ 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: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.
A Sapling extended spending key \((\mathsf{ask, nsk, ovk, dk, c})\!\) @@ -1042,7 +1146,7 @@ \(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 20.
TBC
+Test vectors are available at <https://github.com/zcash/zcash-test-vectors> in the sapling_zip32, sapling_zip32_hard, orchard_zip32, zip_0032_registered, and zip_0032_arbitrary files for each format.
| 8 | -ZIP 316: Unified Addresses and Unified Viewing Keys | -
|---|
| 9 | +8 | Zcash Protocol Specification, Version 2022.2.19 or later [NU5 proposal] |
|---|
| 10 | +9 | Zcash Protocol Specification, Version 2022.2.19. Section 3.12: Mainnet and Testnet |
|---|
| 11 | +10 | Zcash Protocol Specification, Version 2022.2.19. Section 4.2.2: Sapling Key Components |
|---|
| 12 | +11 | Zcash Protocol Specification, Version 2022.2.19. Section 4.2.3: Orchard Key Components |
|---|
| 13 | +12 | Zcash Protocol Specification, Version 2022.2.19. Section 5.4.1.6: DiversifyHash^Sapling and DiversifyHash^Orchard Hash Functions |
|---|
| 14 | +13 | Zcash Protocol Specification, Version 2022.2.19. Section 5.4.6.1: Spend Authorization Signature |
|---|
| 15 | +14 | Zcash Protocol Specification, Version 2022.2.19. Section 5.4.9.3: Jubjub |
|---|
| 16 | +15 | Zcash Protocol Specification, Version 2022.2.19. Section 5.6.2.1: Sprout Payment Addresses |
|---|
| 17 | +16 | Zcash Protocol Specification, Version 2022.2.19. Section 5.6.2.3: Sprout Spending Keys |
|---|
| 18 | +17 | Zcash Protocol Specification, Version 2022.2.19. Section 5.6.3.3: Sapling Full Viewing Keys |
|---|
| 19 | +18 | Zcash Protocol Specification, Version 2022.2.19. Section 5.6.3.4: Sapling Spending Keys |
|---|
| 20 | +19 | Zcash Protocol Specification, Version 2022.2.19. Section 5.6.4.4: Orchard Raw Full Viewing Keys |
|---|
| 21 | +20 | Zcash Protocol Specification, Version 2022.2.19. Section 5.6.4.5: Orchard Spending Keys |
|---|
| 22 | +21 | NIST Special Publication 800-38G — Recommendation for Block Cipher Modes of Operation: Methods for Format-Preserving Encryption |
|---|
| 22 | +ZIP 0: ZIP Process | +
|---|
| 23 | +ZIP 316: Unified Addresses and Unified Viewing Keys | +
|---|
The +
Non-empty \(\mathsf{tag}\) - and - \(\mathsf{full\_width\_leaf}\) - inputs are reserved for use by Registered child key derivation; for other uses + inputs are reserved for use in Registered key derivation. For all other uses currently defined, \(\mathsf{tag}\) MUST be - \([\,]\) - and + \([\,]\!\) + .
+The case + \(\mathsf{full\_width\_leaf} = 1\) + is reserved for use in Full-width child cryptovalue derivation (to ensure domain separation of the full-width derivation from other cases). For all other uses currently defined, \(\mathsf{full\_width\_leaf}\) MUST be - \(\mathsf{false}\) - ( - \(\!0\!\) - ).
+ \(0\!\) + .\(\mathsf{CKDh}^\mathsf{Context}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, \mathsf{full\_width\_leaf})\) \(\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})\) @@ -673,15 +668,9 @@
Note that the resulting child spending key may produce an invalid external FVK, as specified in 11, with small probability. The corresponding internal FVK derived as specified in the next section may also be invalid with small probability.
@@ -849,7 +838,7 @@ \((\mathsf{sk}_{m}, \mathsf{c}_{m}) = \mathsf{MKGh}^\mathsf{Registered}([\mathsf{length}(\mathsf{ContextString})]\,||\,\mathsf{ContextString}\,||\,[\mathsf{length}(S)]\,||\,S)\!\) .Note: The intermediate key @@ -877,7 +866,7 @@ :
Note: a previous iteration of this ZIP suggested that, if
diff --git a/zips/zip-0032.rst b/zips/zip-0032.rst
index 4beb20ff1..11058904a 100644
--- a/zips/zip-0032.rst
+++ b/zips/zip-0032.rst
@@ -403,18 +403,21 @@ Hardened-only child key derivation
----------------------------------
As well as the integer child index $i$, the child key derivation function defined here supports a
-byte sequence $\mathsf{tag}$ and a $\mathsf{full\_width\_leaf}$ flag ($\!0$ representing $\mathsf{false}$,
-$1$ representing $\mathsf{true}$). Each triple $(i, \mathsf{tag}, \mathsf{full\_width\_leaf})$ produces
-an independent output.
+byte sequence $\mathsf{tag}$ and a $\mathsf{full\_width\_leaf}$ flag (representing a boolean value
+where $0$ means false and $1$ means true). Each triple $(i, \mathsf{tag}, \mathsf{full\_width\_leaf})$
+produces an independent output.
-The $\mathsf{tag}$ and $\mathsf{full\_width\_leaf}$ inputs are reserved for use by `Registered child key derivation`_;
-for other uses $\mathsf{tag}$ MUST be $[\,]$ and $\mathsf{full\_width\_leaf}$ MUST be $\mathsf{false}$ ($\!0$).
+Non-empty $\mathsf{tag}$ inputs are reserved for use in `Registered key derivation <#specification-registered-key-derivation>`_.
+For all other uses currently defined, $\mathsf{tag}$ MUST be $[\,]$.
+
+The case $\mathsf{full\_width\_leaf} = 1$ is reserved for use in
+`Full-width child cryptovalue derivation`_ (to ensure domain separation of the full-width derivation
+from other cases). For all other uses currently defined, $\mathsf{full\_width\_leaf}$ MUST be $0$.
$\mathsf{CKDh}^\mathsf{Context}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, \mathsf{full\_width\_leaf})$ $\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})$ :
- If $i < 2^{31}$ (non-hardened child index): return failure.
-- If $tag = [\,]$ and $\mathsf{full\_width\_leaf} = \mathsf{false}$, then let $\mathsf{leaf} = [\,]$,
- otherwise let $\mathsf{leaf} = [\mathsf{full\_width\_leaf}]$.
+- Let $\mathsf{leaf} = \begin{cases} \,[\,],&\!\!\textsf{if } \mathsf{tag} = [\,] \textsf{ and } \mathsf{full\_width\_leaf} = 0 \\ \,[\mathsf{full\_width\_leaf}],&\!\!\textsf{otherwise.}\end{cases}$
- Let $I = \mathsf{PRF^{expand}}(\mathsf{c}_{par}, [\mathsf{Context.CKDDomain}]\,||\,\mathsf{sk}_{par}\,||\,\mathsf{I2LEOSP}_{32}(i)\,||\,\mathsf{leaf}\,||\,\mathsf{tag})$.
- Split $I$ into two 32-byte sequences, $I_L$ and $I_R$.
- Return $(I_L, I_R)$.
@@ -448,7 +451,7 @@ Orchard child key derivation
$\mathsf{CKDsk}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i)$ $\rightarrow (\mathsf{sk}_{i}, \mathsf{c}_i)$ :
-- Return $\mathsf{CKDh}^\mathsf{Orchard}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, [\,], \mathsf{false})$
+- Return $\mathsf{CKDh}^\mathsf{Orchard}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, [\,], 0)$
Note that the resulting child spending key may produce an invalid external FVK, as specified
in [#protocol-orchardkeycomponents]_, with small probability. The corresponding internal FVK
@@ -556,7 +559,7 @@ The registered subtree root is obtained as:
$\mathsf{RegKD}(\mathsf{ContextString}, \mathsf{S}, \mathsf{ZipNumber})$ $\rightarrow (\mathsf{sk}_{subtree}, \mathsf{c}_{subtree})$ :
- Let $(\mathsf{sk}_{m}, \mathsf{c}_{m}) = \mathsf{MKGh}^\mathsf{Registered}([\mathsf{length}(\mathsf{ContextString})]\,||\,\mathsf{ContextString}\,||\,[\mathsf{length}(S)]\,||\,S)$.
-- Return $\mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{m}, \mathsf{c}_{m}), \mathsf{ZipNumber} + 2^{31}, [\,], \mathsf{false})$.
+- Return $\mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{m}, \mathsf{c}_{m}), \mathsf{ZipNumber} + 2^{31}, [\,], 0)$.
Note: The intermediate key $(\mathsf{sk}_{m}, \mathsf{c}_{m})$ would grant the ability to derive the
subtree root for application protocols defined in *any* ZIP using the same $\mathsf{ContextString}$
@@ -577,7 +580,7 @@ encoded.
$\mathsf{CKDreg}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag})$ $\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})$ :
-- Return $\mathsf{CKDh}^\mathsf{Arbitrary}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, \mathsf{false})$.
+- Return $\mathsf{CKDh}^\mathsf{Arbitrary}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, 0)$.
Full-width child cryptovalue derivation
---------------------------------------
@@ -589,7 +592,7 @@ The same considerations about encoding of the $\mathsf{tag}$ apply as above.
$\mathsf{CKDfw}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag})$ $\rightarrow \mathsf{K}_{child}$ :
-- Let $(I_L, I_R) = \mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, \mathsf{true})$.
+- Let $(I_L, I_R) = \mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, 1)$.
- Return $I_L\,||\,I_R$.
@@ -627,7 +630,7 @@ Ad-hoc child key derivation (deprecated)
$\mathsf{CKDarb}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i)$ $\rightarrow (\mathsf{sk}_i, \mathsf{c}_i)$ :
-- Return $\mathsf{CKDh}^\mathsf{Adhoc}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, [\,], \mathsf{false})$.
+- Return $\mathsf{CKDh}^\mathsf{Adhoc}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, [\,], 0)$.
Note: a previous iteration of this ZIP suggested that, if $i$ is the last element of an HD path
(i.e. no extension of this path is used), then the concatenation $\mathsf{sk}_i\,||\,\mathsf{c}_i$
From 41be02e2c971f1c0870faeea3a8ec2b081ca3e14 Mon Sep 17 00:00:00 2001
From: Daira-Emma Hopwood
Note: no corresponding notation is currently defined for the result of Hardened-only child key derivation with a non-empty tag and/or + \(\mathsf{full\_width\_flag}\) + set to true.
In the context of a particular application protocol defined by a ZIP, there is sometimes a need to define an HD subtree that will not collide with keys derived for other protocols, as far as that is possible to assure by following the ZIP process 22.
Within this subtree, the application protocol may use derivation paths related to those used for existing key material — for example, to derive an account-level key. The following instantiation of the hardened key generation process may be used for this purpose.
-It is strongly RECOMMENDED that implementors ensure that documentation of the usage and derivation paths of the application protocol's key tree in the corresponding ZIP is substantially complete, before public deployment of software or hardware using this mechanism. The ZIP process allows for subsequent updates and corrections.
+It is strongly RECOMMENDED that implementors ensure that documentation of the context string(s), and the usage and derivation paths of the application protocol's key tree in the corresponding ZIP are substantially complete, before public deployment of software or hardware using this mechanism. The ZIP process allows for subsequent updates and corrections.
Let \(\mathsf{ContextString}\) be a globally-unique non-empty sequence of at most 252 bytes that identifies the desired context.
@@ -866,7 +869,7 @@ :- \(\mathsf{CKDfw}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag})\) + \(\mathsf{derive\_child\_cryptovalue}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag})\) \(\rightarrow \mathsf{K}_{child}\) :
For the avoidance of doubt, the output of + \(\mathsf{derive\_child\_cryptovalue}\) + MUST NOT be provided as input to any key derivation function defined in ZIP 32. In particular, it MUST NOT be reinterpreted directly or indirectly as an input to + \(\mathsf{CKDh}\!\) + .
Note: no corresponding notation is currently defined for the result of Hardened-only child key derivation with a non-empty tag and/or - \(\mathsf{full\_width\_flag}\) - set to true.
+Note: no corresponding notation is currently defined for the result of Hardened-only child key derivation with non-zero + \(\mathsf{lead}\) + and/or non-empty + \(\mathsf{tag}\!\) + .
As well as the integer child index \(i\!\) - , the child key derivation function defined here supports a byte sequence - \(\mathsf{tag}\) - and a - \(\mathsf{full\_width\_leaf}\) - flag (representing a boolean value where - \(0\) - means false and - \(1\) - means true). Each triple - \((i, \mathsf{tag}, \mathsf{full\_width\_leaf})\) + , the child key derivation function defined here supports a lead byte + \(\mathsf{lead}\) + (used for domain separation) and byte sequence + \(\mathsf{tag}\!\) + . Each triple + \((i, \mathsf{lead}, \mathsf{tag})\) produces an independent output.
-Non-empty - \(\mathsf{tag}\) - inputs are reserved for use in Registered key derivation. For all other uses currently defined, - \(\mathsf{tag}\) - MUST be - \([\,]\!\) - .
-The case - \(\mathsf{full\_width\_leaf} = 1\) - is reserved for use in Full-width child cryptovalue derivation (to ensure domain separation of the full-width derivation from other cases). For all other uses currently defined, - \(\mathsf{full\_width\_leaf}\) - MUST be - \(0\!\) - .
- \(\mathsf{CKDh}^\mathsf{Context}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, \mathsf{full\_width\_leaf})\) + \(\mathsf{CKDh}^\mathsf{Context}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{lead}, \mathsf{tag})\) \(\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})\) :
Note that in the input to + \(\mathsf{PRF^{expand}}\!\) + , the case + \(\mathsf{lead} = 0\) + and + \(\mathsf{tag} = [\,]\) + is encoded in a way compatible with the definition of + \(\mathsf{CKDh}\) + in previous versions of this specification (before + \(\mathsf{lead}\) + and + \(\mathsf{tag}\) + were added).
Note that the resulting child spending key may produce an invalid external FVK, as specified in 11, with small probability. The corresponding internal FVK derived as specified in the next section may also be invalid with small probability.
@@ -841,7 +838,7 @@ \((\mathsf{sk}_{m}, \mathsf{c}_{m}) = \mathsf{MKGh}^\mathsf{Registered}([\mathsf{length}(\mathsf{ContextString})]\,||\,\mathsf{ContextString}\,||\,[\mathsf{length}(S)]\,||\,S)\!\) .Note: The intermediate key @@ -869,7 +866,7 @@ :
Note: a previous iteration of this ZIP suggested that, if
diff --git a/zips/zip-0032.rst b/zips/zip-0032.rst
index beb401b7e..f8b2fd156 100644
--- a/zips/zip-0032.rst
+++ b/zips/zip-0032.rst
@@ -145,7 +145,7 @@ indicate hardened derivation ($\!i' = i + 2^{31}$) as in BIP 44 [#bip-0044]_:
- $\mathsf{CKDfvk}(\mathsf{CKDfvk}(\mathsf{CKDfvk}(m_\mathsf{Sapling}, a), b), c)$ is written as $m_\mathsf{Sapling} / a / b / c$.
Note: no corresponding notation is currently defined for the result of
-`Hardened-only child key derivation`_ with a non-empty tag and/or $\mathsf{full\_width\_flag}$ set to true.
+`Hardened-only child key derivation`_ with non-zero $\mathsf{lead}$ and/or non-empty $\mathsf{tag}$.
Specification: Sapling key derivation
@@ -406,25 +406,21 @@ Hardened-only child key derivation
----------------------------------
As well as the integer child index $i$, the child key derivation function defined here supports a
-byte sequence $\mathsf{tag}$ and a $\mathsf{full\_width\_leaf}$ flag (representing a boolean value
-where $0$ means false and $1$ means true). Each triple $(i, \mathsf{tag}, \mathsf{full\_width\_leaf})$
-produces an independent output.
+lead byte $\mathsf{lead}$ (used for domain separation) and byte sequence $\mathsf{tag}$. Each triple
+$(i, \mathsf{lead}, \mathsf{tag})$ produces an independent output.
-Non-empty $\mathsf{tag}$ inputs are reserved for use in `Registered key derivation <#specification-registered-key-derivation>`_.
-For all other uses currently defined, $\mathsf{tag}$ MUST be $[\,]$.
-
-The case $\mathsf{full\_width\_leaf} = 1$ is reserved for use in
-`Full-width child cryptovalue derivation`_ (to ensure domain separation of the full-width derivation
-from other cases). For all other uses currently defined, $\mathsf{full\_width\_leaf}$ MUST be $0$.
-
-$\mathsf{CKDh}^\mathsf{Context}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, \mathsf{full\_width\_leaf})$ $\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})$ :
+$\mathsf{CKDh}^\mathsf{Context}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{lead}, \mathsf{tag})$ $\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})$ :
- If $i < 2^{31}$ (non-hardened child index): return failure.
-- Let $\mathsf{leaf} = \begin{cases} \,[\,],&\!\!\textsf{if } \mathsf{tag} = [\,] \textsf{ and } \mathsf{full\_width\_leaf} = 0 \\ \,[\mathsf{full\_width\_leaf}],&\!\!\textsf{otherwise.}\end{cases}$
-- Let $I = \mathsf{PRF^{expand}}(\mathsf{c}_{par}, [\mathsf{Context.CKDDomain}]\,||\,\mathsf{sk}_{par}\,||\,\mathsf{I2LEOSP}_{32}(i)\,||\,\mathsf{leaf}\,||\,\mathsf{tag})$.
+- Let $\mathsf{lead\_enc} = \begin{cases} \,[\,],&\!\!\textsf{if } \mathsf{lead} = 0 \textsf{ and } \mathsf{tag} = [\,] \\ \,[\mathsf{lead}],&\!\!\textsf{otherwise.}\end{cases}$
+- Let $I = \mathsf{PRF^{expand}}(\mathsf{c}_{par}, [\mathsf{Context.CKDDomain}]\,||\,\mathsf{sk}_{par}\,||\,\mathsf{I2LEOSP}_{32}(i)\,||\,\mathsf{lead\_enc}\,||\,\mathsf{tag})$.
- Split $I$ into two 32-byte sequences, $I_L$ and $I_R$.
- Return $(I_L, I_R)$.
+Note that in the input to $\mathsf{PRF^{expand}}$, the case $\mathsf{lead} = 0$ and $\mathsf{tag} = [\,]$
+is encoded in a way compatible with the definition of $\mathsf{CKDh}$ in previous versions of this
+specification (before $\mathsf{lead}$ and $\mathsf{tag}$ were added).
+
Specification: Orchard key derivation
=====================================
@@ -454,7 +450,7 @@ Orchard child key derivation
$\mathsf{CKDsk}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i)$ $\rightarrow (\mathsf{sk}_{i}, \mathsf{c}_i)$ :
-- Return $\mathsf{CKDh}^\mathsf{Orchard}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, [\,], 0)$
+- Return $\mathsf{CKDh}^\mathsf{Orchard}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, 0, [\,])$
Note that the resulting child spending key may produce an invalid external FVK, as specified
in [#protocol-orchardkeycomponents]_, with small probability. The corresponding internal FVK
@@ -563,7 +559,7 @@ The registered subtree root is obtained as:
$\mathsf{RegKD}(\mathsf{ContextString}, \mathsf{S}, \mathsf{ZipNumber})$ $\rightarrow (\mathsf{sk}_{subtree}, \mathsf{c}_{subtree})$ :
- Let $(\mathsf{sk}_{m}, \mathsf{c}_{m}) = \mathsf{MKGh}^\mathsf{Registered}([\mathsf{length}(\mathsf{ContextString})]\,||\,\mathsf{ContextString}\,||\,[\mathsf{length}(S)]\,||\,S)$.
-- Return $\mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{m}, \mathsf{c}_{m}), \mathsf{ZipNumber} + 2^{31}, [\,], 0)$.
+- Return $\mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{m}, \mathsf{c}_{m}), \mathsf{ZipNumber} + 2^{31}, 0, [\,])$.
Note: The intermediate key $(\mathsf{sk}_{m}, \mathsf{c}_{m})$ would grant the ability to derive the
subtree root for application protocols defined in *any* ZIP using the same $\mathsf{ContextString}$
@@ -584,7 +580,7 @@ encoded.
$\mathsf{CKDreg}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag})$ $\rightarrow (\mathsf{sk}_{child}, \mathsf{c}_{child})$ :
-- Return $\mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, 0)$.
+- Return $\mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, 0, \mathsf{tag})$.
Full-width child cryptovalue derivation
---------------------------------------
@@ -596,7 +592,7 @@ The same considerations about encoding of the $\mathsf{tag}$ apply as above.
$\mathsf{derive\_child\_cryptovalue}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag})$ $\rightarrow \mathsf{K}_{child}$ :
-- Let $(I_L, I_R) = \mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, \mathsf{tag}, 1)$.
+- Let $(I_L, I_R) = \mathsf{CKDh}^\mathsf{Registered}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, 1, \mathsf{tag})$.
- Return $I_L\,||\,I_R$.
For the avoidance of doubt, the output of $\mathsf{derive\_child\_cryptovalue}$
@@ -639,7 +635,7 @@ Ad-hoc child key derivation (deprecated)
$\mathsf{CKDarb}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i)$ $\rightarrow (\mathsf{sk}_i, \mathsf{c}_i)$ :
-- Return $\mathsf{CKDh}^\mathsf{Adhoc}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, [\,], 0)$.
+- Return $\mathsf{CKDh}^\mathsf{Adhoc}((\mathsf{sk}_{par}, \mathsf{c}_{par}), i, 0, [\,])$.
Note: a previous iteration of this ZIP suggested that, if $i$ is the last element of an HD path
(i.e. no extension of this path is used), then the concatenation $\mathsf{sk}_i\,||\,\mathsf{c}_i$
From 0b665807e2ae733dd90f3cb505d397c807145bfa Mon Sep 17 00:00:00 2001
From: Jack Grigg 203 Transaction Expiry Final
205 Deployment of the Sapling Network Upgrade Final
206 Deployment of the Blossom Network Upgrade Final
- 207 Funding Streams [Pre-NU6] Final, [NU6] Implemented (zcashd and zebrad)
+ 207 Funding Streams [Canopy, NU6] Final
208 Shorter Block Target Spacing Final
209 Prohibit Negative Shielded Chain Value Pool Balances Final
211 Disabling Addition of New Value to the Sprout Chain Value Pool Final
212 Allow Recipient to Derive Ephemeral Secret from Note Plaintext Final
213 Shielded Coinbase Final
- 214 Consensus rules for a Zcash Development Fund [Revision 0] Final, [Revision 1] Implemented (zcashd and zebrad)
+ 214 Consensus rules for a Zcash Development Fund [Revision 0: Canopy, Revision 1: NU6] Final
215 Explicitly Defining and Modifying Ed25519 Validation Rules Final
216 Require Canonical Jubjub Point Encodings Final
221 FlyClient - Consensus-Layer Changes Final
224 Orchard Shielded Protocol Final
225 Version 5 Transaction Format Final
- 236 Blocks should balance exactly Implemented (zcashd and zebrad)
+ 236 Blocks should balance exactly Final
239 Relay of Version 5 Transactions Final
243 Transaction Signature Validation for Sapling Final
244 Transaction Identifier Non-Malleability Final
250 Deployment of the Heartwood Network Upgrade Final
251 Deployment of the Canopy Network Upgrade Final
252 Deployment of the NU5 Network Upgrade Final
- 253 Deployment of the NU6 Network Upgrade Implemented (zcashd and zebrad)
+ 253 Deployment of the NU6 Network Upgrade Final
300 Cross-chain Atomic Transactions Proposed
301 Zcash Stratum Protocol Final
308 Sprout to Sapling Migration Final
@@ -123,7 +123,7 @@ Released ZIPs
321 Payment Request URIs Proposed
401 Addressing Mempool Denial-of-Service Active
1014 Establishing a Dev Fund for ECC, ZF, and Major Grants Active
- 1015 Block Subsidy Allocation for Non-Direct Development Funding Proposed
+ 1015 Block Subsidy Allocation for Non-Direct Development Funding Final
2001 Lockbox Funding Streams Implemented (zcashd and zebrad)
This proposal was initially deployed with Canopy. 18
-Changes to support deferred funding streams are to be deployed with NU6. 19
+Changes to support deferred funding streams were deployed with NU6. 19
This proposal intentionally creates what is known as a "bilateral consensus rule change". Use of this mechanism requires that all network participants upgrade their software to a compatible version within the upgrade window. Older software will treat post-upgrade blocks as invalid, and will follow any pre-upgrade consensus branch that persists.
diff --git a/rendered/zip-0214.html b/rendered/zip-0214.html index 75a60ab89..267c34704 100644 --- a/rendered/zip-0214.html +++ b/rendered/zip-0214.html @@ -10,7 +10,7 @@ Title: Consensus rules for a Zcash Development Fund Owners: Daira-Emma Hopwood <daira-emma@electriccoin.co> Kris Nuttycombe <kris@nutty.land> -Status: [Revision 0] Final, [Revision 1] Implemented (zcashd and zebrad) +Status: [Revision 0: Canopy, Revision 1: NU6] Final Category: Consensus Created: 2020-02-28 License: MIT @@ -356,7 +356,8 @@It was judged to be unnecessary to have a mechanism to update funding stream definitions (in case of security breach or changes to direct grant recipients) other than at network upgrades.
Revision 0 of this proposal was deployed with Canopy. 11 Revision 1 of this proposal is intended to be deployed with NU6. 12
+Revision 0 of this proposal was deployed with Canopy. 11
+Revision 1 of this proposal was deployed with NU6. 12
| 252 | Deployment of the NU5 Network Upgrade | Final |
| 253 | Deployment of the NU6 Network Upgrade | Final |
| 300 | Cross-chain Atomic Transactions | Proposed | -
| 301 | Zcash Stratum Protocol | Final | -
| 308 | Sprout to Sapling Migration | Final | -
| 316 | Unified Addresses and Unified Viewing Keys | [Revision 0] Final, [Revision 1] Proposed | +
| 301 | Zcash Stratum Protocol | Active | +
| 308 | Sprout to Sapling Migration | Active | +
| 316 | Unified Addresses and Unified Viewing Keys | [Revision 0] Active, [Revision 1] Proposed |
| 317 | Proportional Transfer Fee Mechanism | Active | -
| 320 | Defining an Address Type to which funds can only be sent from Transparent Addresses | Proposed | -
| 321 | Payment Request URIs | Proposed | +
| 320 | Defining an Address Type to which funds can only be sent from Transparent Addresses | Active | +
| 321 | Payment Request URIs | Active |
| 401 | Addressing Mempool Denial-of-Service | Active |
| 1014 | Establishing a Dev Fund for ECC, ZF, and Major Grants | Active |
| 1015 | Block Subsidy Allocation for Non-Direct Development Funding | Final | -
| 2001 | Lockbox Funding Streams | Implemented (zcashd and zebrad) | +
| 2001 | Lockbox Funding Streams | Final |
These are works-in-progress that have been assigned ZIP numbers. These will eventually become either Proposed (and thus Released), or one of Withdrawn, Rejected, or Obsolete.
@@ -233,14 +233,14 @@ZIP: 325
+Title: Account Metadata Keys
+Owners: Jack Grigg <jack@electriccoin.co>
+ Daira-Emma Hopwood <daira@electriccoin.co>
+ Kris Nuttycombe <kris@electriccoin.co>
+Status: Draft
+Category: Standards / Wallet
+Created: 2025-02-18
+License: MIT
+
+
+The key words “MUST NOT”, “SHOULD”, and “MAY” in this +document are to be interpreted as described in BCP 14 1 when, and +only when, they appear in all capitals.
+ +This ZIP specifies the key tree for Account Metadata Keys. These are derived +from the same seed as a ZIP 32 2 account, and can be used by wallets +to derive encryption keys for local / off-chain metadata.
+ +A wallet’s main data source is the Zcash chain: from this it can detect notes +received by an account, determine whether those notes are spent, build witnesses +for spending, recover on-chain memo data, and so on. However, wallets also +generate significant quantities of off-chain metadata as they are used, such as:
+ +This metadata is valuable to users, and highly desirable to ensure to be backed up. +If the user’s device is wiped or lost and the user recovers their wallet from a +backed-up mnemonic phrase, they will lose all of this metadata if it is not +stored somewhere.
+ +For other kinds of mobile device data, it is expected by users that their device’s +normal backup storage will have saved (most of) their data, such that access to +e.g. the associated Apple or Google account will be sufficient for data recovery. +However, metadata such as mappings between Zcash addresses and recipient names can +be particularly sensitive, meaning that users may not want these to be backed up +unencrypted in their device’s normal backup storage. Similarly, the inability to +alter on-chain data means that permanently storing metadata in transaction memo +fields may also not be an option.
+ +Additionally, it is currently the case that users only need to back up a single +secret (a mnemonic seed phrase), once, in order to recover all information for +accounts derived from that secret. If metadata were encrypted using independent +key material, these keys would also need to be backed up, leading to fragility +of wallet restoration.
+ +This ZIP registers the following ZIP 32 Registered Key Derivation 3 +tree:
+ +The tree has the following general structure, specified in more detail below:
+ +Non-leaf keys in the key tree MUST NOT be used directly to encrypt metadata. +Encryption keys are leaves in this key tree. The sole exception to this is +private-use keys (for which part of their key derivation is outside the scope of +this specification): encryption keys MAY be derived from the private-use key +leaves.
+ +The Account Metadata Key is the root of a subtree that corresponds to a ZIP 32 +account represented elsewhere in the overall tree. It is derived from the seed +\(\mathsf{S}\) as:
+ +\(\mathsf{AccountMetadataKey} = \mathsf{CKDreg}(\mathsf{CKDreg}(\mathsf{RegKD}(\texttt{“MetadataKeys”}, \mathsf{S}, 325), \mathsf{coinType}, [\,]), \mathsf{account}, [\,])\)
+ +or, in path notation:
+ +m_metadata / 325' / coin_type' / account'
+
+
+The Account-level Inherent Metadata Key’s subtree contains keys used for +metadata associated with the Account Metadata Key’s corresponding account. The +key is derived as:
+ +\(\mathsf{CKDreg}(\mathsf{AccountMetadataKey}, 0, [\,])\)
+ +The Account-level External Metadata Key’s subtree contains keys used for +metadata associated with imported UFVKs. Unlike the inherent metadata keys which +can leverage the inherent domain separation provided by the account index, here +domain separation between metadata keys is provided by the UFVKs themselves.
+ +As UFVKs may in general change over time (due to the inclusion of new +higher-preference FVK items, or removal of older deprecated FVK items), there is +no guarantee that the exact same set of FVK items will be present at both backup +creation time and recovery time. Instead, the most preferred FVK item within a +UFVK is used as the domain in which keys can be generated, and the Imported +UFVK Metadata Key is derived as:
+ +\(\mathsf{CKDreg}(\mathsf{CKDreg}(\mathsf{AccountMetadataKey}, 1, [\,]), 0, \mathsf{FVKTypedItem})\)
+ +where \(\mathsf{FVKTypedItem}\) is the encoding of the most preferred FVK +item within the ZIP 316 raw encoding of a UFVK. 4
+ +Usage of the Imported UFVK Metadata Key trees SHOULD follow ZIP 316 preference +order: 4
+ +The following metadata protocols have been standardised:
+ +The remaining range of child indices from 0 to \(\texttt{0x7FFFFFFE}\) inclusive +are reserved for future updates to this ZIP. Wallet developers can propose new +standardised metadata protocols by writing a 2000-series ZIP that specifies the +protocol as an update to this ZIP.
+ +In some contexts there is a need for deriving ad-hoc key trees for private use +by wallets, without ecosystem coordination and without any kind of compatibility +guarantees. This ZIP reserves child index \(\mathtt{0x7FFFFFFF}\) (the maximum +valid hardened child index) within its key tree for this purpose.
+ +:::warning +It is the responsibility of wallet developers to ensure that they do not use +colliding \(\mathsf{PrivateUseSubject}\) values, and to analyse their private use for +any security risks related to potential cross-protocol attacks (in the event that +two wallet developers happen to select a colliding \(\mathsf{PrivateUseSubject}\)). +Wallet developers that are unwilling to accept these risks SHOULD propose new +standardised metadata protocols instead, to benefit from ecosystem coordination +and review. +::: +
+ +