Zcash ZIPs
Theme
Appearance
Contents

Unnumbered proposal

Full Post-Quantum Privacy

Draft

Terminology

The key words “MUST”, “MUST NOT”, “SHOULD”, and “MAY” in this document are to be interpreted as described in BCP 14 1 when, and only when, they appear in all capitals.

The character § is used when referring to sections of the Zcash Protocol Specification. 2

The terms “Mainnet” and “Testnet” in this document are to be interpreted as defined in the Zcash Protocol Specification 3.

The term “network upgrade” is used as described in ZIP 200 4.

The terms below are to be interpreted as follows:

KEM

:Key exchange mechanism. A method of securely conveying a symmetric key from a sender to a recipient.

Hybrid receiver

:A ZIP 316 experimental Sapling or Orchard Receiver containing the protocol’s \((\mathsf{d}, \mathsf{pk}_{d})\) together with the Xiphos-768 public key diversified by \(\mathsf{d}\kern-0.05em\textsf{.}\)

Payment output

:An ordinary shielded output whose note ciphertext is encrypted with the hybrid note key.

Abstract

A publicly shared shielded address lets a quantum adversary recover its classical incoming viewing key and recognize payments to it. This draft proposes hybrid note encryption using the existing Sapling or Orchard ECDH shared secret and Xiphos, a diversifiable variant of Kopis. The resulting note key depends on both secrets; the note commitment and spending circuit remain unchanged. Hybrid Sapling payments use the Sapling pool; hybrid Orchard payments use the Ironwood pool.

In the proposed network-upgrade format, each hybrid payment output carries a Xiphos ciphertext alongside its ephemeral public key, allowing the wallet to trial-decrypt that output directly. The wallet uses one long-lived Xiphos secret key to scan payments to multiple diversified public keys without recording issued addresses.

Motivation

The Zcash shielded protocols hide the link between a sender and recipient via two mechanisms:

With the looming threat of quantum computers, it is necessary to update the Zcash protocol to preserve privacy in the face of quantum adversaries. The zero-knowledge proofs were designed from the start to favour privacy over correctness; the witness data is unrecoverable to a quantum adversary.

For in-band secret distribution, post-quantum privacy is possible in the current protocols, by design, but only for a subset of use cases. There was a known design limitation due to a lack of suitable cryptographic primitives at the time: if a recipients' address is known to the quantum adversary (for instance, it is posted publicly as a donation address, revealed in an interaction with a different transparent chain, or leaked by a sender), the quantum adversary can recover the incoming viewing key and gain visibility of that account’s externally-incoming transactions.

This does not reveal spends from the account (because learning the IVK does not reveal the full viewing key), nor does it reveal wallet-internal transactions for wallets using internal IVKs (because addresses derived from these are never revealed). However, it means that in practice, users cannot achieve full post-quantum privacy for many common Zcash use cases. Only users who give out addresses privately will have post-quantum privacy, and only as long as their out-of-band communications (over which they give out those addresses, or over which they send notes instead of using in-band secret distribution) are post-quantum private (and not eventually revealed).

TODO: Fill in missing paragraphs here.

The latter of these imposes a requirement on the recipient to trial-decrypt every output on the chain, in order to find the outputs sent to them. This imposes a scanning cost that is linear in the number of spend authorities the recipient controls. Using standard encryption techniques, a user that wished to give out multiple independent recipient addresses would be required to generate independent spend authorities, significantly increasing the scanning cost. The solution to this in the Zcash ecosystem is diversification: the ability to derive multiple recipient addresses from the same spend authority.

Privacy Implications

If the hybrid construction is secure and wallets do not expose a classical-only recognition signal, it aims to hide recipient note contents and ownership even when a quantum adversary knows the published receiver. It does not make the underlying spending authorization post-quantum secure, nor protect old outputs.

Classical diversified addresses are not unlinkable to quantum adversaries.

