This page is the Simplified Technical English version of ZIP 224. The source ZIP is the normative text. Read the writing rules to understand the marked words.
ZIP 224: Orchard Shielded Protocol
ZIP: 224
Title: Orchard Shielded Protocol
Owners: Daira-Emma Hopwood <daira@jacaranda.org>
Jack Grigg <thestr4d@gmail.com>
Sean Bowe <ewillbefull@gmail.com>
Kris Nuttycombe <kris@nutty.land>
Original-Authors: Ying Tong Lai
Status: Final
Category: Consensus
Created: 2021-02-27
License: MIT
Discussions-To: <https://github.com/zcash/zips/issues/435>
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 terms "Testnet" and "Mainnet" have the meaning in Section 3.12 of the Zcash Protocol Specification [protocol-networks].
Abstract
In this document, we propose the Orchard shielded protocol. The definition of a new shielded pool is in this protocol. The pool has spending keys and payment addresses that are suitable for future scalability improvements.
Motivation
At this time, Zcash has two active shielded protocols and associated shielded pools:
- The Sprout shielded protocol is based on the Zerocash paper, with improvements and security fixes [protocol-differences]. As of February 2021, it is a "closing" shielded pool. Nobody can send new ZEC into it.
- The Sapling shielded protocol has many improvements to functionality, and its performance is better by orders of magnitude. As of February 2021, it is the "active" shielded pool.
Both of these shielded protocols have two issues:
- Sprout and Sapling are incompatible with known efficient scalability techniques. A cycle of elliptic curves is necessary for recursive zero-knowledge proofs that are suitable for deployment in a block chain like Zcash. A recursive proof is a proof that includes the verification of an earlier instance of itself along with new state. Elliptic curves are not used in the Sprout protocol. Thus it is inherently inefficient to implement the Sprout protocol inside a circuit. Curves are used in the Sapling protocol, but no known way exists to construct an efficient curve cycle (or a path to one) for these curves.
- The Sprout and Sapling circuits are implemented with a proving system (Groth16). A "trusted setup" is necessary for this proving system. The circuit parameters are a Structured Reference String (SRS) with hidden structure. If the hidden structure is known, it can be used to create fake proofs and thus counterfeit funds. In practice, the parameters are generated with a multiparty computation (MPC). If at least one participant was honest and not compromised, the hidden structure is unrecoverable. The MPCs themselves improved over the years. Zcash had 6 participants in the Sprout MPC, and approximately 90 per round in the Sapling MPC two years later [zcash-paramgen]. But the generation of these parameters is still a point of risk within the protocol. For example, the original proving system for the Sprout circuit (BCTV14) had a bug. Because of this bug, the Sprout shielded protocol was vulnerable to counterfeiting [bctv14-vuln]. To resolve this vulnerability, it was necessary to change the proving system and run a new MPC.
Thus we want to deploy a new shielded protocol. The protocol has a design around a curve cycle. Its proving system is suitable for recursion, and an SRS is not necessary.
Specification
The Orchard protocol must be implemented as specified in the Zcash Protocol Specification [protocol-orchard].
The design of the Orchard protocol is largely the same as the design of the Sapling protocol. Thus we give here a list of differences. The list has references to their normative specifications and to the associated design rationale.
Curves
In the Orchard protocol, the Pallas / Vesta curve cycle is in the place of BLS12-381 and its embedded curve Jubjub:
- Pallas is the "application curve". The Orchard protocol itself is implemented on this curve (compare Jubjub).
- Vesta is the "circuit curve". Its scalar field is the base field of Pallas. This field is the "word" type. The circuit is implemented over this type (compare BLS12-381).
We use the "simplified SWU" algorithm to define an infallible \(\mathsf{GroupHash}\). This is in the place of the fallible BLAKE2s-based mechanism of Sapling. The intention is to follow (version 10 of) the IETF hash-to-curve Internet Draft [ietf-hash-to-curve]. But the protocol specification has precedence if a discrepancy exists.
The curve cycle is an explicit design choice. In this ZIP, only half of the cycle is in use (Pallas is an embedded curve of Vesta). Future protocol updates are expected to use the full cycle.
- Curve specifications: [protocol-pallasandvesta]
- \(\mathsf{GroupHash}\): [protocol-concretegrouphashpallasandvesta]
- Supporting evidence: [pasta-evidence]
Proving system
The proving system of Orchard is Halo 2 [halo2-proving-system], with the PLONKish arithmetization [halo2-arithmetization]. These are in the place of Groth16 and R1CS.
The support of Halo 2 for recursive proofs is not used in this ZIP. Future protocol updates are expected to use this support.
Circuit
Orchard has a single circuit for both spends and outputs, similar to Sprout. An "action" contains both a single (possibly dummy) note that is spent, and a single (possibly dummy) note that is created.
An Orchard transaction contains a "bundle" of actions, and a single Halo 2 proof. This proof applies to all of the actions in the bundle.
- Action description: [protocol-actions]
- Circuit statement: [protocol-actionstatement]
- Design rationale: [orchard-actions]
Commitments
The Orchard protocol has commitment schemes that are equivalent to Sapling. For non-homomorphic commitments, Orchard has the PLONKish-efficient Sinsemilla in the place of Bowe–Hopwood Pedersen hashes.
- Sinsemilla hash function: [protocol-concretesinsemillahash]
- Sinsemilla commitments: [protocol-concretesinsemillacommit]
- Design rationale: [orchard-commitments]
Commitment tree
Orchard has a commitment tree structure that is identical to Sapling, except that we instantiate it with Sinsemilla instead of a Bowe–Hopwood Pedersen hash.
- Design rationale and considered alternatives: [orchard-tree]
Keys and addresses
Orchard keys and payment addresses are structurally similar to Sapling, with these changes:
- The proof authorizing key is removed, and \(\mathsf{nk}\) is now a field element.
- \(\mathsf{ivk}\) is calculated as a Sinsemilla commitment instead of a BLAKE2s output. The full viewing key has an additional component, \(\mathsf{rivk}\). This component is the randomizer for this commitment.
- \(\mathsf{ovk}\) is derived from \(\mathsf{fvk}\), instead of being a component of the spending key.
- Now, the result of each diversifier is a valid payment address.
No Bech32 encoding is defined for an individual Orchard item of these types:
- A shielded payment address.
- An incoming viewing key.
- A full viewing key.
Instead we define unified payment addresses and viewing keys in [zip-0316]. Orchard spending keys are encoded with Bech32m as specified in [protocol-orchardspendingkeyencoding].
Orchard keys can be derived in a hierarchical deterministic (HD) manner. We do not adapt the Sapling HD mechanism from ZIP 32 to Orchard. Instead, we define a hardened-only derivation mechanism (similar to Sprout).
- Key components diagram: [protocol-addressesandkeys]
- Key components specification: [protocol-orchardkeycomponents]
- Encodings: [protocol-orchardpaymentaddrencoding] [protocol-orchardinviewingkeyencoding] [protocol-orchardfullviewingkeyencoding] [protocol-orchardspendingkeyencoding]
- HD key derivation specification: [zip-0032]
- Design rationale: [orchard-keys]
Notes
Orchard notes have the structure \((addr, v, \text{ρ}, \text{φ}, \mathsf{rcm})\). \(\text{ρ}\) is set to the nullifier of the spent note in the same action. Thus \(\text{ρ}\) is unique. \(\text{φ}\) and \(\mathsf{rcm}\) are derived from a random seed (as with Sapling after ZIP 212 [zip-0212]).
- Orchard notes: [protocol-notes]
Nullifiers
Nullifiers for Orchard notes are calculated as:
\(\mathsf{nf} = [F_{\mathsf{nk}}(\text{ρ}) + \text{φ} \pmod{p}] \,\mathcal{G} + \mathsf{cm}\)
In this expression, \(F\) is instantiated with Poseidon, and \(\mathcal{G}\) is a fixed independent base.
- Poseidon: [protocol-poseidonhash]
- Design rationale and considered alternatives: [orchard-nullifiers]
Signatures
The signature scheme of Orchard is RedPallas (RedDSA instantiated with the Pallas curve). It is in the place of RedJubjub of Sapling (RedDSA instantiated with the Jubjub curve).
- RedPallas: [protocol-concretereddsa]
Additional Rationale
The primary motivator for the proposal of a new shielded protocol and pool is the necessity to migrate spend authority to a recursion-friendly curve. Spend authority in the Sapling shielded pool is rooted in the Jubjub curve. But no known way exists to construct an efficient curve cycle (or a path to one) from either Jubjub or BLS12-381.
Recursion-friendliness is a design goal, but we do not propose a recursive protocol in this ZIP. To deploy an entire scaling solution in a single network upgrade is a risky endeavour with a lot of moving parts. We focus only on the components that make a recursive protocol possible (namely the curve cycle and the proving system). Thus we can start the migration of value to a scalable protocol before we deploy the scalable protocol itself.
The remainder of the changes that we make relative to Sapling have two motivations. The first is to simplify the Sapling protocol (and fix deficiencies). The second is to use protocol primitives that are more efficient in the UltraPLONK arithmetization.
Security and Privacy Considerations
In this ZIP, we define a new shielded pool. As with Sapling, in the Orchard protocol only Orchard notes can be spent. The movement of ZEC into or out of the Orchard pool occurs through the \(\mathsf{valueBalanceOrchard}\) transaction field. This has the following considerations:
- The Orchard pool is a separate anonymity set from the Sprout and Sapling pools. The new pool starts with zero notes (as Sapling did at its deployment). But with transactions within Orchard, the size of the anonymity set increases more rapidly than with Sapling, because of the arity-hiding nature of Orchard actions.
- A "transparent turnstile" is created by the \(\mathsf{valueBalanceOrchard}\) field. This turnstile, combined with the consensus checks that the balance of each pool cannot be negative, has two effects. Potential counterfeiting bugs in the Orchard protocol or implementation stay within the Orchard pool. Similarly, potential counterfeiting bugs in existing shielded pools cannot cause inflation of the Orchard pool.
- If a sender spends funds in the Orchard pool to a non-Orchard address, the value of the transaction is revealed. This is a necessary side-effect of the transparent turnstile. But this side-effect can be mitigated if the majority of shielded activity is migrated to the Orchard pool and these transactions become a minority. We recommend that wallets convey within their transaction creation UX that amounts are revealed in these situations.
- We recommend that wallets take steps to migrate their user bases to store funds uniformly within the Orchard pool. Best practices for wallet handling of multiple pools are in a later ZIP [zip-0315].
Test Vectors
Reference Implementation
Deployment
This ZIP is proposed to activate with Network Upgrade 5.
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"
- [zcash-paramgen]
- Parameter Generation
- [bctv14-vuln]
- Zcash Counterfeiting Vulnerability Successfully Remediated
- [protocol-orchard]
- Zcash Protocol Specification, Version 2021.2.16 or later [NU5 proposal]
- [protocol-networks]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 3.12: Mainnet and Testnet
- [protocol-addressesandkeys]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 3.1: Payment Addresses and Keys
- [protocol-notes]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 3.2: Notes
- [protocol-actions]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 3.7: Action Transfers and their Descriptions
- [protocol-actionstatement]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 4.17.4: Action Statement (Orchard)
- [protocol-orchardkeycomponents]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 4.2.3: Orchard Key Components
- [protocol-concretesinsemillahash]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.4.1.9: Sinsemilla Hash Function
- [protocol-poseidonhash]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.4.1.10: PoseidonHash Function
- [protocol-concretereddsa]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.4.7: RedDSA, RedJubjub, and RedPallas
- [protocol-concretesinsemillacommit]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.4.8.4: Sinsemilla commitments
- [protocol-pallasandvesta]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.4.9.6: Pallas and Vesta
- [protocol-concretegrouphashpallasandvesta]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.4.9.8: Group Hash into Pallas and Vesta
- [protocol-orchardpaymentaddrencoding]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.6.4.2: Orchard Raw Payment Addresses
- [protocol-orchardinviewingkeyencoding]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.6.4.3: Orchard Raw Incoming Viewing Keys
- [protocol-orchardfullviewingkeyencoding]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.6.4.4: Orchard Raw Full Viewing Keys
- [protocol-orchardspendingkeyencoding]
- Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 5.6.4.5: Orchard Spending Keys
- [protocol-differences]
- Zcash Protocol Specification, Version 2021.2.16. Section 8: Differences from the Zerocash paper
- [halo2-arithmetization]
- The halo2 Book: 1.2 PLONKish Arithmetization
- [halo2-proving-system]
- The halo2 Book: 3.1. Proving system
- [orchard-keys]
- The Orchard Book: 3.1. Keys and addresses
- [orchard-actions]
- The Orchard Book: 3.2. Actions
- [orchard-commitments]
- The Orchard Book: 3.3. Commitments
- [orchard-tree]
- The Orchard Book: 3.4. Commitment tree
- [orchard-nullifiers]
- The Orchard Book: 3.5. Nullifiers
- [zip-0032]
- ZIP 32: Shielded Hierarchical Deterministic Wallets
- [zip-0212]
- ZIP 212: Allow Recipient to Derive Sapling Ephemeral Secret from Note Plaintext
- [zip-0315]
- ZIP 315: Best Practices for Wallet Handling of Multiple Pools
- [zip-0316]
- ZIP 316: Unified Addresses and Unified Viewing Keys
- [ietf-hash-to-curve]
- draft-irtf-cfrg-hash-to-curve-10: Hashing to Elliptic Curves
- [pasta-evidence]
- Pallas/Vesta supporting evidence