diff --git a/zip-0321.html b/zip-0321.html index bdaf0669..24568862 100644 --- a/zip-0321.html +++ b/zip-0321.html @@ -18,6 +18,7 @@ Pull-Request: <https://githu License: MIT

Terminology

The key words "MUST", "MUST NOT", "SHOULD", "RECOMMENDED", and "MAY" in this document are to be interpreted as described in RFC 2119. 1

+

The terms "Testnet" and "Mainnet" are to be interpreted as described in section 3.11 of the Zcash Protocol Specification 10.

The terms below are to be interpreted as follows:

payment
@@ -30,7 +31,7 @@ License: MIT

Motivation

In order for a robust transactional ecosystem to evolve for Zcash, it is necessary for vendors to be able to issue requests for payment. At present, the best option available is to manually specify a payment address, a payment amount, and potentially memo field content. Of these three components, existing wallets only provide functionality for reading payment addresses in a semi-automated fashion. It is then necessary for the user to manually enter payment amounts and any associated memo information, which is tedious and may be error-prone, particularly if a payment is intended for multiple recipients or the memo field information contains structured data that must be faithfully reproduced.

This ZIP seeks to eliminate these issues by proposing a standard format that wallet vendors may support so that human intervention is required only for approval, not creation, of such a payment transaction.

-

In Bitcoin, two different standards exist to permit vendors to issue payment requests that are understood by wallets: BIP-0021 4 and BIP-0070 5. BIP-0021 provides a URI format that can be interpreted by a wallet to construct simple, single-recipient transactions; while BIP-0070 uses a protobuf-based protocol that permits payment requests to specify the creation of transactions of arbitrary complexity.

+

In Bitcoin, two different standards exist to permit vendors to issue payment requests that are understood by wallets: BIP-0021 5 and BIP-0070 6. BIP-0021 provides a URI format that can be interpreted by a wallet to construct simple, single-recipient transactions; while BIP-0070 uses a protobuf-based protocol that permits payment requests to specify the creation of transactions of arbitrary complexity.

The format proposed in this ZIP seeks a middle ground between these approaches: to provide a URI-based format which supports both the trivial use case and the slightly-more-complex situation where a payment may be intended for multiple recipients.

Requirements

@@ -38,10 +39,10 @@ License: MIT

The format must permit the representation of one or more (payment address, amount, memo) tuples.

Specification

-

The following syntax specification uses ABNF 2.

-

URI Syntax:

-
zcashurn        = "zcash:" ( zcashaddress [ "?" zcashparams ] / "?" zcashparams )
-zcashaddress    = 1*base58
+            

URI Syntax

+

The following syntax specification uses ABNF 2.

+
zcashurn        = "zcash:" ( zcashaddress [ "?" zcashparams ] / "?" zcashparams )
+zcashaddress    = 1*( ALPHA / DIGIT )
 zcashparams     = zcashparam [ "&" zcashparams ]
 zcashparam      = [ addrparam / amountparam / memoparam / messageparam / labelparam / reqparam / otherparam ]
 NONZERO         = %x31-39
@@ -57,14 +58,24 @@ License: MIT
otherparam = paramname [ paramindex ] [ "=" *qchar ] qchar = unreserved / pct-encoded / allowed-delims / ":" / "@" allowed-delims = "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / ";"
-

Here, ALPHA, unreserved and pct-encoded are as defined in 3. "base58" is defined as in 6. "base64url" is defined as in 7 with padding omitted. (Note that this uses a different alphabet to the usual base64; the values 62 and 63 in the alphabet are encoded as - and _ respectively.)

-

A ZIP-321 URI represents a request for the construction of a transaction having one or more payments. In the case that only a single payment is being requested, the recipient address SHOULD be included in the hier-part component of the RFC 3986 URI; otherwise, multiple recipient addresses can be specified using addrparam parameters with different indices.

-