As long as the classical receiver is present in recipient addresses, addresses will not be unlinkable to quantum adversaries: the classical IVK can be recovered and then used for linking. This hybrid approach still provides value by enabling post-quantum privacy of on-chain transactions, and the use of Xiphos means that scanning efficiency is maintained for multiple addresses. But a further change will be necessary to replace the classically-diversified receiver in circuits with a post-quantum diversified receiver, in order to recover post-quantum unlinkability. At that time, the post-quantum receiver should be migrated to remove the classical component, and remove the hybrid encryption from on-chain transactions.

Requirements

Non-requirements

Specification

Xiphos construction

This draft uses the Xiphos construction specified in 5, including its key generation, encapsulation, composed decapsulation, and batch semantics. Xiphos imports its PKE arithmetic and encodings from Kopis 6; its functions and cryptographic definitions are not redefined here. The Zcash-specific parameter selection, key derivation, receivers, and ciphertext placement are specified below.

PQ-private key trees

For each Sapling or Orchard full viewing key \(\mathsf{fvk}\kern-0.05em\textsf{,}\) derive its classical incoming viewing key \(\mathsf{ivk}_{c}\) as specified for that pool in the Zcash Protocol Specification 7. Derive the 32-byte Xiphos incoming viewing key \(\mathsf{ivk}^{X}\) from the same \(\mathsf{fvk}\kern-0.05em\textsf{:}\)

$$ \mathsf{ivk}^{X} = \mathsf{BLAKE2b\text{-}256}(\mathtt{“Zcash_XiphosIVK1”},; \mathtt{0x01} \mathbin\Vert \mathsf{protocol_id} \mathbin\Vert \mathsf{scope} \mathbin\Vert \mathsf{raw_fvk}) $$

Here \(\mathsf{raw\_fvk}\) is the canonical 96-byte raw FVK encoding for the selected protocol 8. The key-derivation tag \(\mathsf{protocol\_id}\) is 0x01 for Sapling or 0x02 for Orchard (including its use in the Ironwood pool); it is not a ZIP 248 bundle type. \(\mathsf{scope}\) is 0x00 for the external FVK or 0x01 for its internal FVK. The leading 0x01 is the version of this Xiphos key derivation. BLAKE2b-256 uses a 32-byte output and the 16-byte ASCII personalization shown above. The input is exactly 99 bytes. Derive the internal FVK first using the existing pool rules 9, then apply this function to it with \(\mathsf{scope} = 0x01\kern-0.05em\textsf{.}\)

The Zcash integration in this draft provisionally instantiates Xiphos 5 with the Kopis-768 parameter set 6 and DIVERSIFIER_SIZE = 11. This selects Xiphos-768, with SK_SIZE = 32, PK_SIZE = 992, and CT_SIZE = 1088 bytes. The receiver and transaction byte lengths below assume this choice; the final integration parameters remain to be selected. Use XiphosSkToPk, XiphosEncap, and XiphosDecap as specified in 5 with these parameters. For key derivation and decapsulation, use the 32-byte \(\mathsf{ivk}^{X}\) as the Xiphos secret key. For a valid ordinary \((\mathsf{d}, \mathsf{pk}_{d})\kern-0.05em\textsf{,}\) use the protocol’s raw 11-byte diversifier \(\mathsf{d}\) and derive \(\mathsf{pk}^{X}_{d} = \mathsf{XiphosSkToPk}(\mathsf{ivk}^{X}, \mathsf{d})\kern-0.05em\textsf{.}\) Protocol and scope separation are provided by the derivation of \(\mathsf{ivk}^{X}\kern-0.05em\textsf{,}\) not by Xiphos.

The following experimental ZIP 316 10 Receiver and IVK Types are defined for each protocol:

To derive a hybrid Receiver from such an IVK, derive \((\mathsf{d}, \mathsf{pk}_{d})\) from the pool IVK Encoding at the selected diversifier index as in ZIP 316, then compute \(\mathsf{pk}^{X}_{d} = \mathsf{XiphosSkToPk}(\mathsf{ivk}^{X}, \mathsf{d})\kern-0.05em\textsf{.}\)

