From 6abc86fb989a632877d8a6dbb931a416b2f5cb5d Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Wed, 17 Mar 2021 18:08:29 +0000 Subject: [PATCH] ZIP 225: regenerate HTML. Signed-off-by: Daira Hopwood --- zip-0225.html | 167 +++++++++++++++++++++++++++++++------------------- 1 file changed, 104 insertions(+), 63 deletions(-) diff --git a/zip-0225.html b/zip-0225.html index fe363d7b..4e4c8db2 100644 --- a/zip-0225.html +++ b/zip-0225.html @@ -21,7 +21,7 @@ Discussions-To: <https://g

Abstract

This proposal defines an update to the Zcash peer-to-peer transaction format to include support for data elements required to support the Orchard protocol 2. The new transaction format defines well-bounded regions of the serialized form to serve each of the existing pools of funds, and adds and describes a new region containing Orchard-specific elements.

-

This ZIP also depends upon and defines modifications to the computation of the values TxId Digest, Signature Digest, and Authorizing Data Commitment defined by ZIP 244 6.

+

This ZIP also depends upon and defines modifications to the computation of the values TxId Digest, Signature Digest, and Authorizing Data Commitment defined by ZIP 244 7.

Motivation

The new Orchard shielded pool requires serialized data elements that are distinct from any previous Zcash transaction. In addition, with the activation of ZIP 244, the serialized transaction format will no longer be consensus-critical. It makes sense at this point to define a format that can readily accommodate future extension in a systematic fashion, where elements required for support for a given pool are kept separate.

@@ -112,33 +112,6 @@ Discussions-To: <https://g tx_out Transparent outputs, encoded as in Bitcoin. - - Sprout Transaction Fields - - - varies - nJoinSplit - compactSize - The number of JoinSplit descriptions in vJoinSplit. - - - 1698 * nJoinSplit - vJoinSplit - JSDescriptionGroth16[nJoinSplit] - A sequence of JoinSplit descrptions using Groth16 proofs, encoded per §7.2 ‘JoinSplit Description Encoding and Consensus’. - - - 32 - joinSplitPubKey - byte[32] - An encoding of a JoinSplitSig public validating key. - - - 64 - joinSplitSig - byte[64] - A signature on a prefix of the transaction encoding, to be verfied using joinSplitPubKey as specified in §4.11 ‘Non-malleability (Sprout)’. - Sapling Transaction Fields @@ -275,13 +248,12 @@ Discussions-To: <https://g
  • The valueBalanceSapling, anchorSapling, and bindingSigSapling fields are present if and only if nSpendsSapling + nOutputsSapling > 0. If valueBalanceSapling is not present, then valueBalanceSapling is defined to be 0.
  • The valueBalanceOrchard, anchorOrchard, and bindingSigOrchard fields are present if and only if nActionsOrchard > 0. If valueBalanceOrchard is not present, then valueBalanceOrchard is defined to be 0.
  • -
  • The joinSplitPubKey and joinSplitSig fields are present if and only if nJoinSplit > 0.
  • The elements of vSpendProofsSapling and vSpendAuthSigsSapling have a 1:1 correspondence to the elements of vSpendsSapling and MUST be ordered such that the proof or signature at a given index corresponds to the SpendDescriptionV5 at the same index.
  • The elements of vOutputProofsSapling have a 1:1 correspondence to the elements of vOutputsSapling and MUST be ordered such that the proof at a given index corresponds to the OutputDescriptionV5 at the same index.
  • The proofs aggregated in proofsOrchard, and the elements of vSpendAuthSigsOrchard, each have a 1:1 correspondence to the elements of vActionsOrchard and MUST be ordered such that the proof or signature at a given index corresponds to the OrchardAction at the same index.
  • For coinbase transactions, the spendsEnabledOrchard bit MUST be set to 0.
-

