From e2d7738bb64a98af8981dc4739d774c3b59821ee Mon Sep 17 00:00:00 2001 From: Daira Emma Hopwood Date: Fri, 2 Feb 2024 23:21:38 +0000 Subject: [PATCH] ZIP 320: Define the semantics of Source Restriction Metadata Items in UVKs. Signed-off-by: Daira Emma Hopwood --- zip-0320.html | 24 +++++++++++------------- zip-0320.rst | 29 +++++++++++++++++------------ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/zip-0320.html b/zip-0320.html index ab0df2d6..5cd39958 100644 --- a/zip-0320.html +++ b/zip-0320.html @@ -9,7 +9,7 @@
ZIP: 320
 Title: Defining an Address Type to which funds can only be sent from Transparent Addresses
-Owners: Daira Emma Hopwood <daira@electriccoin.co>
+Owners: Daira-Emma Hopwood <daira@electriccoin.co>
         Kris Nuttycombe <kris@nutty.land>
 Credits: Hanh
 Status: Draft
@@ -17,7 +17,8 @@ Category: Standards / Wallet
 Created: 2024-01-12
 License: MIT
 Discussions-To: <https://github.com/zcash/zips/issues/757>
-Pull-Request: <https://github.com/zcash/zips/pull/760>
+Pull-Request: <https://github.com/zcash/zips/pull/760> + <https://github.com/zcash/zips/pull/766>

Terminology

The key words "MUST", "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 "Recipient", "Producer", "Consumer", "Sender", "Receiver", "Item", "Metadata Item", "Typecode", "Address", "Unified Address" (UA), "Unified Viewing Key" (UVK), "Unified Full Viewing Key" (UFVK), and "Unified Incoming Viewing Key" (UIVK) are to be interpreted as described in ZIP 316 5.

@@ -96,13 +97,13 @@ console.log(t1)

Specification (Alternative 2)

Upon activation of this ZIP, the section Metadata Items of ZIP 316 10 will be modified to define a new MUST-understand Metadata Item type: Source Restriction Metadata, having Typecode \(\mathtt{0xE2}\) - , the value of which must be a single byte:

+ , the value of which MUST be a single byte:

  • \(\mathtt{0x00}\) - Transparent Source Only
-

Additional Source Restriction Metadata values may be defined in the future.

+

Additional Source Restriction Metadata values can be defined in the future, but a Consumer that does not recognise the value MUST reject the entire UA/UVK as invalid.

The "Requirements for both Unified Addresses and Unified Viewing Keys" section of ZIP 316 8 will be modified as follows — the text:

A Unified Address or Unified Viewing Key MUST contain at least one shielded Item (Typecodes @@ -113,16 +114,16 @@ console.log(t1)

will be replaced by:

-

A Unified Address MUST contain at least one Receiver and any number of Metadata Items. The selection of Receivers is further restricted such that a Unified Address MUST either:

+

A Unified Address or Unified Viewing Key MUST either:

    -
  • contain at least one shielded Receiver (Typecodes +
  • contain at least one shielded Item (Typecodes \(\mathtt{0x02}\) and \(\mathtt{0x03}\) ), and no Source Restriction Metadata Item having value \(\mathtt{0x00}\) ; or
  • -
  • contain both a Transparent Receiver (Typecode +
  • contain both a Transparent Item (Typecode \(\mathtt{0x00}\) or Typecode \(\mathtt{0x01}\) @@ -130,13 +131,8 @@ console.log(t1) \(\mathtt{0xE2}\) ) having value \(\mathtt{0x00}\) - , and no other Receivers.
  • + , and no other non-Metadata Items.
-

A Unified Viewing Key MUST contain at least one shielded Item (Typecodes - \(\mathtt{0x02}\) - and - \(\mathtt{0x03}\) - ).

In the following, the “u+” Human Readable Part of Revision 1 Unified Addresses is a placeholder value, pending the finalization of Revision 1 7.

A Traceable Unified Address is produced from a Mainnet Zcash P2PKH address by executing the following steps:

@@ -161,6 +157,7 @@ console.log(t1)

Wallets and other Senders MUST ensure that only transparent UTXOs are spent in the creation of a transaction to any Unified Address containing a Source Restriction Metadata Item having value \(\mathtt{0x00}\) .

+

Any Source Restriction Metadata Item MUST be preserved with the same value when deriving a UIVK from a UFVK, or a UA from a UIVK. It has no other effect on the meaning of the UFVK or UIVK.

Reference Implementation (Alternative 2)

Javascript using zcash_address_wasm 17:

@@ -213,6 +210,7 @@ expiry time: Mon Feb 13 2024 01:14:18 GMT
  • By integrating with the Unified Address framework, Consumers of Revision 1 Unified Addresses that have not yet been upgraded to recognize these addresses can automatically be prompted to upgrade their wallets or services to understand the unrecognized MUST-understand Metadata Typecode.
  • It is possible to include address expiration metadata in a Traceable Unified Address, which can help to mitigate problems related to stored addresses in the future.
  • +
  • The Source Restriction Metadata feature can easily be extended to express other kinds of source restriction, such as "Shielded Source Only" or "Fully Shielded with No Pool Crossing".
  • Traceable Unified Addresses benefit from the robustness to errors and protection against malleation of Unified Addresses 15.
  • Regardless of which proposal is adopted, the Zcash Community will need to work with exchanges other than Binance to update their address parsing logic to understand the new address format. By encouraging Consumers such as exchanges to adopt parsing for Unified Addresses, this proposal furthers the original goal of Unified Addresses to reduce fragmentation in the address ecosystem.

    Whenever any new feature is added, wallets have a choice whether or not to support that new feature. The point of Unified Address parsing is that wallets don’t have to upgrade to recognize a different address format as a valid Zcash address. Instead of returning a “Not a valid Zcash address” error, which could be confusing for users, they can return an error more like “This is a valid Zcash address, but this wallet does not support sending to it.” This can be used as a prompt to upgrade the wallet to a version (or alternative) that does support that feature.

    diff --git a/zip-0320.rst b/zip-0320.rst index 61934495..290ca479 100644 --- a/zip-0320.rst +++ b/zip-0320.rst @@ -2,7 +2,7 @@ ZIP: 320 Title: Defining an Address Type to which funds can only be sent from Transparent Addresses - Owners: Daira Emma Hopwood + Owners: Daira-Emma Hopwood Kris Nuttycombe Credits: Hanh Status: Draft @@ -11,6 +11,7 @@ License: MIT Discussions-To: Pull-Request: + Terminology =========== @@ -178,11 +179,13 @@ Specification (Alternative 2) Upon activation of this ZIP, the section `Metadata Items` of ZIP 316 [#zip-0316-metadata-items]_ will be modified to define a new MUST-understand Metadata Item type: Source Restriction Metadata, having Typecode -:math:`\mathtt{0xE2}`, the value of which must be a single byte: +:math:`\mathtt{0xE2}`, the value of which MUST be a single byte: * :math:`\mathtt{0x00}` - Transparent Source Only -Additional Source Restriction Metadata values may be defined in the future. +Additional Source Restriction Metadata values can be defined in the future, +but a Consumer that does not recognise the value MUST reject the entire +UA/UVK as invalid. The "Requirements for both Unified Addresses and Unified Viewing Keys" section of ZIP 316 [#zip-0316-unified-requirements]_ will be modified as follows — the @@ -197,20 +200,15 @@ text: will be replaced by: - A Unified Address MUST contain at least one Receiver and any number - of Metadata Items. The selection of Receivers is further restricted - such that a Unified Address MUST **either**: + A Unified Address or Unified Viewing Key MUST **either**: - * contain at least one shielded Receiver (Typecodes :math:`\mathtt{0x02}` + * contain at least one shielded Item (Typecodes :math:`\mathtt{0x02}` and :math:`\mathtt{0x03}`), and **no** Source Restriction Metadata Item having value :math:`\mathtt{0x00}`; **or** - * contain **both** a Transparent Receiver (Typecode :math:`\mathtt{0x00}` or + * contain **both** a Transparent Item (Typecode :math:`\mathtt{0x00}` or Typecode :math:`\mathtt{0x01}`) **and** a Source Restriction Metadata Item (Typecode :math:`\mathtt{0xE2}`) having value :math:`\mathtt{0x00}`, and - **no other** Receivers. - - A Unified Viewing Key MUST contain at least one shielded Item (Typecodes - :math:`\mathtt{0x02}` and :math:`\mathtt{0x03}`). + **no other** non-Metadata Items. In the following, the “``u+``” Human Readable Part of Revision 1 Unified Addresses is a placeholder value, pending the finalization of Revision 1 @@ -245,6 +243,10 @@ Wallets and other Senders MUST ensure that only transparent UTXOs are spent in the creation of a transaction to any Unified Address containing a Source Restriction Metadata Item having value :math:`\mathtt{0x00}`. +Any Source Restriction Metadata Item MUST be preserved with the same value +when deriving a UIVK from a UFVK, or a UA from a UIVK. It has no other effect +on the meaning of the UFVK or UIVK. + Reference Implementation (Alternative 2) ---------------------------------------- @@ -322,6 +324,9 @@ Pros To Alternative 2 - It is possible to include address expiration metadata in a Traceable Unified Address, which can help to mitigate problems related to stored addresses in the future. +- The Source Restriction Metadata feature can easily be extended to express + other kinds of source restriction, such as "Shielded Source Only" or + "Fully Shielded with No Pool Crossing". - Traceable Unified Addresses benefit from the robustness to errors and protection against malleation of Unified Addresses [#F4Jumble]_. - Regardless of which proposal is adopted, the Zcash Community will need to