Consumers MUST reject a Unified Address containing a hybrid Receiver whose encoding is not 1,035 bytes, or whose \((\mathsf{d}, \mathsf{pk}_{d})\) or \(\mathsf{pk}^{X}_{d}\) encoding is invalid. A sender that supports hybrid payments MUST prefer a hybrid Receiver Type to the conventional Receiver Type for the same protocol. A hybrid-only UA contains exactly one hybrid Receiver. A sender paying a hybrid Orchard Receiver MUST use the Ironwood pool, consistent with ZIP 326 11.

These Typecodes are experimental; none is permanently allocated.

For incoming scanning, the wallet derives or retains the pool IVK and \(\mathsf{ivk}^{X}\) from the same full viewing key and scope; it need not retain issued diversifiers.

A conventional pool IVK item alone does not carry \(\mathsf{ivk}^{X}\kern-0.05em\textsf{;}\) the hybrid IVK item carries both the pool’s IVK Encoding and \(\mathsf{ivk}^{X}\kern-0.05em\textsf{.}\)

Hybrid in-band secret distribution

Hybrid note encryption uses the Xiphos-768 instantiation selected in PQ-private key trees above, with Xiphos’s operations defined in 5, and the existing protocol’s ECDH and note-plaintext rules: Sapling for the Sapling pool and Orchard for the Ironwood pool. Note creation and validation use the lead byte and note commitment of the payment’s pool. In particular, Ironwood uses the recoverable note plaintext (lead byte 0x03) specified in ZIP 2005 12.

The hybrid KDF has not received security analysis. This construction has no audited post-quantum privacy claim.

For both encryption and decryption, let the following be as defined for the corresponding pool in the protocol specification’s in-band secret distribution algorithms 13:

For both algorithms, define the following hybrid-specific parameters and functions:

Define the hybrid Sapling KDF as:

$$ \mathsf{KDF}^{XSapling}(\mathsf{sharedSecret}, \mathtt{ephemeralKey}, \mathsf{ss}^{X}) = \mathsf{BLAKE2b\text{-}256}(\mathtt{ZcashXSaplingKDF},; \mathsf{enc32}(\mathsf{sharedSecret}) \mathbin\Vert \mathtt{ephemeralKey} \mathbin\Vert \mathsf{ss}^{X}). $$

Define the hybrid Orchard KDF as:

$$ \mathsf{KDF}^{XOrchard}(\mathsf{sharedSecret}, \mathtt{ephemeralKey}, \mathsf{ss}^{X}) = \mathsf{BLAKE2b\text{-}256}(\mathtt{ZcashXOrchardKDF},; \mathsf{enc32}(\mathsf{sharedSecret}) \mathbin\Vert \mathtt{ephemeralKey} \mathbin\Vert \mathsf{ss}^{X}). $$

Here \(\mathsf{BLAKE2b\text{-}256}\) uses a 32-byte output. Each KDF uses its 16-byte personalization string exactly as shown, without padding. Each KDF input is 96 bytes: the concatenation of three 32-byte values, with no pool identifier byte. The KDF uses the original \(\mathtt{ephemeralKey}\) field bytes, not a re-encoding of \(\mathsf{epk}\kern-0.05em\textsf{.}\)

Encryption (Sapling and Orchard)

Let \(\mathsf{g}_{d}\kern-0.05em\textsf{,}\) \(\mathsf{esk}\kern-0.05em\textsf{,}\) \(\mathsf{ovk}\kern-0.05em\textsf{,}\) \(\mathbf{np}\kern-0.05em\textsf{,}\) \(\mathsf{cv}\kern-0.05em\textsf{,}\) and \(\mathsf{cm}\) be as defined for the corresponding pool’s encryption algorithm 15.

Let \(\mathsf{pk}_{d}\) and \(\mathsf{pk}^{X}_{d}\) be the classical and Xiphos keys in the hybrid Receiver, respectively.

Then to encrypt:

The payment note ciphertext is \((\mathtt{ephemeralKey}, \mathsf{C}^{enc}, \mathsf{C}^{out})\kern-0.05em\textsf{.}\) The transaction encoding specifies where \(\mathsf{ct}^{X}\) is placed.

Decryption using an Incoming Viewing Key (Sapling and Orchard)