The encodings of tx_in, tx_out, and JSDescriptionGroth16, are as in a version 4 transaction (i.e. unchanged from Canopy). The encodings of SpendDescriptionV5, OutputDescriptionV5 and OrchardAction are described below. The encoding of Sapling Spends and Outputs has changed relative to prior versions in order to better separate data that describe the effects of the transaction from the proofs of and commitments to those effects, and for symmetry with this separation in the Orchard-related parts of the transaction format.

+

The encodings of tx_in, and tx_out are as in a version 4 transaction (i.e. unchanged from Canopy). The encodings of SpendDescriptionV5, OutputDescriptionV5 and OrchardAction are described below. The encoding of Sapling Spends and Outputs has changed relative to prior versions in order to better separate data that describe the effects of the transaction from the proofs of and commitments to those effects, and for symmetry with this separation in the Orchard-related parts of the transaction format.

Sapling Spend Description (SpendDescriptionV5)

@@ -420,59 +392,57 @@ Discussions-To: <https://g

Modifications to ZIP 244

TxId Digest

-

The tree of hashes defined by ZIP 244 6 is re-structured to include a new branch for Orchard hashes. The orchard_digest branch is the only new addition to the tree; header_digest, transparent_digest, sprout_digest, and sapling_digest are as in ZIP 244:

+

The tree of hashes defined by ZIP 244 7 is re-structured to include a new branch for Orchard hashes. The orchard_digest branch is the only new addition to the tree; header_digest, transparent_digest, sprout_digest, and sapling_digest are as in ZIP 244:

txid_digest
 ├── header_digest
 ├── transparent_digest
-├── sprout_digest
 ├── sapling_digest
 └── orchard_digest
txid_digest

The top hash of the txid_digest tree is modified from the ZIP 244 structure to be a BLAKE2b-256 hash of the following values

T.1: header_digest      (32-byte hash output)
 T.2: transparent_digest (32-byte hash output)
-T.3: sprout_digest      (32-byte hash output)
-T.4: sapling_digest     (32-byte hash output)
-T.5: orchard_digest     (32-byte hash output)
+T.3: sapling_digest (32-byte hash output) +T.4: orchard_digest (32-byte hash output)

The personalization field of this hash is unmodified from ZIP 244.

2: orchard_digest

A BLAKE2b-256 hash of the following values

-
T.5c: anchorOrchard                       (32 bytes)
-T.5b: orchard_actions_compact_digest      (32-byte hash output)
-T.5c: orchard_actions_memos_digest        (32-byte hash output)
-T.5d: orchard_actions_noncompact_digest   (32-byte hash output)
-T.5e: valueBalanceOrchard                 (64-bit signed little-endian)
+
T.4c: anchorOrchard                       (32 bytes)
+T.4b: orchard_actions_compact_digest      (32-byte hash output)
+T.4c: orchard_actions_memos_digest        (32-byte hash output)
+T.4d: orchard_actions_noncompact_digest   (32-byte hash output)
+T.4e: valueBalanceOrchard                 (64-bit signed little-endian)

The personalization field of this hash is set to:

"ZTxIdOrchardHash"
-
T.5b: orchard_actions_compact_digest
-

A BLAKE2b-256 hash of the subset of Orchard Action information intended to be included in an updated version of the ZIP-307 7 CompactBlock format for all Orchard Actions belonging to the transaction. For each Action, the following elements are included in the hash:

-
T.5b.i  : nullifier            (field encoding bytes)
-T.5b.ii : cmx                  (field encoding bytes)
-T.5b.iii: ephemeralKey         (field encoding bytes)
-T.5b.iv : encCiphertext[..52]  (First 52 bytes of field encoding)
+
T.4b: orchard_actions_compact_digest
+

A BLAKE2b-256 hash of the subset of Orchard Action information intended to be included in an updated version of the ZIP-307 8 CompactBlock format for all Orchard Actions belonging to the transaction. For each Action, the following elements are included in the hash:

