This page is the Simplified Technical English version of ZIP 2004. The source ZIP is the normative text. Read the writing rules to understand the marked words.
ZIP 2004: Remove the dependency of consensus on note encryption
ZIP: 2004 Title: Remove the dependency of consensus on note encryption Owners: Daira-Emma Hopwood <daira@jacaranda.org> Status: Draft Category: Consensus Created: 2024-10-22 License: MIT Discussions-To: <https://github.com/zcash/zips/issues/917> Pull-Request: <https://github.com/zcash/zips/pull/918>
Terminology
On this page, STE words are in the place of the BCP 14 key words of the source. Refer to the key word table.
The term "network upgrade" in this document has the same meaning as in ZIP 200 [zip-0200].
The character § is the mark for a reference to a section of the Zcash Protocol Specification [protocol].
The terms "Mainnet" and "Testnet" have the same meanings as in § 3.12 ‘Mainnet and Testnet’ [protocol-networks].
Abstract
With ZIP 213 [zip-0213], the ability to shield coinbase outputs was added. An unfortunate side effect of this change was that consensus became dependent on the details of note encryption. As a result, the specification and the implementation of consensus rules became more complex than necessary.
In this ZIP, note encryption is separated from consensus. For this separation, this ZIP has a requirement that coinbase outputs for v6 and later transaction versions are not encrypted. The separation will be complete when earlier transaction versions are not valid on the network any more. This will probably occur in a later network upgrade.
Motivation
In the original design of Zcash, the consensus protocol was carefully kept separate from the details of note encryption. This property was kept through these network upgrades:
- Overwinter
- Sapling
- Blossom
With this property, the consensus protocol has less complexity and a smaller attack surface. Also, with this property, changes to note encryption can possibly occur outside network upgrades.
ZIP 213 [zip-0213] has changes for shielded coinbase outputs. These changes were deployed in the Heartwood network upgrade. As a result of these changes, the consensus protocol became dependent on note encryption. With these changes, a requirement was added: it must be possible to decrypt Sapling and Orchard outputs in coinbase transactions with a sequence of 32 zero bytes as the outgoing viewing key.
The effect of this change on complexity was not noticed. This effect became clear during the design of ZIP 212 [zip-0212] for the Heartwood network upgrade. For a time, there were separate and slightly different implementations of note decryption for the consensus checks: one in zcashd, and one in librustzcash. Before the implementations were made consistent, a chain fork between zcashd and zebrad was possible as a result of this difference.
With this ZIP, the consensus protocol again has the design property that was originally intended.
Requirements
The consensus rule change of this ZIP must have this result from transaction version 6 onward: the implementation and the specification of shielded coinbase outputs are independent of note encryption.
Specification
Changes to the Zcash Protocol Specification
In § 5.4.3 'Symmetric Encryption', change the name \(Sym\) to \(NoteSym\). Also add this text:
Let \(\mathsf{NullSym.}\mathbf{K} := \mathbb{B}^{[256]}\), \(\mathsf{NullSym.}\mathbf{P} := \mathbb{B^Y}^{\mathbb{N}}\), and \(\mathsf{NullSym.}\mathbf{C} := \mathbb{B^Y}^{\mathbb{N}}\).
Let \(\mathsf{NullSym.Encrypt_K}(\mathsf{P}) := \mathsf{P} \,||\, [0x00]^{16}\).
Define \(\mathsf{NullSym.Decrypt_K}(\mathsf{C})\) as follows:
- If the last 16 bytes of \(\mathsf{C}\) are not \([0x00]^{16}\), return \(\bot\). Otherwise discard those 16 bytes and return the remaining prefix of \(\mathsf{C}\).
Note: These definitions intentionally ignore the key; \(\mathsf{NullSym}\) is not a secure authenticated encryption scheme. It MUST be used only for notes in shielded coinbase outputs, which are intended to be visible as cleartext.
In § 4.20 'In-band secret distribution (Sapling and Orchard)', replace this text:
let \(\mathsf{Sym}\) be the encryption scheme instantiated in § 5.4.3 'Symmetric Encryption'.
Put this text in its place:
let \(\mathsf{NoteSym}\) and \(\mathsf{NullSym}\) be as instantiated in § 5.4.3 'Symmetric Encryption'.
[Pre-NU7] let \(\mathsf{Sym}\) be \(\mathsf{NoteSym}\).
[NU7 onward] if the note to be decrypted is in an output of a version 6 or later coinbase transaction, let \(\mathsf{Sym}\) be \(\mathsf{NullSym}\), otherwise let it be \(\mathsf{NoteSym}\).
These changes apply in the same way to Mainnet and Testnet.
TODO: Specify the handling of the ephemeralKey field.
Deployment
The proposal is to deploy this ZIP with the next change of the transaction version. The assumption is that this next version is v6 [zip-0230].
Reference implementation
TBD.
Acknowledgements
The author thanks Jack Grigg and Kris Nuttycombe for the discussions that led to the submission of this ZIP.
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"
- [protocol]
- Zcash Protocol Specification, Version 2025.6.2 or later [NU6.1]
- [protocol-networks]
- Zcash Protocol Specification, Version 2025.6.2 [NU6.1]. Section 3.12: Mainnet and Testnet
- [zip-0200]
- ZIP 200: Network Upgrade Mechanism
- [zip-0212]
- ZIP 212: Allow Recipient to Derive Ephemeral Secret from Note Plaintext
- [zip-0213]
- ZIP 213: Shielded Coinbase
- [zip-0230]
- ZIP 230: Version 6 Transaction Format