diff --git a/zip-0316.html b/zip-0316.html
index 4fd6440d3..6cc68afa1 100644
--- a/zip-0316.html
+++ b/zip-0316.html
@@ -24,7 +24,7 @@
License: MIT
Discussions-To: <https://github.com/zcash/zips/issues/482>
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. The key words "MUST", "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. The terms below are to be interpreted as follows: Notation for sequences, conversions, and arithmetic operations follows the Zcash protocol specification 3.Terminology
-
Each of these has its own Address Encodings, as a string and as a QR code. (Since the QR code is derivable from the string encoding as described in 9, for many purposes it suffices to consider the string encoding.)
-The Orchard proposal 26 adds a new Address type, Orchard Addresses.
+Each of these has its own Address Encodings, as a string and as a QR code. (Since the QR code is derivable from the string encoding as described in 8, for many purposes it suffices to consider the string encoding.)
+The Orchard proposal 24 adds a new Address type, Orchard Addresses.
The difficulty with defining new Address Encodings for each Address type, is that end-users are forced to be aware of the various types, and in particular which types are supported by a given Consumer or Recipient. In order to make sure that transfers are completed successfully, users may be forced to explicitly generate Addresses of different types and re-distribute encodings of them, which adds significant friction and cognitive overhead to understanding and using Zcash.
The goals for a Unified Address standard are as follows:
Unified Addresses specify multiple methods for payment to a Recipient's wallet. The Sender's wallet can then non-interactively select the method of payment.
Importantly, any wallet can support Unified Addresses, even when that wallet only supports a subset of payment methods for receiving and/or sending.
-Despite having some similar characteristics, the Unified Address standard is orthogonal to Payment Request URIs 28 and similar schemes. Since Payment Requests encode addresses as alphanumeric strings, no change to ZIP 321 is required in order to use Unified Addresses in Payment Requests.
+Despite having some similar characteristics, the Unified Address standard is orthogonal to Payment Request URIs 26 and similar schemes. Since Payment Requests encode addresses as alphanumeric strings, no change to ZIP 321 is required in order to use Unified Addresses in Payment Requests.
Wallets follow a model Interaction Flow as follows:
@@ -123,21 +121,21 @@When new Transport Protocols are introduced to the Zcash protocol after Unified Addresses are standardized, those should introduce new Receiver Types but not different Address types outside of the UA standard. There needs to be a compelling reason to deviate from the standard, since the benefits of UA come precisely from their applicability across all new protocol upgrades.
Every wallet must properly parse encodings of a Unified Address or Unified Viewing Key containing unrecognised Items.
-A wallet may process unrecognised Items by indicating to the user their presence or similar information for usability or diagnostic purposes.
+Every wallet must properly parse encodings of a Unified Address or Unified Viewing Key containing unrecognized Items.
+A wallet may process unrecognized Items by indicating to the user their presence or similar information for usability or diagnostic purposes.
The Unified String Encoding is “opaque” to human readers: it does not allow visual identification of which Receivers or Receiver Types are present.
The Unified String Encoding is resilient against typos, transcription errors, cut-and-paste errors, truncation, or other likely UX hazards.
There is a well-defined Unified QR Encoding of a Unified Address (or UFVK or UIVK) as a QR code, which produces QR codes that are reasonably compact and robust.
There is a well-defined transformation between the Unified QR Encoding and Unified String Encoding of a given UA/UVK in either direction.
-The Unified String Encoding fits into ZIP-321 Payment URIs 28 and general URIs without introducing parse ambiguities.
+The Unified String Encoding fits into ZIP-321 Payment URIs 26 and general URIs without introducing parse ambiguities.
The encoding must support sufficiently many Recipient Types to allow for reasonable future expansion.
-The encoding must allow all wallets to safely and correctly parse out unrecognised Receiver Types well enough to ignore them.
+The encoding must allow all wallets to safely and correctly parse out unrecognized Receiver Types well enough to ignore them.
When executing a Transfer the Sender selects a Receiver via a Selection process.
-Given a valid UA, Selection must treat any unrecognised Item as though it were absent.
+Given a valid UA, Selection must treat any unrecognized Item as though it were absent.
Unified Addresses and Unified Viewing Keys must be able to include Receivers and Viewing Keys of experimental types, possibly alongside non-experimental ones. These experimental Receivers or Viewing Keys must be used only by wallets whose users have explicitly opted into the corresponding experiment.
A Unified Full Viewing Key (resp. Unified Incoming Viewing Key) can be used in a similar way to a Full Viewing Key (resp. Incoming Viewing Key) as described in the Zcash Protocol Specification 2.
-For a Transparent P2PKH Address that is derived according to BIP 32 29 and BIP 44 32, the nearest equivalent to a Full Viewing Key or Incoming Viewing Key for a given BIP 44 account is an extended public key, as defined in the section “Extended keys” of BIP 32. Therefore, UFVKs and UIVKs should be able to include such extended public keys.
+A Unified Full Viewing Key (resp. Unified Incoming Viewing Key) can be used in a similar way to a Full Viewing Key (resp. Incoming Viewing Key) as described in the Zcash Protocol Specification 2.
+For a Transparent P2PKH Address that is derived according to BIP 32 27 and BIP 44 30, the nearest equivalent to a Full Viewing Key or Incoming Viewing Key for a given BIP 44 account is an extended public key, as defined in the section “Extended keys” of BIP 32. Therefore, UFVKs and UIVKs should be able to include such extended public keys.
A wallet should support deriving a UIVK from a UFVK, and a Unified Address from a UIVK.
Privacy impacts of transparent or cross-pool transactions, and the associated UX issues, will be addressed in ZIP 315 (in preparation).
Rather than defining a Bech32 string encoding of Orchard Shielded Payment Addresses, we instead define a Unified Address format that is able to encode a set of Receivers of different types. This enables the Consumer of a Unified Address to choose the Receiver of the best type it supports, providing a better user experience as new Receiver Types are added in the future.
@@ -168,10 +161,10 @@A Receiver Encoding is the raw encoding of a Shielded Payment Address, or the \(160\!\) - -bit script hash of a P2SH address 37, or the + -bit script hash of a P2SH address 35, or the \(160\!\) - -bit validating key hash of a P2PKH address 36.
+ -bit validating key hash of a P2PKH address 34.Let padding
be the Human-Readable Part of the Unified Address in US-ASCII, padded to 16 bytes with zero bytes. We append padding
to the concatenated encodings, and then apply the
\(\mathsf{F4Jumble}\)
algorithm as described in Jumbling. (In order for the limitation on the
@@ -220,7 +213,7 @@
\(\ell^\mathsf{MAX}_M - 16\)
bytes, where
\(\ell^\mathsf{MAX}_M\)
- is defined in Jumbling.) The output is then encoded with Bech32m 35, ignoring any length restrictions. This is chosen over Bech32 in order to better handle variable-length inputs.
To decode a Unified Address Encoding, a Consumer MUST use the following procedure:
padding
be the Human-Readable Part, padded to 16 bytes as for encoding. If the result ends in padding
, remove these 16 bytes; otherwise reject.For Unified Addresses on Mainnet, the Human-Readable Part (as defined in 35) is “u
”. For Unified Addresses on Testnet, the Human-Readable Part is “utest
”.
For Unified Addresses on Mainnet, the Human-Readable Part (as defined in 33) is “u
”. For Unified Addresses on Testnet, the Human-Readable Part is “utest
”.
A wallet MAY allow its user(s) to configure which Receiver Types it can send to. It MUST NOT allow the user(s) to change the order of the Priority List used to choose the Receiver Type, except by opting into experiments.
The Human-Readable Parts (as defined in 35) of Unified Viewing Keys are defined as follows:
+The Human-Readable Parts (as defined in 33) of Unified Viewing Keys are defined as follows:
uivk
” for Unified Incoming Viewing Keys on Mainnet;uivktest
” for Unified Incoming Viewing Keys on Testnet;The rationale for requiring Items to be canonically ordered by Typecode is that it enables implementations to use an in-memory representation that discards ordering, while retaining the same round-trip serialization of a UA / UVK (provided that unrecognised Items are retained).
+The rationale for requiring Items to be canonically ordered by Typecode is that it enables implementations to use an in-memory representation that discards ordering, while retaining the same round-trip serialization of a UA / UVK (provided that unrecognized Items are retained).
It is intended that new Receiver Types and Viewing Key Types SHOULD be introduced either by a modification to this ZIP or by a new ZIP, in accordance with the ZIP Process 14.
+It is intended that new Receiver Types and Viewing Key Types SHOULD be introduced either by a modification to this ZIP or by a new ZIP, in accordance with the ZIP Process 13.
For experimentation prior to proposing a ZIP, experimental types MAY be added using the reserved Typecodes \(\mathtt{0xFFFA}\) to @@ -338,58 +331,8 @@ to \(\mathtt{0xFC}\) inclusive are reserved to indicate Metadata Items other than Receivers or Viewing Keys. These Items MAY affect the overall interpretation of the UA / UVK (for example, by specifying an expiration date).
-As of Revision 1, the subset of Metadata Typecodes in the range - \(mathtt{0xE0}\) - to - \(mathtt{0xEF}\) - inclusive are designated as "MUST-understand": if a Consumer is unable to recognise the meaning of a Metadata Item with a Typecode in this range, then it MUST regard the entire UA/UVK as unsupported and not process it further.
Since Metadata Items are not Receivers, they MUST NOT be selected by a Sender when choosing a Receiver to send to, and since they are not Viewing Keys, they MUST NOT provide additional authority to view information about transactions.
-New Metadata Types SHOULD be introduced either by a modification to this ZIP or by a new ZIP, in accordance with the ZIP Process 14.
-As of Revision 1, Typecodes - \(\mathtt{0xE0}\) - and - \(\mathtt{0xE1}\) - are reserved for optional address expiry metadata. A producer MAY choose to generate Unified Addresses containing either or both of the following Metadata Item Types, or none.
-The value of a - \(\mathtt{0xE0}\) - item MUST be an unsigned 32-bit integer in little-endian order specifying the Address Expiry Height, a block height of the Zcash chain associated with the UA/UVK. A Unified Address containing metadata Typecode - \(\mathtt{0xE0}\) - MUST be considered expired when the height of the Zcash chain is greater than this value.
-The value of a - \(\mathtt{0xE1}\) - item MUST be an unsigned 64-bit integer in little-endian order specifying a Unix Epoch Time, hereafter referred to as the Address Expiry Time. A Unified Address containing Metadata Typecode - \(\mathtt{0xE1}\) - MUST be considered expired when the current time is after the Address Expiry Time.
-A Sender that supports Revision 1 of this specification MUST set a non-zero nExpiryHeight
field in transactions that it creates. If the nExpiryHeight
normally constructed by the Sender would be greater than the Address Expiry Height, then the transaction MUST NOT be sent. If only an Address Expiry Time is specified, then the Sender SHOULD choose a value for nExpiryHeight
such that the transaction will expire no more than 24 hours after the current time. If both
- \(\mathtt{0xE0}\)
- and
- \(\mathtt{0xE1}\)
- Metadata Items are present, then both restrictions apply.
If wallet user attempts to send to an expired address, the error presented to the user by the wallet SHOULD include a suggestion that the user should attempt to obtain a currently-valid address for the intended recipient. A wallet MUST NOT send to an address that it knows to have expired.
-Address expiration imposes no constraints on the Producer of an address. A Producer MAY generate multiple Unified Addresses with the same Receivers but different expiration metadata and/or any number of distinct Diversified Unified Addresses with the same or different expiry metadata, in any combination.
-When deriving a UIVK from a UFVK containing Typecodes - \(\mathtt{0xE0}\) - and/or - \(\mathtt{0xE1}\) - , these Metadata Items MUST be retained unmodified in the derived UIVK.
-When deriving a Unified Address from a UFVK or UIVK containing a Metadata Item having Typecode - \(\mathtt{0xE0}\) - , the derived Unified Address MUST contain a Metadata Item having Typecode - \(\mathtt{0xE0}\) - such that the Address Expiry Height of the resulting address is less than or equal to the Expiry Height of the viewing key.
-When deriving a Unified Address from a UFVK or UIVK containing a Metadata Item having Typecode - \(\mathtt{0xE1}\) - , the derived Unified Address MUST contain a Metadata Item having Typecode - \(\mathtt{0xE1}\) - such that the Address Expiry Time of the resulting address is less than or equal to the Expiry Time of the viewing key.
-Producers of Diversified Unified Addresses should be aware that the expiration metadata could potentially be used to link addresses from the same source. Normally, if Diversified Unified Addresses derived from the same UIVK contain only Sapling and/or Orchard Receivers and no Metadata Items, they will be unlinkable as described in 8; this property does not hold when Metadata Items are present. It is RECOMMENDED that when deriving Unified Addresses from a UFVK or UIVK containing expiry metadata that the Expiry Height and Expiry Time of each distinct address vary from one another, so as to reduce the likelihood that addresses may be linked via their expiry metadata.
-The intent of this specification is that Consumers of Unified Addresses must not send to expired addresses. If only an Address Expiry Time is specified, a transaction to the associated address could be mined after the Address Expiry Time within a 24-hour window.
-The reason that the transaction MUST NOT be sent when its nExpiryHeight
as normally constructed is greater than the Address Expiry Height is to avoid unnecessary information leakage in that field about which address was used as the destination. If a sender were to instead use the expiry height to directly set the nExpiryHeight
field, this would leak the expiry information of the destination address, which may then be identifiable.
When honoring an Address Expiry Time, the reason that a sender SHOULD choose a nExpiryHeight
that is expected to occur within 24 hours of the time of transaction construction is to, when possible, ensure that the expiry time is respected to within a day. Address Expiry Times are advisory and do not represent hard bounds because computer clocks often disagree, but every effort should be made to ensure that transactions expire instead of being mined more than 24 hours after a recipient address's expiry time. When chain height information is available to the Sender, it is both permissible and advisable to set this bound more tightly; a common expiry delta used by many wallets is 40 blocks from the current chain tip, as suggested in ZIP 203 24.
Currently no Metadata Types are defined. New Metadata Types SHOULD be introduced either by a modification to this ZIP or by a new ZIP, in accordance with the ZIP Process 13.
In addition to external addresses suitable for giving out to Senders, a wallet typically requires addresses for internal operations such as change and auto-shielding.
@@ -413,7 +356,7 @@ \(\mathsf{CRH^{ivk}}\) or \(\mathsf{Commit^{ivk}}\) - (for Sapling and Orchard respectively). Derivation of an internal shielded FVK from an external shielded FVK is specified in the "Sapling internal key derivation" 18 and "Orchard internal key derivation" 20 sections of ZIP 32. + (for Sapling and Orchard respectively). Derivation of an internal shielded FVK from an external shielded FVK is specified in the "Sapling internal key derivation" 17 and "Orchard internal key derivation" 19 sections of ZIP 32.To satisfy the above properties for transparent (P2PKH) keys, we derive the external and internal \(\mathsf{ovk}\) components from the transparent FVK @@ -426,7 +369,7 @@ \(\mathsf{ser_P}(pk)\) is \(33\) - bytes, as specified in 30. + bytes, as specified in 28.
Since an external P2PKH FVK encodes the chain code and public key at the Account level, we can derive both external and internal child keys from it, as described in BIP 44 33. It is possible to derive an internal P2PKH FVK from the external P2PKH FVK (i.e. its parent) without having the external spending key, because child derivation at the Change level is non-hardened.
+Since an external P2PKH FVK encodes the chain code and public key at the Account level, we can derive both external and internal child keys from it, as described in BIP 44 31. It is possible to derive an internal P2PKH FVK from the external P2PKH FVK (i.e. its parent) without having the external spending key, because child derivation at the Change level is non-hardened.
As a consequence of the specification in MUST-understand Typecodes, as of Revision 1 a Consumer of a UFVK MUST understand the meaning of all "MUST-understand" Metadata Item Typecodes present in the UFVK in order to derive a UIVK from it.
-For Metadata Items recognised by the Consumer, the processing of the Item when deriving a UIVK is specified in the section or ZIP describing that Item.
The following derivations are applied to each component FVK:
In each case, the Typecode remains the same as in the FVK.
-Items (including Metadata Items that are not "MUST-understand") that are unrecognised by a given Consumer, or that are specified in experiments that the user has not opted into (see Experimental Usage), MUST be dropped when deriving a UIVK from a UFVK.
+Items (including Metadata Items) that are unrecognized by a given Consumer, or that are specified in experiments that the user has not opted into (see Experimental Usage), MUST be dropped when deriving a UIVK from a UFVK.
As a consequence of the specification in MUST-understand Typecodes, as of Revision 1 a Consumer of a UIVK MUST understand the meaning of all "MUST-understand" Metadata Item Typecodes present in the UIVK in order to derive a Unified Address from it.
-For Metadata Items recognised by the Consumer, the processing of the Item when deriving a Unified Address is specified in the section or ZIP describing that Item.
To derive a Unified Address from a UIVK we need to choose a diversifier index, which MUST be valid for all of the Viewing Key Types in the UIVK. That is,
The following derivations are applied to each component IVK using the diversifier index:
In each case, the Typecode remains the same as in the IVK.
-Items (including Metadata Items that are not "MUST-understand") that are unrecognised by a given Consumer, or that are specified in experiments that the user has not opted into (see Experimental Usage), MUST be dropped when deriving a Unified Address from a UIVK.
-See Address Expiration Metadata for discussion of potential linking of Diversified Unified Addresses via their metadata.
+Items (including Metadata Items) that are unrecognized by a given Consumer, or that are specified in experiments that the user has not opted into (see Experimental Usage), MUST be dropped when deriving a Receiver from a UIVK.
When a Sender constructs a transaction that creates Sapling or Orchard notes, it uses an outgoing viewing key, as described in 6 and 7, to encrypt an outgoing ciphertext. Decryption with the outgoing viewing key allows recovering the sent note plaintext, including destination address, amount, and memo. The intention is that this outgoing viewing key should be associated with the source of the funds.
-However, the specification of which outgoing viewing key should be used is left somewhat open in 6 and 7; in particular, it was unclear whether transfers should be considered as being sent from an address, or from a ZIP 32 account 21. The adoption of multiple shielded protocols that support outgoing viewing keys (i.e. Sapling and Orchard) further complicates this question, since from NU5 activation, nothing at the consensus level prevents a wallet from spending both Sapling and Orchard notes in the same transaction. (Recommendations about wallet usage of multiple pools will be given in ZIP 315 27.)
+When a Sender constructs a transaction that creates Sapling or Orchard notes, it uses an outgoing viewing key, as described in 6 and 7, to encrypt an outgoing ciphertext. Decryption with the outgoing viewing key allows recovering the sent note plaintext, including destination address, amount, and memo. The intention is that this outgoing viewing key should be associated with the source of the funds.
+However, the specification of which outgoing viewing key should be used is left somewhat open in 6 and 7; in particular, it was unclear whether transfers should be considered as being sent from an address, or from a ZIP 32 account 20. The adoption of multiple shielded protocols that support outgoing viewing keys (i.e. Sapling and Orchard) further complicates this question, since from NU5 activation, nothing at the consensus level prevents a wallet from spending both Sapling and Orchard notes in the same transaction. (Recommendations about wallet usage of multiple pools will be given in ZIP 315 25.)
Here we refine the protocol specification in order to allow more precise determination of viewing authority for UFVKs.
A Sender will attempt to determine a "sending Account" for each transfer. The preferred approach is for the API used to perform a transfer to directly specify a sending Account. Otherwise, if the Sender can ascertain that all funds used in the transfer are from addresses associated with some Account, then it SHOULD treat that as the sending Account. If not, then the sending Account is undetermined.
The Sender also determines a "preferred sending protocol" —one of "transparent", "Sapling", or "Orchard"— corresponding to the most preferred Receiver Type (as given in Encoding of Unified Addresses) of any funds sent in the transaction.
@@ -802,11 +740,11 @@ -8 | -Zcash Protocol Specification, Version 2023.4.0. Section 5.4.1.6: DiversifyHash^Sapling and DiversifyHash^Orchard Hash Functions | +Zcash Protocol Specification, Version 2022.2.19. Section 4.7.3: Sending Notes (Orchard) |
---|
9 | -Zcash Protocol Specification, Version 2023.4.0. Section 5.6: Encodings of Addresses and Keys | +8 | +Zcash Protocol Specification, Version 2022.2.19. Section 5.6: Encodings of Addresses and Keys |
---|
10 | -Zcash Protocol Specification, Version 2023.4.0. Section 5.6.3.1: Sapling Payment Addresses | +9 | +Zcash Protocol Specification, Version 2022.2.19. Section 5.6.3.1: Sapling Payment Addresses |
---|
11 | -Zcash Protocol Specification, Version 2023.4.0. Section 5.6.4.2: Orchard Raw Payment Addresses | +10 | +Zcash Protocol Specification, Version 2022.2.19. Section 5.6.4.2: Orchard Raw Payment Addresses |
---|
12 | -Zcash Protocol Specification, Version 2023.4.0. Section 5.6.4.3: Orchard Raw Incoming Viewing Keys | +11 | +Zcash Protocol Specification, Version 2022.2.19. Section 5.6.4.3: Orchard Raw Incoming Viewing Keys |
---|
13 | -Zcash Protocol Specification, Version 2023.4.0. Section 5.6.4.4: Orchard Raw Full Viewing Keys | +12 | +Zcash Protocol Specification, Version 2022.2.19. Section 5.6.4.4: Orchard Raw Full Viewing Keys |
---|
14 | +13 | ZIP 0: ZIP Process |
---|
15 | +14 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Sapling helper functions |
---|
16 | +15 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Sapling extended full viewing keys |
---|
17 | +16 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Sapling diversifier derivation |
---|
18 | +17 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Sapling internal key derivation |
---|
19 | +18 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Orchard child key derivation |
---|
20 | +19 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Orchard internal key derivation |
---|
21 | +20 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Specification: Wallet usage |
---|
22 | +21 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Sapling key path |
---|
23 | +22 | ZIP 32: Shielded Hierarchical Deterministic Wallets — Orchard key path |
---|
24 | -ZIP 203: Transaction Expiry — Changes for Blossom | -
---|
25 | +23 | ZIP 211: Disabling Addition of New Value to the Sprout Chain Value Pool |
---|
26 | +24 | ZIP 224: Orchard Shielded Protocol |
---|
27 | +25 | ZIP 315: Best Practices for Wallet Handling of Multiple Pools |
---|
28 | +26 | ZIP 321: Payment Request URIs |
---|
29 | +27 | BIP 32: Hierarchical Deterministic Wallets |
---|
30 | +28 | BIP 32: Hierarchical Deterministic Wallets — Serialization Format |
---|
31 | +29 | BIP 32: Hierarchical Deterministic Wallets — Child key derivation (CKD) functions: Public parent key → public child key |
---|
32 | +30 | BIP 44: Multi-Account Hierarchy for Deterministic Wallets |
---|
33 | +31 | BIP 44: Multi-Account Hierarchy for Deterministic Wallets — Path levels: Change |
---|
34 | +32 | BIP 44: Multi-Account Hierarchy for Deterministic Wallets — Path levels: Index |
---|
35 | +33 | BIP 350: Bech32m format for v1+ witness addresses |
---|
36 | +34 | Transactions: P2PKH Script Validation — Bitcoin Developer Guide |
---|
37 | +35 | Transactions: P2SH Scripts — Bitcoin Developer Guide |
---|
38 | +36 | Variable length integer. Bitcoin Wiki |
---|