Let \((\mathtt{ephemeralKey}, \mathsf{C}^{enc}, \mathsf{C}^{out})\) be the note ciphertext, \(\mathtt{cm*}\) the commitment field, and \(\mathsf{pool}\kern-0.05em\textsf{,}\) \(\mathsf{blockHeight}\kern-0.05em\textsf{,}\) \(\mathsf{txVersion}\kern-0.05em\textsf{,}\) and \(\mathsf{allowedLeadBytes}^{pool}\) be as defined for the pool’s incoming-viewing-key decryption algorithm 16.

Let \((\mathsf{ivk}_{c}, \mathsf{ivk}^{X})\) be paired keys of the same full viewing key and scope, with \(\mathsf{ivk}_{c}\) taking the place of the pool’s incoming viewing key in that algorithm. Let \(\mathsf{ct}^{X}\) be the Xiphos ciphertext associated with the output.

To decrypt:

Call \(\mathsf{XiphosDecap}(\mathsf{ivk}^{X}, \mathsf{ct}^{X}, decrypt)\) with the closure below, whose input is \((\mathsf{ss}^{X})'\kern-0.05em\textsf{.}\) Map its single error to \(\bot\) and return its successful value. Within the closure, each instruction to return \(\bot\) means closure failure, not an early return from \(\mathsf{XiphosDecap}\kern-0.05em\textsf{:}\) re-encryption validation still runs. These are logical rejection conditions; implementations MUST accumulate failures and use constant-time selections and dummy intermediates rather than secret-dependent early exits, including after failed authenticated decryption.

The wallet MUST NOT expose provisional outputs from failed trials.

Batch trial decryption

For the direct ciphertext encoding defined below, each output supplies its own ct_x field. A wallet scans a batch of \(B\) outputs with \(V\) paired incoming viewing keys \((\mathsf{ivk}_{c}, \mathsf{ivk}^{X})\kern-0.05em\textsf{,}\) including each account and scope being scanned. The logical trials are the \(B \times V\) output/key pairs. Each trial has the result of the single-output incoming-viewing-key decryption algorithm above.

A wallet MAY implement these trials in the following stages:

  1. Prepare each output’s public fields, retaining the original ephemeralKey bytes, commitment, ciphertext, and pool-specific context. Compute its Xiphos ciphertext hash and PKE ciphertext preparation once for reuse across incoming viewing keys. Publicly invalid ephemeral keys may be rejected as in single-output decryption.
  2. Prepare the incoming viewing keys. Batch the pool’s ECDH operations where supported, and perform the first phase of Xiphos decapsulation for each eligible output/key pair. Retain an opaque pending state for each pair as described in the Batch Decapsulation section of 5.
  3. For each pair, combine its ECDH secret and provisional Xiphos secret with the hybrid KDF. Run the note-decryption closure, including plaintext, ephemeral-key, and commitment checks, in batches where supported. Each logical closure returns either the recovered diversifier and note data or failure without a diversifier.
  4. Complete Xiphos decapsulation for every pending trial, using its matching closure result. Failed closures use the fallback matrix seed and zero diversifier; they MUST NOT be filtered out before final validation.
  5. Only after completion, release successful notes and memos with their output and viewing-key associations. Deduplicate wallet records where multiple trials identify the same output.

The batch implementation MUST preserve the single-trial constant-time and provisional-result confidentiality requirements. Public-field preparation can be shared across keys; ECDH secrets, recovered messages, and provisional Xiphos secrets are specific to their output/key pairs and MUST NOT be mixed. Key preparation MAY be retained across batches. Batch boundaries and work limits MUST NOT silently omit trials from the wallet’s scan.

Conventional note scanning proceeds independently. Neither success nor failure of conventional decryption permits skipping a hybrid trial. This describes full note decryption; compact-prefix scanning requires a separately specified integration and MUST NOT be treated as authenticated full-ciphertext decryption.

Transaction format changes

The direct encoding uses a new ZIP 248 V7 bundle variant 17 for each participating pool: Sapling (bundle type 2) and Ironwood (bundle type 4). It does not change variant 0 of either type or define a variant for the Orchard pool (bundle type 3). All outputs/actions in a bundle of the new variant have a 1,088-byte ct_x field immediately after ephemeralKey and before encCiphertext in each output’s effecting-data encoding. It is present for every output/action in that variant and does not replace any existing field or add note-commitment proof constraints.

For a hybrid payment, the ct_x field contains its \(\mathsf{XiphosEncap}\) ciphertext. For a conventional output of the new variant, the sender fills ct_x with 1,088 fresh random bytes and encrypts the note conventionally. A wallet scans each output with its paired \((\mathsf{ivk}_{c}, \mathsf{ivk}^{X})\) and ordinary viewing keys, without using conventional decryption to gate the hybrid attempt. Legacy transactions and variant 0 have no ct_x field.

In this bundle variant, ct_x is effecting data. Insert its 1,088 bytes after ephemeralKey and before encCiphertext[..52] in each output/action compact digest of ZIP 248 17; other digest inputs and personalizations follow variant 0. The authorized bundle includes the chosen ct_x bytes. Pool value-balance, note-commitment, proof, nullifier, and other rules are inherited from variant 0. Compact scanning data contains ct_x in addition to the existing commitment, ephemeralKey, and 52-byte encCiphertext prefix.

The V7 bundle variant identifiers, branch ID, Mainnet and Testnet activation heights, and compact-sync transport format are not assigned here.

Rationale

Diversifying the post-quantum public key

The construction-level rationale for Xiphos is in 5. For this Zcash integration, a sender can check the length and encoding of a supplied Xiphos public key, but cannot establish its relationship to \(\mathsf{d}\) without the recipient’s secret key. A receiver derives its own public key from \(\mathsf{d}\) before re-encryption.

Ordinary Kopis derives both the encapsulated key and re-encryption randomness from the decrypted message and a hash of the public key 6. If that public key depends on \(\mathsf{d}\kern-0.05em\textsf{,}\) a wallet cannot calculate the key until after decrypting the note, which is where it learns \(\mathsf{d}\kern-0.05em\textsf{.}\) Xiphos instead derives a provisional note secret from \(\mathsf{m}\) and a hash of the ciphertext, without \(\mathsf{d}\kern-0.05em\textsf{,}\) and still binds re-encryption randomness to the diversified public key. After authenticated note decryption exposes \(\mathsf{d}\kern-0.05em\textsf{,}\) the wallet reconstructs the public key and checks the ciphertext by re-encryption. This separates trial decryption from final validation; it is a new cryptographic construction, not merely a new scheduling of ordinary Kopis decapsulation.

Not changing note commitments

Notes in existing shielded protocols are conceptually the tuple \((\mathsf{d}, \mathsf{pk}_{d}, \mathsf{value}, \ldots)\kern-0.05em\textsf{.}\) \((\mathsf{d}, \mathsf{pk}_{d})\) in these notes serves two separate purposes:

The former of these already has post-quantum privacy via the zero-knowledge proofs (which have statistical privacy, not computational), and thus does not need to be amended by this ZIP. For Ironwood-pool notes, ZIP 2005 12 supports recovery under a potential future protocol; it does not make current spend authorization post-quantum secure.

The latter of these is checked implicitly during trial decryption 16. Summarising the details here: the note plaintext decrypted with \(\mathsf{ivk}_{c}\) only contains \(\mathsf{d}\kern-0.05em\textsf{;}\) \(\mathsf{pk}_{d}\) is re-derived from \(\mathsf{d}\) and \(\mathsf{ivk}_{c}\kern-0.05em\textsf{.}\) Then if the resulting computed note commitment does not match the public note commitment in the transaction, the note is rejected.

A successful hybrid note decryption still verifies the ordinary \((\mathsf{d}, \mathsf{pk}_{d})\) note commitment. The Xiphos public key is not included in that commitment. Whether the hybrid encryption’s authenticated ciphertext and transaction binding are enough to prevent recipient-key substitution or replay across receiver contexts requires separate analysis; this draft does not infer that result solely from the commitment’s existing spending constraints.

Deployment

This ZIP is proposed for a network upgrade alongside, or after, ZIP 248 17.

Reference implementation

TBD

Open issues

References