Addresses, amounts, labels, and messages sharing the same paramindex (including the empty paramindex) are interpreted to be associated with the same payment for the purposes of payment construction. A paramindex MUST NOT have leading zero(s). There is no significance to the ordering of parameters, and paramindex values need not be sequential.

-

Due to fundamental restrictions on transaction construction described in 8, there may be no more than 2109 distinct payments requested by a single ZIP-321 URI.

-

A URI of the form zcash:<address>?... MUST be considered equivalent to a URI of the form zcash:?address=<address>&... where <address> is an instance of zcashaddress.

-

If there are any non-address parameters having a given paramindex, then the URI MUST contain an address parameter having that paramindex. There MUST NOT be more than one occurrence of a given parameter and paramindex.

-

Productions of the form 1*x indicate one or more successive instances of the production x. Productions of the form <n>*<m>x indicate at least <n> and at most <m> instances of production x.

-

Note that this grammar does not allow percent encoding outside the productions that use qchar, i.e. the values of label, message, reqparam, and otherparam parameters.

+

Here, ALPHA, unreserved and pct-encoded are as defined in 3. "base64url" is defined as in 4 with padding omitted. (Note that this uses a different alphabet to the usual base64; the values 62 and 63 in the alphabet are encoded as - and _ respectively. Implementations MUST NOT accept the characters +, /, and = that occur only in the usual base64.)

+

Productions of the form 1*x indicate one or more successive instances of the production x. Productions of the form <n>*<m>x indicate at least <n> and at most <m> instances of production x.

+

Note that this grammar does not allow percent encoding outside the productions that use qchar, i.e. the values of label, message, reqparam, and otherparam parameters.

+
+

URI Semantics

+

A ZIP-321 URI represents a request for the construction of a transaction having one or more payments. In the case that only a single payment is being requested, the recipient address SHOULD be included in the hier-part component of the RFC 3986 URI; otherwise, multiple recipient addresses can be specified using addrparam parameters with different indices.

+

Addresses, amounts, labels, and messages sharing the same paramindex (including the empty paramindex) are interpreted to be associated with the same payment for the purposes of payment construction. A paramindex MUST NOT have leading zero(s). There is no significance to the ordering of parameters, and paramindex values need not be sequential.

+

Due to restrictions on transaction construction described in 11, there may be no more than 2109 distinct payments requested by a single ZIP-321 URI.

+

A URI of the form zcash:<address>?... MUST be considered equivalent to a URI of the form zcash:?address=<address>&... where <address> is an instance of zcashaddress.

+

If there are any non-address parameters having a given paramindex, then the URI MUST contain an address parameter having that paramindex. There MUST NOT be more than one occurrence of a given parameter and paramindex.

+

Implementations SHOULD check that each instance of zcashaddress is a valid string encoding of either:

+
    +
  • a Zcash transparent address, using Base58Check 7 as defined in 12; or
  • +
  • a Zcash Sapling address, using Bech32 8 as defined in 13.
  • +
+

New address formats may be added in future. If the context of whether the payment URI is intended for Testnet or Mainnet is available, then each address SHOULD be checked to be for the correct network.

+

Sprout addresses MUST NOT be supported in payment requests. The rationale for this is that transfers to Sprout addresses will, at activation of the Canopy network upgrade, be restricted by ZIP 211 9; and it cannot generally be expected that senders will have funds available in the Sprout pool with which to satisfy requests for payment to a Sprout address.

+

Transfer amount

If an amount is provided, it MUST be specified in decimal ZEC. If a decimal fraction is present then a period (.) MUST be used as the separating character to separate the whole number from the decimal fraction, and both the whole number and the decimal fraction MUST be nonempty. No other separators (such as commas for grouping or thousands) are permitted. Leading zeros in the whole number or trailing zeros in the decimal fraction are ignored. There MUST NOT be more than 8 digits in the decimal fraction.

