ZIP: 212 Title: Allow Recipient to Derive Ephemeral Secret from Note Plaintext Owners: Sean Bowe <sean@electriccoin.co> Status: Final Category: Consensus Created: 2019-03-31 License: MIT
The key words "MUST", "MUST NOT", "SHOULD NOT", 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 following functions are defined in the Zcash Protocol Specification 2 according to the type (Sapling or Orchard) of note plaintext being processed:
This ZIP proposes a new note plaintext format for Sapling Outputs (later extended to include Orchard Actions) in transactions. The new format allows recipients to verify that the sender of an Output or Action knows the private key corresponding to the ephemeral Diffie–Hellman key, in order to avoid an assumption on zk-SNARK soundness for preventing diversified address linkability.
The Sapling and Orchard payment protocols have a feature called "diversified addresses" which allows a single incoming viewing key to receive payments on an enormous number of distinct and unlinkable payment addresses. This feature allows users to maintain many payment addresses without paying additional overhead during blockchain scanning.
The feature works by allowing payment addresses to become a tuple
In order to make a payment to a Sapling or Orchard address, an ephemeral secret
Naïvely, the recipient cannot know which
In order to prevent this attack before activation of this ZIP, the protocol forced the sender to prove knowledge of the discrete logarithm of
However, the latter proof was part of the Sapling Output statement, and so relied on the soundness of the underlying Groth16 zk-SNARK — hence on relatively strong cryptographic assumptions and a trusted setup. It is preferable to force the sender to transfer sufficient information in the note plaintext to allow deriving
Merely sending
Pseudo random functions (PRFs) are defined in section 4.1.2 of the Zcash Protocol Specification 3. We will be adapting
Note plaintext encodings are specified in section 5.5 of the Zcash Protocol Specification 15. Before activation of this ZIP, the encoding of a Sapling note plaintext required that the first byte take the form
Following the activation of this ZIP, senders of Sapling or Orchard notes MUST use the following note plaintext format:
The requirement that the former
The process of sending notes is described in section 4.7.2 of the Zcash Protocol Specification for Sapling 7 and section 4.7.3 for Orchard 8. In addition, the process of encrypting a note is described in section 4.19.1 of the Zcash Protocol Specification 9. Prior to activation of this ZIP, the sender sampled
After the activation of this ZIP, the sender MUST instead sample a uniformly random
For Sapling:
For Orchard:
where
The process of receiving notes in Sapling is described in sections 4.19.2 and 4.19.3 of the Zcash Protocol Specification. 10 11
There is a "grace period" of 32256 blocks starting from the block at which this ZIP activates, during which note plaintexts with lead byte
Let ActivationHeight be the activation height of this ZIP, and let GracePeriodEndHeight be ActivationHeight + 32256.
The height of a transaction in a mined block is defined as the height of that block. An implementation MAY also decrypt mempool transactions, in which case the height used is the height of the next block at the time of the check. An implementation SHOULD NOT attempt to decrypt mempool transactions without having obtained a best-effort view of the current block chain height.
When the recipient of a note (either using an incoming viewing key or a full viewing key) is able to decrypt a note plaintext, it performs the following check on the plaintext lead byte, based on the height of the containing transaction:
If the plaintext lead byte is not accepted then the note MUST be discarded. However, if an implementation decrypted the note from a mempool transaction and it was accepted at that time, but it is later mined in a block after the end of the grace period, then it MAY be retained.
A note plaintext with lead byte
After the activation of this ZIP, any Sapling output of a coinbase transaction that is decrypted to a note plaintext as specified in 17, MUST have note plaintext lead byte equal to
This applies even during the “grace period”, and also applies to funding stream outputs 16 sent to shielded payment addresses, if there are any.
Since NU5 activates after the end of the grace period 19, Orchard outputs will always require a note plaintext lead byte equal to
The attack that this prevents is an interactive attack that requires an adversary to be able to break critical soundness properties of the zk-SNARKs underlying Sapling. It is potentially valid to assume that this cannot occur, due to other damaging effects on the system such as undetectable counterfeiting. However, we have attempted to avoid any instance in the protocol where privacy (even against interactive attacks) depended on strong cryptographic assumptions. Acting differently here would be confusing for users that have previously been told that "privacy does not depend on zk-SNARK soundness" or similar claims.
It would have been possible to infringe on the length of the memo
field and ask the sender to provide
It would be possible to transmit a signature of knowledge of a correct
The grace period is intended to mitigate loss-of-funds risk due to non-conformant sending wallet implementations. The intention is that during the grace period (of about 4 weeks), it will be possible to identify wallets that are still sending plaintexts according to the old specification, and cajole their developers to make the required updates. For the avoidance of doubt, such wallets are non-conformant because it is a "MUST" requirement to immediately switch to sending note plaintexts with lead byte
Historical note: in practice some note plaintexts with lead byte
The changes made in this proposal prevent an interactive attack that could link together diversified addresses by only breaking the knowledge soundness assumption of the zk-SNARK. It is already assumed that the adversary cannot defeat the EC-DDH assumption of the Jubjub (or Pallas) elliptic curve, for it could perform a linkability attack trivially in that case.
In the naïve case where the protocol is modified so that
This proposal will be deployed with the Canopy network upgrade. 18
In zcashd:
In librustzcash:
The discovery that diversified address unlinkability depended on the zk-SNARK knowledge assumption was made by Sean Bowe and Zooko Wilcox.
1 | 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" |
---|
2 | Zcash Protocol Specification, Version 2023.4.0 or later |
---|
3 | Zcash Protocol Specification, Version 2023.4.0. Section 4.1.2: Pseudo Random Functions |
---|
4 | Zcash Protocol Specification, Version 2023.4.0. Section 4.1.8: Commitment |
---|
5 | Zcash Protocol Specification, Version 2023.4.0. Section 4.2.2: Sapling Key Components |
---|
6 | Zcash Protocol Specification, Version 2023.4.0. Section 4.2.3: Orchard Key Components |
---|
7 | Zcash Protocol Specification, Version 2023.4.0. Section 4.7.2: Sending Notes (Sapling) |
---|
8 | Zcash Protocol Specification, Version 2023.4.0. Section 4.7.3: Sending Notes (Orchard) |
---|
9 | Zcash Protocol Specification, Version 2023.4.0. Section 4.19.1: Encryption (Sapling and Orchard) |
---|
10 | Zcash Protocol Specification, Version 2023.4.0. Section 4.19.2: Decryption using an Incoming Viewing Key (Sapling and Orchard) |
---|
11 | Zcash Protocol Specification, Version 2023.4.0. Section 4.19.3: Decryption using a Full Viewing Key (Sapling and Orchard) |
---|
12 | Zcash Protocol Specification, Version 2023.4.0. Section 5.4.1.6: DiversifyHash^Sapling and DiversifyHash^Orchard Hash Functions |
---|
13 | Zcash Protocol Specification, Version 2023.4.0. Section 5.4.5.3 Sapling Key Agreement |
---|
14 | Zcash Protocol Specification, Version 2023.4.0. Section 5.4.5.5 Orchard Key Agreement |
---|
15 | Zcash Protocol Specification, Version 2023.4.0. Section 5.5: Encodings of Note Plaintexts and Memo Fields |
---|
16 | ZIP 207: Split Founders' Reward |
---|
17 | ZIP 213: Shielded Coinbase |
---|
18 | ZIP 251: Deployment of the Canopy Network Upgrade |
---|
19 | ZIP 252: Deployment of the NU5 Network Upgrade |
---|
20 | Commit c31a04a in aditypk00/librustzcash: Move ZIP-212 grace period to end of April |
---|