::

  ZIP: 324
  Title: URI-Encapsulated Payments
  Owners: Jack Grigg <thestr4d@gmail.com>
          Daira-Emma Hopwood <daira@jacaranda.org>
          Kris Nuttycombe <kris@nutty.land>
  Original-Authors: Ian Miers
                    Eran Tromer
                    Jack Grigg
                    Kevin Gorham
                    Daira-Emma Hopwood
  Credits: Sean Bowe
           Deirdre Connolly
           Linda Naeun Lee
           George Tankersley
           Henry de Valence
           The Vizor wallet developers
           Pacu <pacu@zecdev.org>
           ZODL Wallet Developers
  Status: Draft
  Category: Standards / Wallet
  Created: 2019-07-17
  License: MIT
  Discussions-To: <https://github.com/zcash/zips/issues/421>


Terminology
===========

The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", and
"MAY" in this document are to be interpreted as described in BCP 14 [#BCP14]_
when, and only when, they appear in all capitals.

Zcash protocol terms are as defined in the Zcash Protocol Specification.
[#protocol]_

The terms "Mainnet" and "Testnet" in this document are to be interpreted as
defined in the Zcash protocol specification [#protocol-networks]_. The terms
"Orchard protocol", "*Orchard pool*" and "*Ironwood pool*" are to be
interpreted as in ZIP 258 [#zip-0258]_, and "NU6.3 activation" refers to the
activation of the NU6.3 network upgrade specified there. "Regtest"
refers to the regression-test network used by Zcash full node and wallet
implementations for local testing.

.. _applink:

By “applink” we mean a platform mechanism for triggering local applications
using HTTPS links, such as App Links [#app-links]_ on Android, Universal Links
[#universal-links]_ on iOS, or App URI handlers [#app-uri-handlers]_ on Windows.

The terms below are to be interpreted as follows:

URI-Encapsulated Payment (or *liberated payment*)
  An amount of ZEC that is held by a *payment wallet* whose sole spending
  secret is carried inside a URI, so that whoever holds the URI can take the
  funds. "Liberated payment" is a product-neutral synonym used in user-facing
  contexts; the two terms are interchangeable in this document.
Payment-Encapsulating URI (or *payment URI*)
  The URI that carries a URI-Encapsulated Payment, as specified in `Syntax`_.
Payment secret
  The 32-byte secret $S$ carried in the ``key`` parameter of a payment URI,
  from which every key of the payment wallet is derived.
Payment wallet
  The single-account wallet derived from a payment secret as specified in
  `Payment wallet derivation`_.
Payment address
  The Orchard-protocol payment address of the payment wallet to which the funds
  of a URI-Encapsulated Payment are sent: in the *Orchard pool* before NU6.3
  activation, and in the *Ironwood pool* from NU6.3 activation onward.
Minter
  The party (and their wallet software) that creates a payment URI and funds
  its payment address. This is the *sender* of the payment.
Claimant
  The party (and their wallet software) that uses a payment URI to move the
  funds held by the payment wallet into a wallet of their own. In the usual
  case this is the intended *recipient* of the payment.
Funding transaction
  A transaction that sends funds to the payment address.
Claim transaction
  A transaction, created by a claimant, that spends all of the spendable notes
  held by a payment wallet to one of the claimant's own addresses.
Reclaim
  A claim transaction created by the minter, taking back funds that were not
  claimed by anyone else.


Abstract
========

This proposal specifies a mechanism for sending Zcash payments via any
unmodified (secure) messaging service, printed medium, or other channel over
which a short string can be conveyed. The sender need not know the recipient's
address and the recipient need not have a Zcash wallet already installed.

A payment is created by deriving a fresh 32-byte *payment secret*, deriving a
*payment wallet* from that secret, and sending funds to its payment address,
an Orchard-protocol address (funded in the Ironwood pool from NU6.3
activation onward). The payment secret, together with a block height from which
the funds can be found and optional advisory metadata (amount and description),
is encoded in the fragment of an ordinary HTTPS URL. Because the fragment is
never sent to the server named by the URL, the host serves only as an applink_
target for wallet software and as a landing page for recipients without a
compatible wallet.

Anyone who learns the URI can claim the payment: their wallet derives the
payment wallet, scans the chain from the given height, and sweeps every note it
finds into an address of its own in a single transaction, taking the whole
balance rather than the advertised amount. Until that happens the minter can
take the funds back by the same procedure; there is no on-chain expiry and no
limit on the age of a payment. A claim transaction is normally an ordinary
fully-shielded transaction,
indistinguishable on chain from any other, and it is constructed so that the
payment secret does not grant visibility of where the funds went after the
claim.

The proposal specifies the syntax and semantics of Payment-Encapsulating URIs,
the derivation of payment wallets, the workflow of minting, claiming and
reclaiming payments, and the behaviour expected of wallet software and of
hosts that appear in payment URIs. It also describes, informatively, the
payment-link formats already deployed by the Vizor wallet, which follow the
same model of a bearer secret for a standard single-account wallet.

Usage Story
-----------

Alice wants to send a 1.23 ZEC payment to Bob. She doesn't have Bob's Zcash
address — and Bob may not even have a wallet or have heard of Zcash! However,
she does have some end-to-end encrypted channel to Bob on a secure messaging
app, such as Signal or WhatsApp. She instructs her own Zcash wallet to send
1.23 ZEC on that channel. Her wallet derives a new payment secret from her
wallet seed, sends 1.2301 ZEC to the corresponding payment address, and
constructs a payment URI containing the payment secret, which she sends to Bob
via the secure messaging app.

Bob receives the message, which looks as follows:

    This message contains a Zcash payment.
    Click the following link to view it and receive the funds using your Zcash
    wallet app:

    https://example.com/#v=1&key=zgift1...&height=3400000&amount=1.23&desc=Payment%20for%20foo

    If you do not yet have a Zcash wallet app, see: https://z.cash/wallets

Bob clicks the link. His Zcash mobile wallet app (which is already installed
and has configured itself as an applink_ handler for ``example.com``) shows up
and tells Bob that a payment of about 1.23 ZEC awaits him. The wallet app
scans the block chain from block 3400000 for the funds, confirms that they are
present and unspent, and offers to claim the payment. Bob clicks the “Claim”
button, and his wallet app generates a transaction moving the money to his own
address (using the extra 0.0001 ZEC he has received to pay the transaction
fee). When this transaction is confirmed on chain the payment is final, and
Bob can send the funds to other parties.

If Bob had no compatible wallet installed, following the link would instead
have shown him a static web page at ``example.com`` explaining what the link
is and where to get a wallet; the page never learns the payment secret, which
stays in the fragment on Bob's device.

The same mechanism serves "gift card" style uses: a merchant or event
organiser mints a batch of payments, prints each URI as a QR code, and funds
each card once. Whoever receives a card claims it; cards that are never
claimed are reclaimed by the minter after an announced date.


Motivation
==========

This proposal enables sending of funds without exposing users to the notion of
payment addresses and their secure distribution. Instead, funds can be sent
using any pre-existing communication channel, by a single message sent
unidirectionally from the sender to the recipient. This message conveys all
the information needed to obtain control of the funds, compactly expressed as
a textual URI.

Consequently, all functionality related to contact discovery and secure-channel
establishment can be delegated to the message app(s) with which the user is
already familiar, and in which the user has already established communication
channels to many of their contacts.

Moreover, funds can be sent to users who have not yet installed wallet software
and who do not yet have a payment address. The recipient can collect the funds
at any later time by installing suitable software. This also makes the
mechanism suitable for onboarding: a payment URI can be printed, handed out at
an event, or embedded in a gift card, and the recipient's first interaction
with Zcash can be receiving money rather than generating an address.

Finally, this avoids the fat-finger problem of sending funds to the wrong
address. The user sends funds via a known contact on, e.g., WhatsApp, who they
have a relationship with or at least can confirm the recipient's identity.
Moreover, even once funds are sent via a URI, they can be recovered if the
other party does not claim them.

The proposal is complementary to ZIP 321 [#zip-0321]_, which standardizes
*Payment Request URIs* with which the payment *recipient* conveys their
persistent payment address to the *sender*, for subsequent fund transfers (to
be done using the normal on-chain mechanism rather than the encapsulated
payments described in the current proposal).


Privacy Implications
====================

A URI-Encapsulated Payment involves two on-chain transactions: a funding
transaction from the minter to the payment address, and a claim transaction
from the payment address to the claimant. Both are normally fully-shielded
transactions and are not distinguishable on chain from other transactions in
the same pool, except through timing correlation and the statistics of their
numbers of actions.

The holder of a payment URI holds the payment wallet's full viewing key. They
can therefore see the funding transaction(s) and the fact that the notes were
spent. The claim transaction is specified so that its output is *not*
decryptable with the payment wallet's outgoing viewing key; consequently a
party who later obtains the URI (for example, from a chat backup or a
discarded printed card) learns that the payment was claimed, but not the
claimant's address or any other details of the claim output. The trade-off is
that the claimant's own wallet is the only record of where the funds went.

The minter learns when (and that) a payment was claimed, because the notes it
can view become spent. The ``amount`` and ``desc`` parameters are readable by
anyone who sees the URI, including in retrospect.

The host named in a payment URI never receives the payment secret in an HTTP
request, because it is carried in the fragment. However, any script served by
that host *can* read the fragment, so the host operator (or anyone who can
modify its content) is in a position to steal unclaimed funds if the landing
page is not static. Wallet software that handles the URI through an applink_
avoids any request to the host at all.


Requirements
============

This proposal's specification of URI-Encapsulated Payments, and the intended
protocols for using them, is meant to fulfill the following requirements:

* The protocol must not require the sender of a payment to stay online until
  the recipient receives the URI (let alone claims the payment).

* URIs should be short enough to render conveniently, to fit in a QR code of
  modest size, and to be compatible with length-limited messaging platforms.

* It must not be feasible for someone who has not seen the URI (or has
  compromised a party who has) to collect the funds.

* No server, indexer, or other third party should need to learn the payment
  secret, and claiming should be possible using only the ordinary light-client
  infrastructure that a shielded wallet already depends on.

* The URIs and protocol should minimize the likelihood of inadvertent misuse,
  and in particular the risks discussed in `Security Considerations`_ below.

* The protocol must not leak any information (sender identity, recipient
  identity, amount, description) to third parties, other than inevitable
  metadata about the existence of a transaction, the inevitable network
  communication around sending/receipt of transactions, whatever leakage is
  induced by the communication channel used to transmit the URI, and whatever
  is voluntarily shared by the parties.

* The URIs should allow for future modifications and expansion of the format,
  without risk of ambiguous parsing.

* The on-chain footprint of payments that use this mechanism should be
  indistinguishable from normal fully-shielded transactions (except, possibly,
  for the statistics of the number of shielded inputs and outputs).

* A payment should remain claimable for as long as its funds are unspent, so
  that a payment that is printed, kept, or opened late does not silently
  become unclaimable.

* Don't lose funds, even if wallets crash, or everything but the sending
  wallet master secret is lost. Payments minted by a wallet should be
  recoverable from that wallet's seed, and a payment URI on its own should be
  recoverable by any wallet that can restore a standard mnemonic phrase.

Non-requirements
================

* It is outside the scope of this proposal to establish a secure communication
  channel for transmission of URI-Encapsulated Payments, or to protect the
  parties' devices from security compromise.

* Claiming the payment may involve significant wait times, on the scale of
  minutes, as the requisite on-chain transactions are generated, mined and
  confirmed, and as the claimant's wallet scans the chain from the given
  height. This proposal does not try to solve this (though it does try to
  avoid imposing significant additional delays, and it does address how the
  intermediate state is conveyed to the user).

* A URI-Encapsulated Payment is not a long-term store of value and is not a
  substitute for a wallet backup. See `Security Considerations`_.

* This proposal does not provide an on-chain expiry for unclaimed payments.
  Reclaiming is a wallet-side action of the minter.


Specification
=============

A Payment-Encapsulating URI represents the capability to claim whatever
spendable funds are held, now or later, by the payment wallet derived from the
payment secret it carries. See `Usage Story`_ for an example.

Syntax
------

A Payment-Encapsulating URI is a Uniform Resource Locator (URL), as defined in
RFC 3986 [#RFC3986]_, with the following structure::

  payment-uri  = "https://" host [ ":" port ] path-abempty "#" fragment
  fragment     = param *( "&" param )
  param        = version / keyparam / heightparam / amountparam / descparam
               / otherparam
  version      = "v=1"
  keyparam     = "key=" bech32m
  heightparam  = "height=" %x31-39 *DIGIT
  amountparam  = "amount=" 1*DIGIT [ "." 1*8DIGIT ]
  descparam    = "desc=" *qchar
  otherparam   = 1*( ALPHA / DIGIT / "-" / "_" ) "=" *qchar
  qchar        = unreserved / pct-encoded / "+"

where ``host``, ``port``, ``path-abempty``, ``unreserved``, ``pct-encoded``,
``ALPHA``, and ``DIGIT`` are as defined in RFC 3986 [#RFC3986]_, and
``bech32m`` is a Bech32m string as specified in `Encoding of the payment
secret`_. This grammar describes the URIs that producers emit; the handling of
other input by consumers is specified below.

The scheme MUST be ``https``; consumers MUST match it case-insensitively, as
RFC 3986 requires. The ``host`` MAY be any host; see `Hosts and landing
pages`_. The path SHOULD be empty or ``/``. Producers MUST NOT include a query
component (``?``): everything specific to the payment MUST be carried in the
fragment, so that it is never sent to the host. Consumers MUST NOT use a query
component, if one is present, to interpret the payment.

The fragment consists of attribute-value pairs separated by ``&``. The
following attributes are defined:

* ``v``: the format version. MUST be present and MUST have the value ``1`` for
  URIs conforming to this version of this specification. A consumer that
  encounters any other value MUST reject the URI as unsupported.
* ``key``: the payment secret, encoded as specified in `Encoding of the
  payment secret`_. MUST be present.
* ``height``: a block height, in decimal without sign, whitespace or leading
  zeros, at or before the height of the first funding transaction, and no less
  than the minimum birthday height given in `Semantics`_. MUST be present.
* ``amount``: the nominal amount of the payment in decimal ZEC, following the
  same syntax and interpretation as the ``amount`` parameter of ZIP 321
  [#zip-0321-amount]_; in addition, it MUST be greater than zero. MAY be
  present. This value is advisory; see `Semantics`_.
* ``desc``: a human-readable description of the payment. MAY be present. The
  value is UTF-8 text [#RFC3629]_, percent-encoded as described below, and
  MUST NOT exceed 512 bytes after decoding.

The attributes ``v``, ``key`` and ``height`` are *strict*, and ``amount`` and
``desc`` are *advisory*.

Producers MUST emit ``v`` first, followed by ``key``, ``height``, ``amount``
(if present) and ``desc`` (if present), in that order. Consumers MUST accept
the defined attributes in any order.

Consumers process the fragment as follows:

* Empty pairs (as produced by ``&&``, or by a leading or trailing ``&``) MUST
  be skipped.
* A pair that contains no ``=`` is read as a name with an empty value.
* Pairs whose name is not a defined attribute MUST be ignored, whether or not
  they contain ``=``, so that future versions of this specification can add
  optional attributes without changing ``v``.
* Consumers MUST reject a URI in which a strict attribute is absent, appears
  more than once, or is malformed or out of range.
* If an advisory attribute appears more than once, or its value is malformed
  or out of range (for ``amount``: not of the syntax above, zero, or greater
  than the maximum money supply; for ``desc``: not decodable as described
  below, or longer than 512 bytes after decoding), consumers MUST treat that
  attribute as absent and MUST NOT reject the URI for that reason.

Producers MUST percent-encode every byte of the ``desc`` value other than the
``unreserved`` characters of RFC 3986 (``ALPHA``, ``DIGIT``, ``-``, ``.``,
``_``, ``~``); in particular a space MUST be encoded as ``%20``. Consumers
MUST decode ``%XX`` sequences and MUST treat an unencoded ``+`` as a space (for
compatibility with form-encoding libraries). A ``desc`` value that contains a
``%`` not followed by two hexadecimal digits, or that does not decode to valid
UTF-8, is malformed.

A Payment-Encapsulating URI MUST NOT exceed 16384 bytes. Consumers MAY reject
longer inputs, measured after removing leading and trailing whitespace, before
parsing them.

Rationale for advisory attributes being lenient
'''''''''''''''''''''''''''''''''''''''''''''''

.. raw:: html

   <details>
   <summary>Click to show/hide</summary>

The funds held by the payment wallet are authoritative, and ``amount`` and
``desc`` only describe them. Rejecting a URI because one of them is malformed
would make a funded payment unclaimable in conforming wallets because of a
display-only field, which is the worse failure for a bearer instrument that
may already be printed. The strict attributes, by contrast, determine which
wallet is scanned and from where; guessing at them could hide funds or point
the claimant at the wrong wallet.

.. raw:: html

   </details>

Sanitization of the description
'''''''''''''''''''''''''''''''

The ``desc`` value is text chosen by whoever produced the URI. Before
displaying it, or using it in any other way (for example in a memo), a
consumer MUST transform the decoded value as follows:

* each line break, paragraph separator or other whitespace control character
  (TAB, LF, VT, FF, CR, NEL U+0085, LINE SEPARATOR U+2028 and PARAGRAPH
  SEPARATOR U+2029) is replaced by a space;
* every other control character (Unicode general category ``Cc``, that is the
  C0 controls, DEL and the C1 controls) is removed;
* the invisible format characters that can hide or reorder displayed text are
  removed: the bidirectional marks (U+061C, U+200E, U+200F), the bidirectional
  embeddings, overrides and isolates (U+202A to U+202E and U+2066 to U+2069),
  the deprecated format controls (U+206A to U+206F), ZERO WIDTH SPACE
  (U+200B), WORD JOINER and the invisible operators (U+2060 to U+2064), ZERO
  WIDTH NO-BREAK SPACE (U+FEFF), and the interlinear annotation controls
  (U+FFF9 to U+FFFB).

ZERO WIDTH JOINER, ZERO WIDTH NON-JOINER and variation selectors are kept,
since emoji sequences and several scripts depend on them. If the result is
empty or consists only of whitespace, ``desc`` is treated as absent.

Producers MUST NOT emit a ``desc`` value that is blank, or that this
transformation would change.

Semantics
---------

The ``key`` parameter deterministically determines a payment wallet, as
specified in `Payment wallet derivation`_. The URI represents the capability to
spend all funds received by that wallet, in any pool.

The ``height`` parameter is the *birthday* of the payment wallet: the block
height from which a consumer scans the chain for the payment wallet's notes.
It MUST be less than or equal to the height of the block containing the first
funding transaction for the payment address. A producer SHOULD set it as close
to that height as it can determine at the time the URI is generated (for
example, the chain tip height when the funding transaction is created), since
a smaller value only increases the claimant's scanning cost. A consumer MUST
NOT assume that no notes exist below ``height``; it simply does not look for
them.

``height`` MUST be greater than or equal to the *minimum birthday height* of
the network identified by ``key``: the activation height of NU5, which is
1687104 on Mainnet and 1842420 on Testnet, or 1 on Regtest. Consumers MUST
reject a URI whose ``height`` is lower. A payment wallet's Orchard funds
cannot predate the activation of NU5, which introduced the Orchard pool.
There is no upper bound and no lower bound relative to the chain tip; see
`Payment Rendering and Blockchain Lookup`_.

The ``amount`` and ``desc`` parameters are advisory. They exist so that wallet
software can describe the payment to the user before the chain has been
scanned. The amount that can actually be claimed is the total value of the
unspent notes held by the payment wallet, less the transaction fee
of the claim transaction, and MAY differ from ``amount`` in either direction
(possibly being zero).

The recipient's wallet software SHOULD convey to the user that the ``amount``
and ``desc`` values are merely claims made by the party who sent the URI, and
may be tentative, inaccurate or malicious.

In particular, the recipient's wallet software SHOULD convey to the user that
the amount of ZEC they can successfully transfer to their wallet may be
different than that given by the ``amount`` parameter, and may change
(possibly to zero), until the claim transaction has been mined.

The payment associated with a URI is not deemed “received” by the recipient
until a claim transaction has been mined; see `Claiming`_.

Encoding of the payment secret
------------------------------

The payment secret $S$ is a sequence of exactly 32 bytes. It is encoded in the
``key`` parameter using Bech32m [#bip-0350]_, with the 32 bytes converted to
5-bit groups as for a Bech32 data part [#zip-0173]_ and with the following
Human-Readable Parts:

============== =====================
Network        Human-Readable Part
============== =====================
Mainnet        ``zgift``
Testnet        ``zgifttest``
Regtest        ``zgiftregtest``
============== =====================

A Bech32m-encoded payment secret is 52 data characters plus the 6-character
checksum, the ``1`` separator, and the Human-Readable Part.

Producers MUST use lowercase. Consumers MUST accept either all-lowercase or
all-uppercase encodings (so the Human-Readable Part is matched
case-insensitively), as for Bech32, and MUST reject:

* a string whose checksum is not a valid *Bech32m* checksum (in particular a
  string carrying a Bech32 checksum MUST be rejected);
* a string whose decoded data part is not exactly 32 bytes;
* a string whose padding bits (the 4 bits left over when the 52 5-bit groups
  are converted to 32 bytes) are not all zero, since these would give a second
  spelling of the same secret;
* a string that mixes lowercase and uppercase characters;
* a string whose Human-Readable Part is not one of those listed above
  ("unsupported network");
* a string whose Human-Readable Part identifies a network other than the one
  the consuming wallet is operating on ("wrong network"). A wallet MUST NOT
  derive or display a payment address for a payment secret on the wrong
  network, and SHOULD tell the user which network the URI is for.

.. note::
    The Human-Readable Parts above are specific to this ZIP. If a registry of
    Bech32/Bech32m Human-Readable Parts used by Zcash is established (for
    example in ZIP 173 [#zip-0173]_ or ZIP 316 [#zip-0316]_), the entries
    ``zgift``, ``zgifttest`` and ``zgiftregtest`` are to be registered for
    "ZIP 324 payment secret" on Mainnet, Testnet and Regtest respectively.

Payment wallet derivation
-------------------------

Given a payment secret $S$ and a network, the payment wallet is derived as
follows:

1. Let $\mathsf{mnemonic}$ be the BIP 39 [#bip-0039]_ mnemonic sentence
   obtained from the 256 bits of entropy $S$ using the English word list. This
   is a 24-word sentence whose final 8 bits are the BIP 39 checksum of $S$.
2. Let $\mathsf{seed}$ be the 64-byte BIP 39 seed derived from
   $\mathsf{mnemonic}$ with an empty passphrase (that is, with the PBKDF2 salt
   ``"mnemonic"``).
3. Let $\mathit{coin\_type}$ be the SLIP 44 [#slip-0044]_ coin type for the
   network: $133$ for Mainnet and $1$ for Testnet and Regtest.
4. Let $\mathsf{sk}$ be the Orchard spending key at ZIP 32 path
   $m_\mathsf{Orchard} / 32' / \mathit{coin\_type}' / 0'$ derived from
   $\mathsf{seed}$ as specified in ZIP 32 [#zip-0032-orchard]_ (that is,
   account $0$ of the seed).
5. The *payment address* is the Orchard-protocol diversified payment address
   of $\mathsf{sk}$ at diversifier index $0$
   [#protocol-orchardkeycomponents]_. When the payment address needs to be
   encoded, it MUST be encoded as a Unified Address [#zip-0316]_ containing
   only that Orchard Receiver. An Orchard-protocol receiver is scoped to the
   Orchard protocol rather than to a pool, so the same receiver accepts funds
   in the *Orchard pool* and in the *Ironwood pool* [#zip-0326-receiving]_.
   If NU6.3 introduces a distinct encoding for Ironwood-pool payments, that
   encoding is to be used as specified by ZIP 258 [#zip-0258]_ and the ZIPs it
   cites; see `Open Questions`_.

The Orchard full viewing key, incoming viewing key and outgoing viewing key of
the payment wallet are those of $\mathsf{sk}$.

The payment wallet is the whole of account $0$ of $\mathsf{seed}$: besides
its Orchard keys, it has the Sapling keys at ZIP 32 path
$m_\mathsf{Sapling} / 32' / \mathit{coin\_type}' / 0'$
[#zip-0032-sapling]_, and the transparent keys of the BIP 44 [#bip-0044]_ account
$0$ for $\mathit{coin\_type}$. Its Orchard-protocol keys serve both the
*Orchard pool* and the *Ironwood pool*.

A minter funds the payment address as follows:

* for a funding transaction mined before NU6.3 activation, the minter SHOULD
  fund the payment address in the *Orchard pool*;
* from NU6.3 activation onward, value can no longer enter the *Orchard pool*
  [#zip-0258-nu63-rules]_ and wallets do not send to external receivers in
  it [#zip-0326-keygen]_, so the minter MUST fund the payment address in the
  *Ironwood pool*.

A minter SHOULD NOT send funds to a Sapling address of the payment wallet, and
MUST NOT advertise a transparent receiver for it. Funds can nevertheless reach other
addresses of the payment wallet, for example if someone pays one of its
transparent addresses out of band, or if a deployed format advertised a
Sapling receiver (see `Known Uses`_).

A claimant MUST scan for the payment wallet's funds in every shielded pool
(Orchard, Ironwood and Sapling) and at its transparent addresses, and MUST
sweep all of them as specified in `Claiming`_. Spending from the *Orchard
pool* remains possible after NU6.3 activation, so Orchard-pool funds of
payments minted earlier stay claimable.

Implementations MAY compute $\mathsf{seed}$ directly from $S$ without
materialising the mnemonic sentence, provided the result is identical.

Rationale for an Orchard-protocol payment address and an all-pool claim
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

.. raw:: html

   <details>
   <summary>Click to show/hide</summary>

The Orchard protocol is used because it is the current shielded protocol,
with the best privacy properties and the cheapest proofs on mobile devices,
and because a Unified Address with a single Orchard Receiver keeps the payment
address short. The funding pool follows the current pool for that protocol:
the *Orchard pool* before NU6.3 activation and the *Ironwood pool* after it,
when the consensus rules no longer let value enter the *Orchard pool*.
Funding the current pool also keeps the usual claim transaction free of
cross-pool transfers, which would be visible on chain as changes in pool
balances.

Sweeping everything the payment wallet holds costs the recipient no privacy:
the payment wallet is single-use, its keys are already known to the minter
and to every holder of the URI, the destination is a shielded receiver of the
claimant, and the payment wallet's outgoing viewing key is not used. Leaving
funds in a pool that the claimant does not scan would only strand them, or
leave them for whichever other holder of the URI takes them. Some deployed
payment links (see `Known Uses`_) describe a payment address with both
Orchard and Sapling receivers, so Sapling funds do occur in practice.

.. raw:: html

   </details>

Rationale for deriving the payment wallet through a BIP 39 mnemonic
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

.. raw:: html

   <details>
   <summary>Click to show/hide</summary>

Deriving the ZIP 32 seed via a BIP 39 mnemonic rather than directly from $S$
means that the payment wallet is an ordinary single-account wallet: any Zcash
wallet that can restore a 24-word phrase can recover the funds of a payment
URI, even if it has no support for this ZIP, by restoring the phrase and
scanning from the birthday. This provides a recovery path independent of any
particular software and lets a wallet "upgrade" a payment into a persistent
wallet if it chooses. The cost is one PBKDF2 derivation of 2048 iterations,
which is negligible.

.. raw:: html

   </details>

Minting a payment secret
------------------------

A payment secret MUST have 256 bits of entropy. It is obtained in one of two
ways.

**Seed-derived secrets.** A wallet that mints payments from a ZIP 32 seed $S_w$
(the wallet's own seed, not to be confused with the payment secret) MUST derive
payment secrets using ZIP 32 registered key derivation
[#zip-0032-registered]_, with:

- $\mathsf{ContextString} = \texttt{“Zcash\_URIEncapsulatedPayment”}$
- $\mathsf{ZipNumber} = 324$

The payment secret with index $\mathit{index}$ on the network with SLIP 44
coin type $\mathit{coin\_type}$ is the 32-byte key component of

$\mathsf{CKDreg}(\mathsf{CKDreg}(\mathsf{RegKD}(\texttt{“Zcash\_URIEncapsulatedPayment”}, S_w, 324), \mathit{coin\_type} + 2^{31}, [\,]), \mathit{index} + 2^{31}, [\,])$

where the chain code of the resulting child is discarded. In path notation
this is $m_{\texttt{Zcash\_URIEncapsulatedPayment}} / 324' / \mathit{coin\_type}' / \mathit{index}'$,
where $m_{\texttt{Zcash\_URIEncapsulatedPayment}}$ is the master key that
registered key derivation computes from the context string and $S_w$; the
$324'$ step is the $\mathsf{ZipNumber}$ step that $\mathsf{RegKD}$ performs.
ZIP 32 defines no general path notation for registered key derivation; this
one is unambiguous because every step uses an empty tag.

$\mathit{index}$ MUST be in the range $\{ 0\,..\, 2^{31} - 1 \}$. A minting
wallet MUST NOT reuse an index for which it has previously produced a URI, and
SHOULD allocate indices sequentially starting from $0$ so that payments can be
recovered as described in `Recovery From Wallet Crash`_.

**Random secrets.** A minter that does not derive payments from a seed (for
example a service that mints payments in bulk) MAY instead generate $S$
uniformly at random using a cryptographically secure random number generator.
Such a minter is responsible for its own record of outstanding secrets if it
intends to reclaim payments.

Hosts and landing pages
-----------------------

The ``host`` of a Payment-Encapsulating URI serves two purposes: it is the
domain against which wallet software registers an applink_ handler, and it
serves a *landing page* to users whose device has no wallet that handles the
URI.

A wallet that supports this ZIP SHOULD register as an applink_ handler for the
hosts whose payment URIs it intends to handle, and MUST also accept a payment
URI pasted or shared into it directly, regardless of host, provided that the
URI conforms to `Syntax`_.

The operator of a host that appears in payment URIs:

* MUST serve the association files required by the applink_ mechanisms of the
  platforms it supports, listing the wallet applications that may handle its
  URIs, and SHOULD publish the policy under which applications are listed;
* MUST NOT serve, at the path used by payment URIs, any script or other
  active content that reads the fragment identifier, transmits it, or
  stores it — including analytics, error-reporting and tag-management
  scripts;
* SHOULD serve a static page that explains that the link carries a Zcash
  payment, that the funds can be taken by anyone who has the link, and how to
  obtain a compatible wallet;
* SHOULD serve the page with HTTP headers that prevent the fragment from
  leaking through referrers (for example a ``Referrer-Policy`` of
  ``no-referrer``) and that restrict script execution (for example a
  ``Content-Security-Policy`` without ``script-src``).

A wallet that opens a payment URI through an applink_ does not contact the
host at all. A wallet MUST NOT fetch the URI over the network itself.

Testing
-------

All of the above specification applies equally to Testnet and Regtest,
substituting the corresponding Human-Readable Part from `Encoding of the
payment secret`_ and ``TAZ`` for ``ZEC``.

Wallet apps MAY support just one network, and if they support more than one
then they MUST keep separate accounting and MUST clearly distinguish the
network when payments or balances are conveyed to users. A wallet MUST reject,
with a "wrong network" indication, any payment URI whose Human-Readable Part
does not match the network it is operating on.


Lifecycle Specification
=======================

The lifecycle of a Payment-Encapsulating URI consists of several stages, which
in the usual case culminate in the funds being irrevocably deposited into the
recipient's personal wallet:

Minting and funding
-------------------

The minter's wallet:

1. Obtains a payment secret $S$ as specified in `Minting a payment secret`_,
   and derives the payment address as specified in `Payment wallet
   derivation`_.
2. Chooses ``height``, which MUST be at most the height at which the funding
   transaction is mined. A wallet that generates the URI before the funding
   transaction is mined SHOULD use the chain tip height at the time the
   funding transaction is created.
3. Durably records the payment, as described below, before broadcasting any
   funding transaction.
4. Creates and broadcasts a *funding transaction* paying the payment address.
   The funding output is an output to the payment address in the pool
   required by `Payment wallet derivation`_: the *Orchard pool* (SHOULD)
   before NU6.3 activation, and the *Ironwood pool* (MUST) from NU6.3
   activation onward. The funding transaction SHOULD be a
   fully-shielded transaction, so that it is indistinguishable from ordinary
   transactions, and MAY carry ``desc`` (or nothing) in the memo of the
   funding output.
5. Encodes the payment URI as specified in `Syntax`_.

The funding amount SHOULD include, in addition to the nominal amount shown in
``amount``, a *fee reserve* so that the claimant receives the nominal amount
after paying the fee of the claim transaction. The RECOMMENDED reserve is
10000 zatoshis, which is the ZIP 317 [#zip-0317]_ conventional fee of a claim
transaction with at most two logical actions. A minter that funds the same
payment address with more than one note SHOULD increase the reserve by 5000
zatoshis for each additional note beyond the second, since each additional
spend adds a logical action.

The minter's wallet MUST NOT expose the payment address as a receiving address
of the minter, and SHOULD NOT send the same payment address more than one
funding transaction, except to top up a payment before the URI has been
transmitted.

Before broadcasting the funding transaction, the minter's wallet MUST durably
record enough information to find and reclaim the payment: for a seed-derived
secret, its index and ``height``; for a random secret, the secret itself and
``height``. This ensures that a crash between broadcast and recording cannot
leave funds in a payment wallet that no one knows about. The minter's wallet
SHOULD also record the nominal amount and ``desc``, so that it can display
status and reclaim the payment without rescanning. The minter's wallet MUST
retain the ability to derive the payment wallet of every payment it has
minted (see `Recovery From Wallet Crash`_).

A minter whose spending keys are held by a hardware signer creates the
funding transaction through its usual signing flow (for example using a
Partially Created Zcash Transaction [#zip-0374]_). Hardware custody protects
only the funding account: the payment secret and the payment wallet's keys
always exist on the host device, and later on the claimant's device.
Seed-derived payment secrets require the wallet seed, so a minter whose seed
is available only to a hardware signer uses random secrets (see `Minting a
payment secret`_) or a seed that is available to the host.

Clients MAY generate and transmit the URI before the funding transaction is
mined; the claimant's wallet will show the payment as *Pending* until it is.

URI Transmission
----------------

The minter conveys the Payment-Encapsulating URI to the intended recipient,
over some secure channel (e.g., an end-to-end encrypted messaging platform such
as Signal, WhatsApp or Magic Wormhole; a QR code scanned in person; or a
printed card handed over directly).

If transmitted via a human-readable medium, such as a messaging app, the
Payment-Encapsulating URI MAY be accompanied by a contextual explanation that
the URI encapsulates a payment, and a suggested action by the recipient to
complete the process (see `Usage Story`_ above for an example).

When sent via a human-readable medium that consists of discrete messages, the
message that contains the URI SHOULD NOT contain any payment-specific or
manually-entered information outside the URI itself, since this information
may not be visible to the recipient (see `Message Rendering`_ below).

From this point, and until the payment is claimed or reclaimed, from the
minter's perspective the payment is “in progress”; it SHOULD be conveyed as
such to the minter; and MUST NOT be conveyed as “claimed” or other phrasing
that conveys successful completion.

Message Rendering
-----------------

The recipient's device renders the Payment-Encapsulating URI, or an indication
of its arrival, along with the aforementioned contextual explanation (if any).
The user has the option of “opening” the URI (i.e., by clicking it), which
results in the device opening a Zcash wallet app, using the local platform's
applink_ mechanism, or, failing that, the landing page of the host.

A messaging app MAY recognize URI-Encapsulated Payments, and render them in a
way that conveys their nature more clearly than raw URI strings. If the
messaging medium consists of discrete messages, and a message contains one or
more URI-Encapsulated Payments, then the messaging app MAY assume that all
other content in that message is automatically generated and contains no
payment-specific or manually-generated information, and thus may be discarded
during rendering.

Intake of payment URIs
----------------------

Payment URIs may reach a wallet from any web page or application that can
trigger an applink_, so a wallet MUST bound the resources that incoming URIs
can consume:

* it MUST apply the length limit of `Syntax`_ before any other processing;
* it SHOULD bound the number of payment URIs awaiting processing at any one
  time, and SHOULD treat a URI that designates the same payment wallet as one
  already awaiting processing as a duplicate rather than processing it twice;
* a malformed URI MUST NOT prevent the processing of other URIs; and
* it MUST NOT begin scanning for, or claiming, a payment solely because a URI
  was received (see `Claiming`_).

Payment Rendering and Blockchain Lookup
---------------------------------------

The recipient's Zcash wallet app SHOULD present the payment amount and MAY
present the description, as conveyed in the URI, along with an indication of
the tentative nature of this information.

The wallet then determines what the payment wallet actually holds. To do so it
MUST:

* derive the payment wallet's full viewing key as specified in `Payment wallet
  derivation`_;
* create a *temporary wallet* for that viewing key that is isolated from the
  user's own accounts (for example, a separate database or a separately named
  wallet instance), with ``height`` as its birthday;
* scan the chain from ``height`` to the current tip for notes of every
  shielded pool (Orchard, Ironwood and Sapling) received by the payment
  wallet, as ZIP 326 [#zip-0326]_ specifies for Orchard-protocol notes, and
  for spends of those notes; and
* look for unspent transparent outputs received by the payment wallet's
  transparent addresses (see `Payment wallet derivation`_), using the
  wallet's usual transparent address discovery.

A wallet MUST NOT refuse to process a payment URI because its ``height`` is
far below the chain tip. When the range to be scanned is large (for example,
more than about 100000 blocks), the wallet SHOULD warn the user that finding
the funds may take longer than usual, SHOULD show the progress of the scan,
and SHOULD let the user cancel it. If ``height`` is above the current chain
tip, the wallet SHOULD treat the payment as *Pending*.

The wallet MUST NOT import the payment wallet's keys into the user's own
accounts, and MUST NOT display the payment address to the user as an address
at which they can receive funds.

The wallet conveys to the user one of the following states:

* *Pending*: no unspent notes have been found yet, or the notes found do not
  yet have enough confirmations (see below). The wallet SHOULD keep scanning
  and re-evaluating.
* *Ready to claim*: one or more unspent notes with sufficient confirmations
  have been found, and their total value exceeds the fee of the claim
  transaction. The wallet SHOULD present the user with an option to claim the
  payment (e.g., a “Claim” button) and SHOULD show the amount that will
  actually be received.
* *Claimed*: every note found has been spent. The funds were taken by another
  holder of the URI (possibly the minter). The wallet MUST convey that the
  funds cannot be received.
* *Invalid*: the URI is malformed, for the wrong network, or the unspent value
  found does not cover the claim transaction's fee.

Within the *Pending* state, the wallet app MAY also consider unmined
transactions seen in the mempool, and convey their existence to the user.
These do not suffice for entering the *Ready to claim* state.

**Confirmations.** Confirmations follow ZIP 315 [#zip-0315]_. The funds held
by the payment wallet (notes and transparent outputs) were received from
outside the claimant's wallet, and are therefore untrusted TXOs in the sense
of ZIP 315 for the claimant: the temporary wallet MUST NOT treat them as
trusted. Whether they are spendable, and how their state is displayed, follow
the wallet's ZIP 315 confirmation policy for untrusted TXOs. A minter
reclaiming funds that it sent itself applies its ZIP 315 policy to them in
the same way, according to whether it treats them as trusted.

The aforementioned conditions may change over time (e.g., the notes may be
spent by someone else in the interim), so the status SHOULD be updated
periodically while the payment is displayed.

Rationale for not limiting the age of a payment
'''''''''''''''''''''''''''''''''''''''''''''''

.. raw:: html

   <details>
   <summary>Click to show/hide</summary>

A claim window, such as refusing any payment whose birthday is more than
100000 blocks (about 87 days) behind the tip, bounds the scanning work that a
URI can demand. It would also turn a bearer gift into an expiring one: cards
that are printed, kept in a drawer, or opened after a holiday would become
unclaimable in conforming wallets while their funds are still on chain, and
falling back to restoring the mnemonic sentence in a general-purpose wallet is
not something most recipients can be expected to do. The scanning cost of an
old payment is the same as that of restoring any wallet with an old birthday,
for a single account, and the user can be warned and can cancel. A hostile
URI can therefore cost the user time but cannot take control of the scan.

.. raw:: html

   </details>

Rationale for the confirmation policy
'''''''''''''''''''''''''''''''''''''

.. raw:: html

   <details>
   <summary>Click to show/hide</summary>

This ZIP sets no confirmation numbers of its own; the classification of
funds as trusted or untrusted is what matters, and ZIP 315 supplies the
policy. It has been argued that a single confirmation suffices for the
funding notes, because they were created expressly for a single-use wallet and
so the usual concerns about untrusted senders do not apply. Provenance is not
the risk, however: the minter still holds the payment secret (and, for
seed-derived secrets, can always re-derive it), as may other parties who have
seen the URI. If a chain reorganization removes the funding transaction or
the claim transaction, the minter can double-spend the funding transaction's
inputs, or another holder of the URI can have their own claim mined instead,
and the claimant's apparent receipt disappears. These are exactly the risks
that the ZIP 315 policy for untrusted TXOs addresses. The claim transaction
itself is different: it is created on the claimant's device, so its output is
trusted (see `Claiming`_).

.. raw:: html

   </details>

Claiming
--------

When the user chooses to claim the payment, the wallet app constructs a single
*claim transaction* with the following properties:

* It spends all funds of the payment wallet that satisfy the confirmation
  policy above: every unspent Orchard, Ironwood and Sapling note, and every
  unspent transparent output. The claim MUST sweep all of
  them. Where ZIP 317 fees, transaction size or the rules of a pool make a
  single transaction impractical, the wallet MAY claim in more than one
  transaction, each with the properties listed here.
* It has exactly one non-dummy output, to a shielded receiver belonging to
  the claimant's own wallet, and MUST NOT send to a transparent receiver.
  Before NU6.3 activation the wallet SHOULD send to its Orchard receiver in
  the *Orchard pool*; from NU6.3 activation onward it MUST send to an
  Orchard-protocol receiver in the *Ironwood pool*. Orchard-pool notes of the
  payment wallet are spent as ZIP 326 requires after NU6.3 activation (with
  fabricated same-address outputs [#zip-0326-fabricated]_), and their value
  leaves the *Orchard pool* for the *Ironwood pool*.
* The output value is the sum of the inputs minus the transaction fee, so that
  the claim transfers the payment wallet's full spendable balance. The wallet
  MUST NOT limit the claim to the value of ``amount``, which remains advisory,
  and there is no change output.
* The fee is the ZIP 317 [#zip-0317]_ conventional fee for the transaction as
  constructed.
* The claim transaction MUST NOT use the payment wallet's outgoing viewing
  key, or any other key derived from the payment secret, to encrypt any of its
  outputs. The wallet MUST instead use the "no outgoing viewing key"
  construction of the protocol [#protocol-saplingandorchardinband]_ (a random
  $\mathsf{ock}$) for every output that carries a real note ciphertext (the
  fabricated outputs of ZIP 326 carry random bytes instead), so that no holder
  of the payment secret
  can decrypt the output.
* The memo of the output SHOULD identify the origin of the funds as a
  URI-Encapsulated Payment, and MAY include the ``desc`` value, truncated so
  that the memo does not exceed 512 bytes of UTF-8 and remains a valid text
  memo.
* It uses the wallet's default transaction expiry (see ZIP 203 [#zip-0203]_).

Before broadcasting, the wallet MUST show the user that funds are about to be
claimed from a URI-Encapsulated Payment, the amount that will be received, and
the destination account, and MUST allow the user to cancel. A wallet MUST NOT
claim a payment without an explicit user action.

Once the claim transaction has been broadcast, the wallet MUST delete the
temporary wallet, including its database and all key material derived from
the payment secret, so that the payment wallet's keys are not retained on the
device. The wallet SHOULD retain the payment URI itself (not the derived keys)
until the claim transaction is mined, so that the claim can be retried if the
transaction expires unmined, and SHOULD delete it afterwards.

The claimant's wallet SHOULD convey the payment status as “Claiming…” from
the time that the user initiates the claim until the claim transaction is
mined, and as “Claimed” once it is mined with the number of confirmations the
wallet considers final. The claimed funds appear in the claimant's wallet as an
ordinary received note.

Rationale for sweeping transparent and Sapling funds
''''''''''''''''''''''''''''''''''''''''''''''''''''

.. raw:: html

   <details>
   <summary>Click to show/hide</summary>

Spending a transparent output, or moving value between shielded pools, is
normally avoided because it is visible on chain. Here it reveals nothing about
the claimant: the payment wallet is single-use, its keys are already known to
the minter and to every holder of the URI, and the destination is still a
shielded receiver of the claimant with no outgoing viewing key of the payment
wallet. Leaving the value behind would strand it, or leave it for whichever
other holder of the URI takes it.

.. raw:: html

   </details>

Rationale for sweeping the full balance
'''''''''''''''''''''''''''''''''''''''

.. raw:: html

   <details>
   <summary>Click to show/hide</summary>

Sending exactly the advertised amount would make ``amount`` binding and would
fail in two ways. Any excess (from over-funding, a top-up, or a fee reserve
larger than the actual fee) would stay in the payment wallet, where anyone else
who holds the URI, including the minter, could take it. And any shortfall
(from a lower funding amount, or a fee higher than the reserve) would make the
payment unclaimable until the minter topped it up. Sweeping the whole balance
gives the claimant everything the URI controls, and the wallet shows the
amount actually found before the user confirms.

.. raw:: html

   </details>

The claim transaction is constructed on the claimant's own device, by the same
wallet application that receives its output. The claimant's wallet SHOULD
therefore record the claim transaction as soon as it is broadcast (so that the
incoming funds are shown without waiting for it to be mined) and SHOULD treat it
as a trusted transaction in the sense of ZIP 315 [#zip-0315]_, so that its
output's spendability and display follow the wallet's ZIP 315 confirmation
policy for trusted TXOs. This is the "mark specific external transactions as
trusted" allowance of ZIP 315: although the output is not an output of a
transaction created by the claimant's wallet, its origin is known to be the
payment wallet that the claimant's own device just controlled.

If the claim transaction expires unmined, or is otherwise rendered irrevocably
invalid (e.g., by a reorganization), the wallet SHOULD convey this and SHOULD
revert to the `Payment Rendering and Blockchain Lookup`_ stage above.

Rationale for discarding the outgoing viewing key
'''''''''''''''''''''''''''''''''''''''''''''''''

.. raw:: html

   <details>
   <summary>Click to show/hide</summary>

A payment URI is frequently retained after it is used: in a chat history, a
device backup, a printed card that is thrown away, or a screenshot. Everyone
who later obtains it holds the payment wallet's full viewing key. If the claim
transaction's output were encrypted to the payment wallet's outgoing viewing
key, as a wallet normally does for its own spends, every such party could
decrypt the output and learn the claimant's address and the amount they
received. This includes the minter, who can re-derive a seed-derived payment
secret at any time and would otherwise learn the claimant's address and be
able to link later payments to it. Using a random $\mathsf{ock}$ instead makes
the claim output opaque to the payment secret. The trade-off is that the claimant cannot use
the payment secret to prove or recover where the funds went; their own wallet
is the only record, which is the same situation as for any other received
note.

.. raw:: html

   </details>

Reclaiming
----------

At any time prior to the payment being claimed, the minter is capable of
cancelling the payment, by themselves claiming the payment into their own
wallet (thereby “clawing back” the funds). The minter's wallet SHOULD offer
this feature. A reclaim is a claim transaction as specified in `Claiming`_,
constructed by the minter's wallet with one of its own shielded receivers as
the destination; all requirements of that section apply, with confirmations
as described in `Payment Rendering and Blockchain Lookup`_.

There is no on-chain expiry: an unclaimed payment remains claimable, by the
minter and by any holder of the URI, indefinitely. A minter who intends to
reclaim unclaimed payments SHOULD announce the date after which it will do
so, in the ``desc`` value or alongside the URI.

Reclaiming is subject to a race: the minter and a holder of the URI can both
construct claim transactions spending the same notes, and whichever is mined
first succeeds. A wallet MUST treat the failure of its own claim transaction
because the notes were spent elsewhere as a normal outcome and convey it as
*Claimed* (by someone else) rather than as an error.

If the minter's wallet has not yet broadcast the funding transaction, the
payment can also be cancelled by discarding that transaction.

Reclaiming requires the minter to know the payment secret. If the minter has
lost this state, it can be recovered deterministically for seed-derived
payments (see `Recovery From Wallet Crash`_, below).

Status View
-----------

Wallet apps SHOULD let the user view the status of all payments they have
minted, as well as all inbound payments (i.e., URI-Encapsulated Payments that
have been opened in the app). The status includes the available metadata, and
the payment's current state. When pertinent, the wallet app SHOULD offer the
ability to claim any *Ready to claim* inbound payment, and MAY offer the
ability to reclaim any outbound payment that has not been claimed.

The minter's wallet can track the state of a payment it minted by scanning
with the payment wallet's full viewing key: the payment is *unclaimed* while
its notes are unspent and *claimed* once they are spent by a transaction that
the minter's wallet did not create.

Wallet apps SHOULD actively alert the user (e.g., via status notifications) if
a payment that they minted has not been claimed within a reasonable time
period (e.g., 1 week), and offer to reclaim the payment.

Recovery From Wallet Crash
--------------------------

Because seed-derived payment secrets are a deterministic function of the
wallet seed, a minter that has lost all other state can recover its unclaimed
payments.

The RECOMMENDED approach is for the minting wallet to persist, in storage that
is backed up alongside the seed (for example wallet metadata encrypted under
ZIP 325 [#zip-0325]_ keys), the next unused $\mathit{index}$ and, for each
minted payment, its ``height``. Recovery then consists of re-deriving each
payment wallet and scanning it from its recorded height.

If no such metadata is available, the wallet MAY fall back to a gap-limit
search, similar to the “address gap limit” in BIP 44: derive the payment
wallets for $\mathit{index} = 0, 1, 2, \ldots$, scan each from the minting
wallet's own birthday, and stop after $N$ consecutive indices whose payment
address has never received a note. We specify a standard gap limit of
$N = 3$. Because each index is a separate full viewing key, this search costs
one full scan per index; it is a fallback, not the primary mechanism.

A minter that uses random secrets has no such recovery path and MUST keep its
own durable record of secrets if it intends to reclaim.

A claimant needs no recovery mechanism beyond the URI itself: a payment URI
can be re-opened at any time until it is claimed, and the payment wallet can
also be restored, by any wallet, from the 24-word mnemonic sentence that
encodes the payment secret (see `Payment wallet derivation`_).


Known Uses
==========

*This section is informative. It describes deployed formats; it is not part of
the specification.*

The ``vizor://payment-link`` and ``https://<host>/payment-links/open#v1=``,
``#v2=`` and ``#v3=`` formats described below were designed and deployed by
the Vizor wallet developers, before this revision of the ZIP. The
encapsulated-wallet model of this ZIP follows their deployed design: a bearer
secret for an ordinary single-account wallet, derived from a BIP 39 phrase
as in `Payment wallet derivation`_ (ZIP 32 account 0, empty passphrase),
found by scanning from a birthday height, and funded with the advertised
amount plus a 10000-zatoshi fee reserve in a single fully-shielded
transaction without a memo. Kris Nuttycombe's draft "Mnemonic-Encapsulated
Payment Links" describes that protocol; the shapes below are taken from it
and from links observed in use.

A wallet may accept these forms in addition to the ``v=1`` form. When it does,
it derives the payment wallet from the phrase or entropy as in `Payment wallet
derivation`_, and everything in `Lifecycle Specification`_ applies unchanged:
the claim sweeps the whole balance, does not use the payment wallet's outgoing
viewing key, and follows ZIP 315 for confirmations. New payments use the
``v=1`` form.

**Custom-scheme form.** ``vizor://payment-link?p=<payload>``, where the value
of ``p``, after percent-decoding, is base64url [#RFC4648]_ of a UTF-8 JSON
[#RFC8259]_ object. The draft says producers emit padded base64url and that
readers accept padded and unpadded payloads. The object has these members
(unknown members are ignored, and string values are trimmed):

* ``v``: the JSON number ``1``;
* ``network``: ``"main"``, ``"test"`` or ``"regtest"``;
* ``address``: the payment wallet's default Unified Address. The draft
  describes it as having an Orchard and a Sapling receiver and no transparent
  receiver; a published test vector of the deployed implementation instead
  shows an Orchard-only address.
  A reader may check it against the address it derives;
* ``amountZatoshi``: the amount the recipient is meant to receive, in
  zatoshis, as a decimal string or a JSON integer;
* ``mnemonic``: the BIP 39 English phrase, with words separated by
  whitespace. Producers generate 24 words, and phrases of 12 or more words
  are accepted;
* ``birthdayHeight``: a block height, as a JSON integer or a decimal string;
* ``label``: a short string;
* ``createdAt``: an ISO 8601 timestamp in UTC;
* ``presentation`` (optional): an object with an optional ``artworkId`` (a
  card artwork identifier of 1 to 64 letters, digits, ``-`` or ``_``) and an
  optional ``message`` (at most 128 extended grapheme clusters [#UAX29]_ and
  512 bytes of UTF-8).

**HTTPS forms.** ``https://<host>/payment-links/open#<tag>=<payload>``, where
``<tag>`` is ``v1``, ``v2`` or ``v3`` and ``<payload>`` is base64url of a
UTF-8 JSON document. Observed payloads are unpadded; readers accept both
unpadded payloads and payloads with canonical padding, and reject non-zero
trailing bits.

* ``v1`` and ``v2``: a JSON object with the members above. The inner ``v``
  is the JSON number 1 or 2, matching the tag. How ``v2`` differs from ``v1``
  has not been documented.
* ``v3``: a JSON array of 4 to 8 elements: the network string (``"main"``);
  the BIP 39 entropy as base64url (16, 20, 24, 28 or 32 bytes, so the phrase
  may have fewer than 24 words); the birthday height, as a JSON integer or a
  decimal string; the amount in zatoshis as a decimal string; a card artwork
  identifier; a fiat value (a JSON number in the observed link); and the
  message string.

Only Mainnet links of the HTTPS forms have been observed, and a reader may
accept only Mainnet links of the forms in this section. Unlike the advisory
``amount`` of the ``v=1`` form, the amount of these forms is a required
member: readers treat a payload whose amount is missing, zero, not an integer
or above the maximum money supply (or, for ``v3``, not a JSON string) as
malformed. The birthday height is subject to the same minimum birthday height
as ``height`` (see `Semantics`_), and the message is limited to 512 bytes and
sanitized as specified for ``desc`` (see `Sanitization of the description`_).

The deployed protocol differs from this specification in its claim behaviour: it
sweeps exactly the advertised amount, spends funds with a single confirmation
instead of following ZIP 315, refuses links whose birthday is more than 100000
blocks behind the tip, and allows a Sapling destination. This specification does
not adopt these choices; see `Rationale for sweeping the full balance`_,
`Rationale for the confirmation policy`_ and `Rationale for not limiting the age
of a payment`_. Funds that a minter using these forms sent to a Sapling receiver
are found and swept like any other funds of the payment wallet.


Security Considerations
=======================

* Anyone who learns a Payment-Encapsulating URI may take the encapsulated
  funds. The URI is a *bearer secret*. It should be sent over a secure channel
  and kept secret from anyone but the intended recipient. Common ways to leak
  it include: chat and device backups, screenshots, clipboard history, browser
  history and HTTP referrers (if the URI is ever opened in a browser),
  server and proxy logs (if it is ever placed in a query string instead of the
  fragment), notification previews, and printed copies.

  * The Payment-Encapsulating URI is like a magic spell that will teleport the
    money to the first person that clicks it and then does "claim".

* The host named in the URI never receives the fragment in an HTTP request,
  but any JavaScript that the host serves can read it. Host operators should
  serve a static landing page with no analytics or third-party scripts, and
  wallets should handle URIs through applinks so that no request to the host
  is made (see `Hosts and landing pages`_). Compromise of the host, or of a
  CDN or tag manager it embeds, would otherwise allow theft of every unclaimed
  payment opened in a browser.

* URI-Encapsulated Payments may be captured by malicious local apps on the
  sender or receiver's platform, e.g., by screen capturing or clipboard
  eavesdropping. Wallet apps should use the platform's interaction and
  communication facilities in a way that minimizes these risks (e.g., use the
  “Share” API rather than a clipboard that is visible to all apps).

* Likewise, if the URI is transferred by presenting and optically scanning a
  QR code, anyone who observes this QR code may be able to claim the payment
  and thus take ownership of the funds before the intended recipient. For
  example, an attacker may use a telephoto lens aimed at a point-of-sale
  terminal to steal QR-encoded payments sent to that terminal.

* Printed payments ("gift cards") should be funded only once, while the
  printed medium is still in the minter's custody, and should be handed over
  in a way that the printed URI cannot be read beforehand (e.g., under a
  scratch-off layer or inside sealed packaging). A card that has been out of
  the minter's custody should never be topped up, since its secret may already
  have been copied.

* The ``height`` parameter must not be greater than the height at which the
  funding transaction was mined; otherwise a claimant scanning from ``height``
  will never find the funds and will report the payment as empty, even though
  the minter's wallet shows it as funded. Producers that generate the URI
  before the funding transaction is mined must use a height at or below the
  current chain tip, and a reorganization between URI generation and mining
  cannot move the funding transaction below that height.

* Claim transactions discard the payment wallet's outgoing viewing key. This
  protects the claimant from everyone who later obtains the URI, at the cost
  that the claim output cannot be recovered from the payment secret (see
  `Rationale for discarding the outgoing viewing key`_). Wallets must not
  "helpfully" encrypt the output to the payment wallet's outgoing viewing key
  for the sake of history display.

* The temporary wallet used to scan and claim must be isolated from the user's
  own accounts and deleted after the claim is broadcast. Importing the payment
  wallet's keys into the user's main wallet would make a bearer secret, known
  to at least one other party, part of the user's own spending authority, and
  would cause the user's wallet to display and potentially reuse an address
  that others control.

* Wallet UX must make clear that the funds come from a URI-Encapsulated Payment
  and let the user cancel before anything is broadcast. Opening a URI must not
  by itself move funds: an applink can be triggered by any web page, and a
  hostile page could otherwise cause a user to sweep a payment into their own
  wallet as a way of making them a party to a transfer they did not intend.

* The claim memo may include the ``desc`` text, which is attacker-controlled.
  Wallets must sanitize it (see `Sanitization of the description`_), truncate
  it to the memo size, must not interpret it as markup or as a URI, and should
  display it as the claim made by the URI's author.

* Any web page can deliver payment URIs to a wallet through an applink. The
  intake bounds in `Intake of payment URIs`_ limit the work such a page can
  cause, and the temporary wallet is the only state a hostile URI can
  populate. A URI with a very old ``height`` can make a scan long; wallets
  warn about this and let the user cancel, rather than refusing old payments.

* A claim sweeps every pool the payment wallet holds funds in. Sweeping
  transparent outputs, or Sapling notes into Orchard, reveals on chain the
  value that leaves the transparent or Sapling pool, but nothing about the
  claimant beyond that. Minters should fund the payment address in the
  current pool for the Orchard protocol (the *Orchard pool* before NU6.3
  activation, the *Ironwood pool* after it) so that the usual claim stays
  within one pool.

* Users may have casually-established communication channels (e.g., they have
  entered the phone number of a new contact without bothering to double-check
  it), but may later mistakenly consider these to be adequately-authenticated
  secure channels for the purpose of sending a Payment-Encapsulating URI.
  Wallet apps should mitigate this where feasible, e.g., by indicating that the
  chosen messaging channel is previously-unused and thus should be more
  carefully checked.

* Users may incorrectly believe that the payment has been irrevocably received
  even though they have not claimed it, or even though the claim has failed.
  Wallet software should correctly convey the status and set expectations, as
  discussed above.

* Payment recipients may not notice the incoming payment notification and act
  on it (i.e., claim it) in a timely fashion. By the time they see it, the
  payment may have been reclaimed by the minter.

* Users may not understand that URI-Encapsulated Payments are for one-time
  use, and attempt to use the same URI for multiple people or payments,
  resulting in race conditions on who receives the funds.

* Users may confuse URI-Encapsulated Payments (as specified in the current ZIP)
  with Payment Request URIs of the form ``zcash:payment-address?amount=...`` as
  specified in ZIP 321 [#zip-0321]_. Normally these serve different workflows,
  and work in opposing directions (send vs. receive of funds), and thus ought
  to not arise in ambiguous context. Wallet apps should take care to not create
  or send a Payment-Encapsulating URI (which is for *sending* funds) in a
  context where the user may be intending to *receive* funds.

* Users may attempt to use a Payment-Encapsulating URI as a “cold wallet”,
  e.g., by writing the URI on paper and putting it in a safe. This is
  dangerous. The payment secret is known to the minting wallet at the time
  when the URI is produced, and can be re-derived from the minting wallet's
  seed at any later time. Thus, an adversary who compromises the minting
  wallet may drain the "cold wallet".

* The act and timing of claiming a payment is visible to the minter, which may
  be a privacy leak. Likewise, the timing of the funding transaction can be
  linked to the later claim, which may be a privacy leak.

* The payment amount is readily visible to anyone who observes the
  Payment-Encapsulating URI, even in retrospect after the payment has already
  been claimed (e.g., if their device or chat log backups are later
  compromised). This may be a privacy concern, and in particular may put
  recipients of large payments at risk of undesired attention. Minters MAY
  omit ``amount`` for this reason.

* Usage of URI-Encapsulated Payments may train users to, generally, click on
  other types of URI/URL links sent in other messaging contexts. Malicious
  links sent via unauthenticated messaging channels (e.g., emails and SMS
  texts) are a common attack vector, used for exploiting vulnerabilities in the
  apps triggered to handle these links. Even though the fault for
  vulnerabilities lies with those other apps, and even though this ZIP uses
  deep link URIs in the way intended, there are none the less these negative
  externalities to encouraging such use.


Design Decisions and Rationale
==============================

Rationale for URI Format
------------------------

The URI format ``https://<host>/#v=1&key=...`` was chosen to allow automatic
triggering of wallet software on mobile devices, using the platform's applink_
mechanism, while keeping the payment secret off the network: the contents of
the fragment identifier are specified by HTTP as being resolved locally,
rather than sent over the network. Any HTTPS host can be used, which lets
each wallet vendor or service operate its own applink domain and landing page
without a central authority, at the cost that the security of the landing
page is the responsibility of each host operator (see `Hosts and landing
pages`_ and `Security Considerations`_).

Several alternatives were considered:

1. A reserved origin that does not resolve (for example a reserved domain with
   an invalid port number such as ``65536``), so that following the link
   without a wallet installed performs no network request at all. This gives
   defense in depth against a compromised landing page, but it requires a
   single party to control the domain and the applink whitelist for every
   wallet, produces a confusing error or blank page for users without a
   wallet, and in practice was found to be rejected or rewritten by some
   messaging platforms. The present design instead requires landing pages to
   be static and lets wallets avoid the host entirely.

2. ``zcash-data:payment/v1?amount=1.23&desc=Payment+for+foo&key=...``: a
   custom URI scheme. This still allows for triggering application action
   (e.g., using Mobile Deep Links). However, on most platforms, *any* app
   installed on the device is able to register to handle links from (almost)
   any custom URI scheme. If the request is received by a rogue party, then
   the funds could be stolen. Also, custom URI schemes are not linkified when
   displayed in some messaging apps, and provide no fallback for users
   without a wallet.

   Note that the ``zcash:`` scheme is already used to specify Zcash addresses
   and payment requests in ZIP 321 [#zip-0321]_, by analogy to the
   ``bitcoin`` URIs of BIP 21, and is therefore unsuitable in any case.

3. Adding a confirmation code outside the URI that needs to be manually
   entered by the user into the wallet app, so that merely intercepting the
   URI link would not suffice. This does not seem to significantly reduce risk
   in the scenarios considered, and so was deemed to not justify the reduced
   usability.

The payment secret is Bech32m-encoded, rather than base64url or hex, so that
it carries a checksum (a mistyped or truncated secret is detected rather than
yielding an empty wallet), so that its Human-Readable Part identifies both the
nature of the string and the network, and so that it survives
case-normalization and is QR-friendly in the same way as Zcash addresses.

Rationale for scanning from a birthday
--------------------------------------

The recipient's wallet needs to find the notes related to the payment in order
to verify their validity and then spend them. Earlier drafts of this ZIP
considered several ways to identify those notes without scanning: listing note
commitments in the URI, placing a public tag in the memo or in an extra
output, or deriving a single note deterministically from the secret and the
amount so that its commitment could be looked up in an index. All of these
either lengthen the URI, leak information on chain, require infrastructure
that light clients do not otherwise have, or constrain the funding transaction
to a single note of a fixed amount.

The present design instead includes a birthday height in the URI and scans
from there, which is exactly the operation a light client already performs for
its own accounts and requires no additional infrastructure. Because the
payment wallet is a single account with a known birthday that is
usually close to the chain tip, the scan is short in practice. It also means
that the payment address can be funded with any number of notes, at any time
after minting, and that top-ups and partial reclaims behave naturally.

Rationale for advisory metadata
-------------------------------

The ``amount`` and ``desc`` parameters are provided within the URI so that the
metadata is available for presentation to the user before the chain has been
scanned. They are advisory rather than binding because the on-chain state is
the only thing a claimant can rely on, and because binding them would require
either a note-derivation scheme (see above) or a signature over the URI by a
key that the claimant has no reason to trust.

We do not include the sender's or receiver's identity in the URI, because the
minting wallet may not know the name of who it is sending to (or even from).
Moreover there is the risk that fraudulent sender/recipient information could
be used. If necessitated by circumstances, claimed sender and recipient
identity can be included in the ``desc`` parameter.

Rationale for no on-chain expiry
--------------------------------

An on-chain expiry would require either a time-locked spending condition,
which shielded Zcash does not provide, or a pre-signed reclaim transaction
with a future expiry, which would have to be refreshed and would reveal the
minter's intent on chain. Leaving reclaim entirely to the minter's wallet
keeps the on-chain footprint ordinary and lets minters choose their own
policy; the cost is a race that both parties must handle gracefully.


Open Questions
==============

* Whether the Human-Readable Parts ``zgift``, ``zgifttest`` and
  ``zgiftregtest`` should be renamed to reflect the "URI-Encapsulated
  Payment" terminology of this ZIP, and where they should be registered.

* Whether the BIP 39 mnemonic should remain a normative intermediate step in
  `Payment wallet derivation`_, or whether the ZIP 32 seed should be derived
  directly from the payment secret with a domain separator.

* Whether, once ZIP 316 Revision 2 is deployed, the payment address should be
  required to be encoded as a ``zu`` Unified Address.

* How the payment address is to be encoded once NU6.3 is active, if ZIP 258
  or the ZIPs it cites define a distinct encoding for Ironwood-pool payments.

* Whether payment wallets minted after NU6.3 activation should use the
  quantum-recoverable key generation of ZIP 2005 [#zip-2005]_.

* Whether the `Known Uses`_ section should be kept once the deployed formats
  are no longer produced.

* Whether to specify a fixed memo prefix for claim transactions, so that
  claimed payments can be recognised in wallet history across
  implementations.

* Should minters delay broadcasting a funding transaction by a random amount
  to prevent traffic analysis (i.e., so the messaging service operator cannot
  correlate messages with on-chain transactions)?


Test Vectors
============

Test vectors for this ZIP will cover:

* derivation of seed-derived payment secrets from a wallet seed, for
  $\mathit{index} \in \{0, 1, 2^{31} - 1\}$ on Mainnet and Testnet;
* the Bech32m encoding of each payment secret with the corresponding
  Human-Readable Part;
* the BIP 39 mnemonic sentence, BIP 39 seed, Orchard full viewing key and
  payment address (as an Orchard-only Unified Address) derived from each
  payment secret;
* canonical payment URIs with and without ``amount`` and ``desc``, including a
  ``desc`` containing non-ASCII and reserved characters; and
* an all-uppercase ``key``, which is accepted, and URIs containing empty pairs
  and pairs without ``=``, which are skipped or ignored;
* inputs that MUST be rejected: a Bech32 (non-m) checksum, a 31- or 33-byte
  data part, non-zero padding bits, a mixed-case ``key``, an unknown
  Human-Readable Part, a wrong-network Human-Readable Part, ``v=2``, a
  duplicated ``v``, ``key`` or ``height``, ``height=0``, a ``height`` with a
  leading zero, and a ``height`` one below the minimum birthday height;
* inputs whose ``amount`` or ``desc`` is treated as absent: ``amount=0``,
  ``amount=1.``, ``amount=0.123456789``, a duplicated ``amount``, a ``desc``
  with a malformed percent escape or invalid UTF-8, a ``desc`` longer than
  512 bytes, and a ``desc`` that is blank after sanitization;
* a ``desc`` containing characters that sanitization replaces or removes; and
* the HTTPS forms described in `Known Uses`_, padded and unpadded.

.. TODO: add the actual vectors once the shared vector file is published; the
   descriptions above are the agreed coverage.


Acknowledgements
================

This revision merges the work in Kris Nuttycombe's draft "Mnemonic-Encapsulated
Payment Links", which specified the payment-link protocol deployed by the Vizor
wallet. That draft contributed the rules for recording a payment durably before
funding it, for funding through a hardware signer, and for bounding the intake
of incoming links, as well as the description of the formats in `Known Uses`_.
Thanks to the Vizor wallet developers for deploying and documenting that
protocol.


Reference implementation
========================

The ZODL wallets implement this specification for recipients: intake and
parsing of payment URIs, derivation of the payment wallet, the status view,
and claiming. Support first shipped in Zodl 3.16.0 for iOS and Android. The
code is open source:

* ZODL Swift Wallet SDK [#zodl-swift-sdk]_: ``rust/src/liberated_payment.rs``
  (the payment secret and its encoding, the payment URI, payment wallet
  derivation, and seed-derived minting with ZIP 32 registered key derivation)
  and ``Sources/ZODLSwiftWalletSDK/GiftCard/`` (the status check and the claim
  transaction), documented in ``docs/GIFT_CARDS.md``.
* ZODL Android Wallet SDK [#zodl-android-sdk]_:
  ``backend-lib/src/main/rust/liberated_payment.rs`` and
  ``backend-lib/src/main/rust/gift_card.rs`` (parsing and payment wallet
  derivation) and ``sdk-lib/src/main/java/cash/z/ecc/android/sdk/GiftCardRedeemer.kt``
  (the status check and the claim transaction).
* Zodl for iOS [#zodl-ios]_: ``secant/Sources/Dependencies/GiftCardClient/``
  and ``secant/Sources/Features/GiftCard/`` (intake of payment URIs, the status
  view and claiming).
* Zodl for Android [#zodl-android]_: ``ui-lib/src/main/java/co/electriccoin/zcash/ui/common/repository/GiftCardRepository.kt``
  and ``ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/redeemgift/``
  (intake of payment URIs, the status view and claiming).


References
==========

.. [#BCP14] `Information on BCP 14 — "RFC 2119: Key words for use in RFCs to Indicate Requirement Levels" and "RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words" <https://www.rfc-editor.org/info/bcp14>`_
.. [#RFC3629] `RFC 3629: UTF-8, a transformation format of ISO 10646 <https://www.rfc-editor.org/rfc/rfc3629.html>`_
.. [#RFC3986] `Uniform Resource Identifier (URI): Generic Syntax <https://tools.ietf.org/html/rfc3986>`_
.. [#RFC4648] `RFC 4648: The Base16, Base32, and Base64 Data Encodings <https://www.rfc-editor.org/rfc/rfc4648.html>`_
.. [#RFC8259] `RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format <https://www.rfc-editor.org/rfc/rfc8259.html>`_
.. [#UAX29] `Unicode Standard Annex #29: Unicode Text Segmentation <https://www.unicode.org/reports/tr29/>`_
.. [#protocol] `Zcash Protocol Specification, Version 2025.6.3 or later <protocol/protocol.pdf>`_
.. [#protocol-networks] `Zcash Protocol Specification, Version 2025.6.3 [NU6.1]. Section 3.12: Mainnet and Testnet <protocol/protocol.pdf#networks>`_
.. [#protocol-orchardkeycomponents] `Zcash Protocol Specification, Version 2025.6.3 [NU6.1]. Section 4.2.3: Orchard Key Components <protocol/protocol.pdf#orchardkeycomponents>`_
.. [#protocol-saplingandorchardinband] `Zcash Protocol Specification, Version 2025.6.3 [NU6.1]. Section: In-band secret distribution (Sapling and Orchard) <protocol/protocol.pdf#saplingandorchardinband>`_
.. [#bip-0039] `BIP 39: Mnemonic code for generating deterministic keys <https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki>`_
.. [#bip-0044] `BIP 44: Multi-Account Hierarchy for Deterministic Wallets <https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki>`_
.. [#bip-0350] `BIP 350: Bech32m format for v1+ witness addresses <https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki>`_
.. [#slip-0044] `SLIP 44: Registered coin types for BIP-0044 <https://github.com/satoshilabs/slips/blob/master/slip-0044.md>`_
.. [#zip-0032-sapling] `ZIP 32: Shielded Hierarchical Deterministic Wallets — Sapling key path <zip-0032.rst#sapling-key-path>`_
.. [#zip-0032-orchard] `ZIP 32: Shielded Hierarchical Deterministic Wallets — Orchard key path <zip-0032.rst#orchard-key-path>`_
.. [#zip-0032-registered] `ZIP 32: Shielded Hierarchical Deterministic Wallets — Specification: Registered key derivation <zip-0032.rst#specification-registered-key-derivation>`_
.. [#zip-0173] `ZIP 173: Bech32 Format <zip-0173.rst>`_
.. [#zip-0203] `ZIP 203: Transaction Expiry <zip-0203.rst>`_
.. [#zip-0315] `ZIP 315: Best Practices for Wallet Implementations <zip-0315.rst>`_
.. [#zip-0316] `ZIP 316: Unified Addresses and Unified Viewing Keys <zip-0316.rst>`_
.. [#zip-0258] `ZIP 258: Deployment of the NU6.3 Network Upgrade <zip-0258.md>`_
.. [#zip-0258-nu63-rules] `ZIP 258: Deployment of the NU6.3 Network Upgrade — Consensus rules from NU6.3 activation <zip-0258.md>`_
.. [#zip-0317] `ZIP 317: Proportional Transfer Fee Mechanism <zip-0317.rst>`_
.. [#zip-0321] `ZIP 321: Payment Request URIs <zip-0321.rst>`_
.. [#zip-0321-amount] `ZIP 321: Payment Request URIs — ZEC Transfer Amount <zip-0321.rst#zec-transfer-amount>`_
.. [#zip-0325] `ZIP 325: Account Metadata Keys <zip-0325.md>`_
.. [#zip-0326] `ZIP 326: NU6.3 Consequences for Wallets <zip-0326.md>`_
.. [#zip-0326-keygen] `ZIP 326: NU6.3 Consequences for Wallets — Wallet key-generation restrictions <zip-0326.md>`_
.. [#zip-0326-receiving] `ZIP 326: NU6.3 Consequences for Wallets — Receiving funds into the Ironwood pool <zip-0326.md>`_
.. [#zip-0326-fabricated] `ZIP 326: NU6.3 Consequences for Wallets — Fabricated same-address outputs and randomized note ciphertexts <zip-0326.md>`_
.. [#zip-0374] `ZIP 374: Partially Created Zcash Transaction Format <zip-0374.md>`_
.. [#zip-2005] `ZIP 2005: Ironwood Quantum Recoverability <zip-2005.md>`_
.. [#zodl-swift-sdk] `ZODL Swift Wallet SDK, version 8.0.0 <https://github.com/zodl-inc/zodl-swift-wallet-sdk/tree/8.0.0>`_
.. [#zodl-android-sdk] `ZODL Android Wallet SDK, version 6.0.0 <https://github.com/zodl-inc/zodl-android-wallet-sdk/tree/v6.0.0>`_
.. [#zodl-ios] `Zodl for iOS, version 3.17.1 <https://github.com/zodl-inc/zodl-ios/tree/3.17.1>`_
.. [#zodl-android] `Zodl for Android, version 3.20.0 <https://github.com/zodl-inc/zodl-android/tree/3.20.0-3807>`_
.. [#app-links] `Android Developer Guides: Handling Android App Links <https://developer.android.com/training/app-links>`_
.. [#universal-links] `Apple Xcode Documentation: Allowing apps and websites to link to your content <https://developer.apple.com/documentation/uikit/inter-process_communication/allowing_apps_and_websites_to_link_to_your_content>`_
.. [#app-uri-handlers] `Microsoft Universal Windows Platform Documentation: Enable apps for websites using app URI handlers <https://docs.microsoft.com/en-us/windows/uwp/launch-resume/web-to-app-linking>`_


Publication Blockers
====================

* Add test vectors.
* Settle the Human-Readable Parts and their registration.
* Independent security review, as required by ZIP 0 for a ZIP with security
  and privacy implications.