+
T.4b.i  : nullifier            (field encoding bytes)
+T.4b.ii : cmx                  (field encoding bytes)
+T.4b.iii: ephemeralKey         (field encoding bytes)
+T.4b.iv : encCiphertext[..52]  (First 52 bytes of field encoding)

The personalization field of this hash is set to:

"ZTxIdOrcOutCHash"
-
T.5c: orchard_actions_memos_digest
+
T.4c: orchard_actions_memos_digest

A BLAKE2b-256 hash of the subset of Orchard shielded memo field data for all Orchard Actions belonging to the transaction. For each Action, the following elements are included in the hash:

-
T.5c.i: encCiphertext[52..564] (contents of the encrypted memo field)
+
T.4c.i: encCiphertext[52..564] (contents of the encrypted memo field)

The personalization field of this hash is set to:

"ZTxIdOrcOutMHash"
-
T.5d: orchard_actions_noncompact_digest
-

A BLAKE2b-256 hash of the remaining subset of Orchard Action information not intended for inclusion in an updated version of the the ZIP 307 7 CompactBlock format, for all Orchard Actions belonging to the transaction. For each Action, the following elements are included in the hash:

-
T.5d.i  : cv                    (field encoding bytes)
-T.5d.ii : rk                    (field encoding bytes)
-T.5d.iii: encCiphertext[564..]  (post-memo suffix of field encoding)
-T.5d.iv : outCiphertext         (field encoding bytes)
+
T.4d: orchard_actions_noncompact_digest
+

A BLAKE2b-256 hash of the remaining subset of Orchard Action information not intended for inclusion in an updated version of the the ZIP 307 8 CompactBlock format, for all Orchard Actions belonging to the transaction. For each Action, the following elements are included in the hash:

+
T.4d.i  : cv                    (field encoding bytes)
+T.4d.ii : rk                    (field encoding bytes)
+T.4d.iii: encCiphertext[564..]  (post-memo suffix of field encoding)
+T.4d.iv : outCiphertext         (field encoding bytes)

The personalization field of this hash is set to:

"ZTxIdOrcOutNHash"

Signature Digest

-

The signature digest creation algorithm defined by ZIP 244 6 is modified to include a new branch for Orchard hashes. The orchard_digest branch is the only new addition to the tree; header_digest, transparent_digest, sprout_digest, and sapling_digest are as in ZIP 244:

+

The signature digest creation algorithm defined by ZIP 244 7 is modified to include a new branch for Orchard hashes. The orchard_digest branch is the only new addition to the tree; header_digest, transparent_digest, sprout_digest, and sapling_digest are as in ZIP 244:

signature_digest
 ├── header_digest
 ├── transparent_digest
@@ -483,24 +453,23 @@ T.5d.iv : outCiphertext         (field encoding bytes)

A BLAKE2b-256 hash of the following values

S.1: header_digest      (32-byte hash output)
 S.2: transparent_digest (32-byte hash output)
-S.3: sprout_digest      (32-byte hash output)
-S.4: sapling_digest     (32-byte hash output)
-S.5: orchard_digest     (32-byte hash output)
+S.3: sapling_digest (32-byte hash output) +S.4: orchard_digest (32-byte hash output)

The personalization field of this hash is unmodified from ZIP 244

-
S.5: orchard_digest
+
S.4: orchard_digest

Identical to that specified for the transaction identifier.

Authorizing Data Commitment

-

The tree of hashes defined by ZIP 244 6 for authorizing data commitments is re-structured to include a new branch for Orchard Actions. The orchard_digest branch is the only new addition to the tree; transparent_digest, and sprout_digest sapling_digest are as in ZIP 244:

+

The tree of hashes defined by ZIP 244 7 for authorizing data commitments is re-structured to include a new branch for Orchard Actions. The orchard_digest branch is the only new addition to the tree; transparent_digest, and sprout_digest sapling_digest are as in ZIP 244:

auth_digest
 ├── transparent_scripts_digest
 ├── sprout_auth_digest
 ├── sapling_auth_digest
 └── orchard_auth_digest
auth_digest
-

The tree of hashes defined by ZIP 244 6 for authorizing data commitments is re-structured to include a new branch for Orchard authorizing data. The orchard_auth_digest branch is the only new addition to the tree; transparent_auth_digest, sprout_auth_digest, and sapling_auth_digest are as in ZIP 244:

+

The tree of hashes defined by ZIP 244 7 for authorizing data commitments is re-structured to include a new branch for Orchard authorizing data. The orchard_auth_digest branch is the only new addition to the tree; transparent_auth_digest, sprout_auth_digest, and sapling_auth_digest are as in ZIP 244:

A.1: transparent_scripts_digest (32-byte hash output)
 A.2: sprout_auth_digest         (32-byte hash output)
 A.3: sapling_auth_digest        (32-byte hash output)
@@ -518,6 +487,70 @@ A.4c: bindingSigOrchard        (field encoding bytes)
+

Alternatives

+

The original version of ZIP-225 included Sprout-related fields nJoinSplit, vJoinSplit, joinSplitPubKey, and joinSplitSig in the V5 transaction format. The Electric Coin Company and Zcash Foundation teams have elected to remove these fields from the V5 transaction format as part of the continuing process of deprecation of the Sprout shielded pool. As a consequence of these fields being removed:

+
* This effectively prohibits migration transactions that would directly move funds from
+
+

System Message: ERROR/3 (zip-0225.rst line 432)

+

Unexpected indentation.

+
+
+

the Sprout pool to the Orchard pool. Sprout -> Transparent and Sprout -> Sapling migration transactions will still be supported when using the V4 transaction format.

+
+

Removing these fields reduces the complexity of the NU5 upgrade in the following ways:

+
* V5 parsing and serialization code does not need to take these fields into account.
+* ZIP 244 [#zip_0244]_ transaction identifier, signature hash, and authorizing
+
+

System Message: ERROR/3 (zip-0225.rst line 439)

+

Unexpected indentation.

+
+
+

data commitment computations are simplified by excluding consideration of these fields.

+
+

Removal of these fields means that that in the future, removing the support for the V4 transaction format will also effectively end support for Sprout transactions on the Zcash network, though it might be possible to restore limited support for migration via a future ZIP 222 6 extension or by other means not yet determined.

+

The original definitions for the transaction fields that have been removed are:

+
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
+
+

System Message: ERROR/3 (zip-0225.rst line 450)

+

Inconsistent literal block quoting.

+
+
Sprout Transaction Fields |
+
+

System Message: WARNING/2 (zip-0225.rst line 451)

+

Line block ends without a blank line.

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
variesnJoinSplitcompactSizeThe number of JoinSplit descriptions in vJoinSplit.
1698 * nJoinSplitvJoinSplitJSDescriptionGroth16[nJoinSplit]A sequence of JoinSplit descrptions using Groth16 proofs, encoded per §7.2 ‘JoinSplit Description Encoding and Consensus’.
32joinSplitPubKeybyte[32]An encoding of a JoinSplitSig public validating key.
64joinSplitSigbyte[64]A signature on a prefix of the transaction encoding, to be verfied using joinSplitPubKey as specified in §4.11 ‘Non-malleability (Sprout)’.
+
    +
  • The joinSplitPubKey and joinSplitSig fields were specified to be present if and only if nJoinSplit > 0.
  • +
+

Reference implementation

TBD

@@ -562,10 +595,18 @@ A.4c: bindingSigOrchard (field encoding bytes) - +
+ + + +
6ZIP 222: Transparent Zcash Extensions
+ + + + @@ -573,7 +614,7 @@ A.4c: bindingSigOrchard (field encoding bytes)
7 ZIP 244: Transaction Identifier Non-Malleability
- +
78 ZIP 307: Light Client Protocol for Payment Detection