@@ -143,6 +143,149 @@ Since this proposal is defined only for v6 and later transactions, it is not
143143necessary to consider Sprout JoinSplit outputs. The following sections apply
144144to both Sapling and Orchard outputs.
145145
146+ ## Bundle Type Registration
147+
148+ This ZIP registers the following bundle types in the V6 transaction bundle type
149+ registry defined in ZIP 248 [ ^ zip-0248 ] :
150+
151+ | BundleType | ` mValuePoolDeltas ` | ` mEffectBundles ` | ` mAuthBundles ` | Bundle kind |
152+ | ------------| --------------------| -----------------| ----------------| -----------------------|
153+ | TBD | ❌ | ✅ | ❌ | Memos |
154+ | TBD | ✅ | ✅ | ✅ | Sapling-post-ZIP 231 |
155+ | TBD | ✅ | ✅ | ✅ | Orchard-post-ZIP 231 |
156+
157+ The Memos bundle has no value pool deltas (memo data does not involve value
158+ transfers) and no authorizing data. The effecting data consists of the encoded
159+ memo bundle as defined in [ Encoding in transactions] .
160+
161+ If this ZIP is activated in the same network upgrade as ZIP 248, the encoding
162+ of the Sapling and Orchard bundles described in this ZIP will be used for
163+ bundle types 2 and 3, respectively, and ZIP 248's definition of the Sapling and
164+ Orchard bundles must be updated accordingly. If this ZIP is activated in a
165+ network upgrade AFTER the network upgrade in which ZIP 248 is activated, the
166+ encodings it describes will be assigned distinct bundle identifiers. In this
167+ latter case, a transaction MUST NOT contain both a Sapling-pre-ZIP 231 bundle
168+ and a Sapling-post-ZIP 231 bundle, or both an Orchard-pre-ZIP 231 bundle and an
169+ Orchard-post-ZIP 231 bundle.
170+
171+ ## Sapling-post-ZIP 231 Bundle
172+
173+ The Sapling-post-ZIP 231 bundle replaces the Sapling bundle defined in
174+ ZIP 248 [ ^ zip-0248 ] . The only change is that the note plaintext in each
175+ Sapling output is shortened: the 512-byte memo field is replaced by a
176+ 32-byte $\mathsf{K^{memo}}$, reducing ` encCiphertext ` from 580 bytes to
177+ 100 bytes.
178+
179+ ### Sapling-post-ZIP 231 Effecting Data
180+
181+ The effecting data for the Sapling-post-ZIP 231 bundle describes the Sapling
182+ spends and outputs.
183+
184+ | Bytes | Name | Data Type | Description |
185+ | --------------------------| --------------------| ---------------------------------------------| -------------------------------------------------------------------------------------------------|
186+ | varies | ` nSpendsSapling ` | ` compactSize ` | Number of Sapling Spend descriptions. |
187+ | 96 \* nSpendsSapling | ` vSpendsSapling ` | ` SaplingSpendEffecting[nSpendsSapling] ` | Effecting data for each Sapling Spend. |
188+ | varies | ` nOutputsSapling ` | ` compactSize ` | Number of Sapling Output descriptions. |
189+ | 276 \* nOutputsSapling | ` vOutputsSapling ` | ` SaplingOutputPostZIP231[nOutputsSapling] ` | Sapling Output descriptions. |
190+ | 32 | ` anchorSapling ` | ` byte[32] ` | A root of the Sapling note commitment tree at some block height in the past. |
191+
192+ * The field ` anchorSapling ` is present if and only if $\mathtt{nSpendsSapling} > 0$.
193+
194+ ` SaplingSpendEffecting ` is unchanged from ZIP 248 [ ^ zip-0248 ] .
195+
196+ #### SaplingOutputPostZIP231
197+
198+ | Bytes | Name | Data Type | Description |
199+ | -------| -----------------| -------------| ---------------------------------------------------------------------------------------------------------------------------|
200+ | 32 | ` cv ` | ` byte[32] ` | A value commitment to the net value of the output note. |
201+ | 32 | ` cmu ` | ` byte[32] ` | The $u$-coordinate of the note commitment for the output note. |
202+ | 32 | ` ephemeralKey ` | ` byte[32] ` | An encoding of an ephemeral Jubjub public key. |
203+ | 100 | ` encCiphertext ` | ` byte[100] ` | The encrypted contents of the note plaintext, which contains $\mathsf{K^{memo}}$ in place of the 512-byte memo field. |
204+ | 80 | ` outCiphertext ` | ` byte[80] ` | The encrypted contents of the byte string created by concatenation of the transmission key with the ephemeral secret key. |
205+
206+ ### Sapling-post-ZIP 231 Authorizing Data
207+
208+ The authorizing data is unchanged from the Sapling bundle defined in
209+ ZIP 248 [ ^ zip-0248 ] .
210+
211+ | Bytes | Name | Data Type | Description |
212+ | --------------------------| --------------------------| -----------------------------------| ------------------------------------------------------------------|
213+ | 192 \* nSpendsSapling | ` vSpendProofsSapling ` | ` byte[192 * nSpendsSapling] ` | Encodings of the zk-SNARK proofs for each Sapling Spend. |
214+ | 64 \* nSpendsSapling | ` vSpendAuthSigsSapling ` | ` byte[64 * nSpendsSapling] ` | Authorizing signatures for each Sapling Spend. |
215+ | 192 \* nOutputsSapling | ` vOutputProofsSapling ` | ` byte[192 * nOutputsSapling] ` | Encodings of the zk-SNARK proofs for each Sapling Output. |
216+ | 64 | ` bindingSigSapling ` | ` byte[64] ` | A Sapling binding signature on the SIGHASH transaction hash. |
217+
218+ * The values of ` nSpendsSapling ` and ` nOutputsSapling ` are not re-encoded in
219+ the authorizing data; they are taken from the corresponding effecting data.
220+ * The field ` bindingSigSapling ` is present if and only if
221+ $\mathtt{nSpendsSapling} + \mathtt{nOutputsSapling} > 0$.
222+ * The elements of ` vSpendProofsSapling ` and ` vSpendAuthSigsSapling ` have a
223+ 1:1 correspondence to the elements of ` vSpendsSapling ` in the effecting data
224+ and MUST be ordered such that the element at a given index corresponds to the
225+ ` SaplingSpendEffecting ` at the same index.
226+ * The elements of ` vOutputProofsSapling ` have a 1:1 correspondence to the
227+ elements of ` vOutputsSapling ` in the effecting data and MUST be ordered such
228+ that the proof at a given index corresponds to the ` SaplingOutputPostZIP231 `
229+ at the same index.
230+
231+ ## Orchard-post-ZIP 231 Bundle
232+
233+ The Orchard-post-ZIP 231 bundle replaces the Orchard bundle defined in
234+ ZIP 248 [ ^ zip-0248 ] . As with Sapling, the only change is that the note
235+ plaintext in each Orchard action is shortened: the 512-byte memo field is
236+ replaced by a 32-byte $\mathsf{K^{memo}}$, reducing ` encCiphertext ` from
237+ 580 bytes to 100 bytes.
238+
239+ ### Orchard-post-ZIP 231 Effecting Data
240+
241+ The effecting data for the Orchard-post-ZIP 231 bundle describes the Orchard
242+ actions.
243+
244+ | Bytes | Name | Data Type | Description |
245+ | --------------------------| --------------------| -------------------------------------------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
246+ | varies | ` nActionsOrchard ` | ` compactSize ` | The number of Orchard Action descriptions. |
247+ | 340 \* nActionsOrchard | ` vActionsOrchard ` | ` OrchardActionEffecting[nActionsOrchard] ` | Effecting data for each Orchard Action. |
248+ | 1 | ` flagsOrchard ` | ` byte ` | An 8-bit value representing a set of flags. Ordered from LSB to MSB: ` enableSpendsOrchard ` , ` enableOutputsOrchard ` . The remaining bits are set to $0$. |
249+ | 32 | ` anchorOrchard ` | ` byte[32] ` | A root of the Orchard note commitment tree at some block height in the past. |
250+
251+ * The fields ` flagsOrchard ` and ` anchorOrchard ` are present if and only if
252+ $\mathtt{nActionsOrchard} > 0$.
253+ * For coinbase transactions, the ` enableSpendsOrchard ` bit MUST be set to $0$.
254+
255+ #### OrcharActionEffecting
256+
257+ | Bytes | Name | Data Type | Description |
258+ | -------| -----------------| -------------| ---------------------------------------------------------------------------------------------------------------------------|
259+ | 32 | ` cv ` | ` byte[32] ` | A value commitment to the net value of the input note minus the output note. |
260+ | 32 | ` nullifier ` | ` byte[32] ` | The nullifier of the input note. |
261+ | 32 | ` rk ` | ` byte[32] ` | The randomized validating key for this Action. |
262+ | 32 | ` cmx ` | ` byte[32] ` | The $x$-coordinate of the note commitment for the output note. |
263+ | 32 | ` ephemeralKey ` | ` byte[32] ` | An encoding of an ephemeral Pallas public key. |
264+ | 100 | ` encCiphertext ` | ` byte[100] ` | The encrypted contents of the note plaintext, which contains $\mathsf{K^{memo}}$ in place of the 512-byte memo field. |
265+ | 80 | ` outCiphertext ` | ` byte[80] ` | The encrypted contents of the byte string created by concatenation of the transmission key with the ephemeral secret key. |
266+
267+ ### Orchard-post-ZIP 231 Authorizing Data
268+
269+ The authorizing data is unchanged from the Orchard bundle defined in
270+ ZIP 248 [ ^ zip-0248 ] .
271+
272+ | Bytes | Name | Data Type | Description |
273+ | --------------------------| --------------------------| -----------------------------------| --------------------------------------------------------------------------------------------|
274+ | varies | ` sizeProofsOrchard ` | ` compactSize ` | Length in bytes of ` proofsOrchard ` . Value is $2720 + 2272 \cdot \mathtt{nActionsOrchard}$. |
275+ | sizeProofsOrchard | ` proofsOrchard ` | ` byte[sizeProofsOrchard] ` | Encoding of aggregated zk-SNARK proofs for Orchard Actions. |
276+ | 64 \* nActionsOrchard | ` vSpendAuthSigsOrchard ` | ` byte[64 * nActionsOrchard] ` | Authorizing signatures for each Orchard Action. |
277+ | 64 | ` bindingSigOrchard ` | ` byte[64] ` | An Orchard binding signature on the SIGHASH transaction hash. |
278+
279+ * The value of ` nActionsOrchard ` is not re-encoded in the authorizing data; it
280+ is taken from the corresponding effecting data.
281+ * The fields ` sizeProofsOrchard ` , ` proofsOrchard ` , and ` bindingSigOrchard ` are
282+ present if and only if $\mathtt{nActionsOrchard} > 0$.
283+ * The proofs aggregated in ` proofsOrchard ` , and the elements of
284+ ` vSpendAuthSigsOrchard ` , each have a 1:1 correspondence to the elements of
285+ ` vActionsOrchard ` in the effecting data and MUST be ordered such that the
286+ proof or signature at a given index corresponds to the
287+ ` OrchardActionEffecting ` value at the same index.
288+
146289## Memo bundle
147290
148291A memo bundle consists of a sequence of 272-byte memo chunks, each encrypting
@@ -254,6 +397,9 @@ followed by $\mathtt{0x01}$), ensuring that a malformed memo is not returned.
254397
255398## Encoding in transactions
256399
400+ The following describes the effecting data for the memo bundle. This data
401+ appears in ` mEffectBundles ` with the memo bundle type identifier.
402+
257403| Bytes | Name | Data Type | Description |
258404| ----------| ------------------------| -----------------------------------------------------------| -----------------------------------------------------------------------|
259405| 1 | $\mathtt{fAllPruned}$ | $\mathtt{uint8}$ | 1 if all chunks have been pruned, otherwise 0. |
@@ -276,19 +422,28 @@ If $\mathtt{fAllPruned} = 0$, then:
276422If $\mathtt{fAllPruned} = 1$, then:
277423
278424- $\mathtt{nonceOrHash}$ represents the overall hash for the memo bundle as defined in
279- [ Transaction sighash ] .
425+ [ Transaction Digest ] .
280426- The $\mathtt{nMemoChunks}$, $\mathtt{pruned}$, and $\mathtt{vMemoChunks}$ fields will be absent.
281427
282- ## Transaction sighash
428+ ## Transaction Digest
429+
430+ The memo bundle contributes to the transaction identifier via the
431+ ` effects_bundles_digest ` defined in ZIP 248 [ ^ zip-0248 ] .
283432
284- $\mathsf{memo\_ chunk\_ digest}[ i] = H(\mathtt{vMemoChunks}[ i] ) \\ $
285- $\mathsf{memo\_ bundle\_ digest} = H(\mathsf{concat}(\mathsf{memo\_ chunk\_ digests}))$
433+ The memo bundle's effect digest is computed as follows:
434+
435+ $\mathsf{memo\_ chunk\_ digest}[ i] = \mathsf{BLAKE2b\text{-}256}(\texttt{"ZTxIdMemoChunkHs"}, \mathtt{vMemoChunks}[ i] ) \\ $
436+ $\mathsf{memo\_ bundle\_ digest} = \mathsf{BLAKE2b\text{-}256}(\texttt{"ZTxIdMemoBundHsh"}, \mathsf{concat}(\mathsf{memo\_ chunk\_ digests}))$
437+
438+ For pruned chunks, the $\mathsf{memo\_ chunk\_ digest}$ stored in the transaction
439+ encoding is used directly.
286440
287441The memo bundle digest structure is a performance optimization for the case
288- where all memo chunks in a transaction have been pruned.
442+ where all memo chunks in a transaction have been pruned. When $\mathtt{fAllPruned} = 1$,
443+ the $\mathtt{nonceOrHash}$ field contains the pre-computed $\mathsf{memo\_ bundle\_ digest}$.
289444
290- TODO: finish this to be a modification to the equivalent of ZIP 244 for
291- transaction v6 .
445+ Since the memo bundle has no authorizing data, it does not contribute to the
446+ ` auth_bundles_digest ` .
292447
293448## Changes to ZIP 317 [ ^ zip-0317 ]
294449
581736
582737[ ^ zip-0200 ] : [ ZIP 200: Network Upgrade Mechanism] ( zip-0200.rst )
583738
739+ [ ^ zip-0248 ] : [ ZIP 248: Extensible Transaction Format] ( zip-0248.rst )
740+
584741[ ^ draft-arya-deploy-nu7 ] : [ draft-arya-deploy-nu7: Deployment of the NU7 Network Upgrade] ( draft-arya-deploy-nu7.md )
585742
586- [ ^ zip-0230-orchard- note-plaintext ] : [ ZIP 230: Version 6 Transaction Format — Orchard Note Plaintext ] ( zip-0230.rst#orchard- note-plaintext )
743+ [ ^ zip-0230-note-plaintexts ] : [ ZIP 230: Version 6 Transaction Format — Note Plaintexts ] ( zip-0230.rst#note-plaintexts )
587744
588745[ ^ zip-0302 ] : [ ZIP 302: Standardized Memo Field Format] ( zip-0302.rst )
589746
0 commit comments