@@ -148,10 +159,18 @@ zcash:%74mEZhbWHTpdKMw5it8YDspUXSMGQyFwovpU?amount=1 - +
+ + + +
4RFC 4648 section 5: Base64 Encoding with URL and Filename Safe Alphabet
+ + + + @@ -159,32 +178,64 @@ zcash:%74mEZhbWHTpdKMw5it8YDspUXSMGQyFwovpU?amount=1
5 BIP 21: URI Scheme
- +
56 BIP 70: Payment Protocol
- - - - - - -
6Base58Check encoding
- - +
7RFC 4648 section 5: Base64 Encoding with URL and Filename Safe AlphabetBitcoin Wiki: Base58Check encoding
- +
- + + + +
8Restrictions on number of outputs in Zcash transactionsZIP 173: Bech32 Format
+ + + + + + + +
9ZIP 211: Disabling Addition of New Value to the Sprout Value Pool
+ + + + + + + +
10Zcash Protocol Specification, Version 2020.1.14 or later. Section 3.11: Mainnet and Testnet
+ + + + + + + +
11Zcash Protocol Specification, Version 2020.1.14 or later. Section 4.12: Balance and Binding Signature (Sapling)
+ + + + + + + +
12Zcash Protocol Specification, Version 2020.1.14 or later. Section 5.6.1: Transparent Addresses
+ + + + +
13Zcash Protocol Specification, Version 2020.1.14 or later. Section 5.6.4: Sapling Payment Addresses
diff --git a/zip-0321.rst b/zip-0321.rst index f5ced8df..987a6850 100644 --- a/zip-0321.rst +++ b/zip-0321.rst @@ -18,6 +18,9 @@ Terminology The key words "MUST", "MUST NOT", "SHOULD", "RECOMMENDED", and "MAY" in this document are to be interpreted as described in RFC 2119. [#RFC2119]_ +The terms "Testnet" and "Mainnet" are to be interpreted as described in +section 3.11 of the Zcash Protocol Specification [#protocol-networks]_. + The terms below are to be interpreted as follows: payment @@ -76,14 +79,15 @@ memo) tuples. Specification ============= -The following syntax specification uses ABNF [#RFC5234]_. +URI Syntax +---------- -URI Syntax: +The following syntax specification uses ABNF [#RFC5234]_. .. code-block:: EBNF zcashurn = "zcash:" ( zcashaddress [ "?" zcashparams ] / "?" zcashparams ) - zcashaddress = 1*base58 + zcashaddress = 1*( ALPHA / DIGIT ) zcashparams = zcashparam [ "&" zcashparams ] zcashparam = [ addrparam / amountparam / memoparam / messageparam / labelparam / reqparam / otherparam ] NONZERO = %x31-39 @@ -101,10 +105,22 @@ URI Syntax: allowed-delims = "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / ";" Here, ``ALPHA``, ``unreserved`` and ``pct-encoded`` are as defined in -[#RFC3986]_. "base58" is defined as in [#base58check]_. "base64url" is defined -as in [#base64url]_ with padding omitted. (Note that this uses a different -alphabet to the usual base64; the values 62 and 63 in the alphabet are encoded -as ``-`` and ``_`` respectively.) +[#RFC3986]_. "base64url" is defined as in [#base64url]_ with padding omitted. +(Note that this uses a different alphabet to the usual base64; the values 62 and +63 in the alphabet are encoded as ``-`` and ``_`` respectively. Implementations +MUST NOT accept the characters ``+``, ``/``, and ``=`` that occur only in the +usual base64.) + +Productions of the form ``1*x`` indicate one or more successive instances of the +production ``x``. Productions of the form ``*x`` indicate at least `` and +at most `` instances of production ``x``. + +Note that this grammar does not allow percent encoding outside the productions +that use ``qchar``, i.e. the values of label, message, ``reqparam``, and +``otherparam`` parameters. + +URI Semantics +------------- A ZIP-321 URI represents a request for the construction of a transaction having one or more *payments*. In the case that only a single payment is being @@ -118,9 +134,9 @@ the same payment for the purposes of payment construction. A ``paramindex`` MUST NOT have leading zero(s). There is no significance to the ordering of parameters, and ``paramindex`` values need not be sequential. -Due to fundamental restrictions on transaction construction described in -[#saplingoutputs]_, there may be no more than 2109 distinct payments requested -by a single ZIP-321 URI. +Due to restrictions on transaction construction described in +[#protocol-saplingbalance]_, there may be no more than 2109 distinct payments +requested by a single ZIP-321 URI. A URI of the form ``zcash:
?...`` MUST be considered equivalent to a URI of the form ``zcash:?address=
&...`` where ``
`` is an @@ -130,13 +146,23 @@ If there are any non-address parameters having a given ``paramindex``, then the URI MUST contain an address parameter having that ``paramindex``. There MUST NOT be more than one occurrence of a given parameter and ``paramindex``. -Productions of the form ``1*x`` indicate one or more successive instances of the -production ``x``. Productions of the form ``*x`` indicate at least `` and -at most `` instances of production ``x``. +Implementations SHOULD check that each instance of ``zcashaddress`` is a valid +string encoding of either: -Note that this grammar does not allow percent encoding outside the productions -that use ``qchar``, i.e. the values of label, message, ``reqparam``, and -``otherparam`` parameters. +* a Zcash transparent address, using Base58Check [#base58check]_ as defined + in [#protocol-transparentaddrencoding]_; or +* a Zcash Sapling address, using Bech32 [#zip-0173]_ as defined in + [#protocol-saplingpaymentaddrencoding]_. + +New address formats may be added in future. If the context of whether the +payment URI is intended for Testnet or Mainnet is available, then each address +SHOULD be checked to be for the correct network. + +Sprout addresses MUST NOT be supported in payment requests. The rationale for +this is that transfers to Sprout addresses will, at activation of the Canopy +network upgrade, be restricted by ZIP 211 [#zip-0211]_; and it cannot generally +be expected that senders will have funds available in the Sprout pool with which +to satisfy requests for payment to a Sprout address. Transfer amount --------------- @@ -268,8 +294,13 @@ References .. [#RFC2119] `RFC 2119: Key words for use in RFCs to Indicate Requirement Levels `_ .. [#RFC5234] `RFC 5234: Augmented BNF for Syntax Specifications: ABNF `_ .. [#RFC3986] `RFC 3986: URI Generic Syntax, Appendix A. Collected ABNF for URI `_ +.. [#base64url] `RFC 4648 section 5: Base64 Encoding with URL and Filename Safe Alphabet `_ .. [#bip-0021] `BIP 21: URI Scheme `_ .. [#bip-0070] `BIP 70: Payment Protocol `_ -.. [#base58check] `Base58Check encoding `_ -.. [#base64url] `RFC 4648 section 5: Base64 Encoding with URL and Filename Safe Alphabet `_ -.. [#saplingoutputs] `Restrictions on number of outputs in Zcash transactions `_ +.. [#base58check] `Bitcoin Wiki: Base58Check encoding `_ +.. [#zip-0173] `ZIP 173: Bech32 Format `_ +.. [#zip-0211] `ZIP 211: Disabling Addition of New Value to the Sprout Value Pool `_ +.. [#protocol-networks] `Zcash Protocol Specification, Version 2020.1.14 or later. Section 3.11: Mainnet and Testnet `_ +.. [#protocol-saplingbalance] `Zcash Protocol Specification, Version 2020.1.14 or later. Section 4.12: Balance and Binding Signature (Sapling) `_ +.. [#protocol-transparentaddrencoding] `Zcash Protocol Specification, Version 2020.1.14 or later. Section 5.6.1: Transparent Addresses `_ +.. [#protocol-saplingpaymentaddrencoding] `Zcash Protocol Specification, Version 2020.1.14 or later. Section 5.6.4: Sapling Payment Addresses `_