Zcash in Simplified Technical English

This page is the Simplified Technical English version of ZIP 245. The source ZIP is the normative text. Read the writing rules to understand the marked words.

ZIP 245: Transaction Identifier Digests & Signature Validation for Transparent Zcash Extensions

ZIP: 245
Title: Transaction Identifier Digests & Signature Validation for Transparent Zcash Extensions
Owners: Kris Nuttycombe <kris@nutty.land>
        Daira-Emma Hopwood <daira@jacaranda.org>
Status: Draft
Category: Consensus
Created: 2021-01-13
License: MIT
Discussions-To: <https://github.com/zcash/zips/issues/384>

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.

In this document, these terms have the same meanings as in ZIP 200 [zip-0200]:

Abstract

This ZIP contains changes to two algorithms of ZIP 244 [zip-0244]: the transaction identifier digest algorithm and the signature digest algorithm. These changes are for the inclusion of transparent Zcash extensions (TZEs). The definition of TZEs is in ZIP 222 [zip-0222].

Specification

TxId Digest

In this ZIP, the tree of hashes of ZIP 244 [zip-0244] has a different structure. The tree includes a new branch for TZE hashes. The tze_digest branch is the only new branch in the tree. These branches are the same as in ZIP 244:

  • header_digest
  • transparent_digest
  • sprout_digest
  • sapling_digest

This is the tree:

txid_digest
├── header_digest
├── transparent_digest
├── tze_digest
│   ├── tzein_digest
│   └── tzeout_digest
├── sprout_digest
└── sapling_digest

txid_digest

The top hash of the txid_digest tree is different from the ZIP 244 structure. In this ZIP, the top hash is a BLAKE2b-256 hash of these values:

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

The personalization field of this hash is the same as in ZIP 244.

2: tze_digest

This digest is a BLAKE2b-256 hash of these values:

T.2a: tzein_digest  (32-byte hash)
T.2b: tzeout_digest (32-byte hash)

The value of the personalization field of this hash is:

"ZTxIdTZE____Hash" (4 underscore characters)
2a: tzein_digest

This digest is a BLAKE2b-256 hash of all the TZE inputs of the transaction. The hash does not include witness data. For each TZE input, these values are appended to this hash:

2a.i:  extension_id (CompactSize field encoding)
2a.ii: mode         (CompactSize field encoding)

The value of the personalization field of this hash is:

"ZTxIdTZEIns_Hash" (1 underscore character)
2a: tzeout_digest

This digest is a BLAKE2b-256 hash of the field encoding of all the TZE outputs of the transaction.

The value of the personalization field of this hash is:

"ZTxIdTzeOutsHash"

Signature Digest

ZIP 244 [zip-0244] contains an algorithm for the creation of the signature digest. In this ZIP, the algorithm is changed to include a new branch for TZE hashes. The tze_digest branch is the only new branch in the tree. These branches are the same as in ZIP 244:

  • header_digest
  • transparent_digest
  • sprout_digest
  • sapling_digest

This is the tree:

signature_digest
├── header_digest
├── transparent_digest
├── tze_digest
│   ├── tzein_digest
│   └── tzeout_digest
├── sprout_digest
└── sapling_digest

signature_digest

This digest is a BLAKE2b-256 hash of these values:

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

The value of the personalization field of this hash is:

"ZcashTxHash_" || CONSENSUS_BRANCH_ID

ZcashTxHash_ has 1 underscore character.

This value must have the same personalization as the top hash of the digest tree for the transaction identifier. With the same personalization, it is possible to sign the transaction identifier if there are no transparent inputs.

S.3: tze_digest

This digest is a BLAKE2b-256 hash of these values of the TZE input that is signed:

S.3a: prevout_digest (field encoding bytes)
S.3b: extension_id   (CompactSize field encoding)
S.3c: mode           (CompactSize field encoding)
S.3d: payload        (arbitrary bytes)
S.3e: value          (8-byte little endian value of the output spent by this input)

The value of the personalization field of this hash is:

"Zcash__TzeInHash" (2 underscore characters)

Authorizing Data Commitment

ZIP 244 [zip-0244] also contains a tree of hashes for authorizing data commitments. In this ZIP, this tree has a different structure. The tree includes a new branch for TZE hashes. The tze_witnesses_digest branch is the only new branch in the tree. These branches are the same as in ZIP 244:

  • transparent_scripts_digest
  • sprout_auth_digest
  • sapling_auth_digest

This is the tree:

auth_digest
├── transparent_scripts_digest
├── tze_witnesses_digest
├── sprout_auth_digest
└── sapling_auth_digest

auth_digest

The top hash of the auth_digest tree is different from the ZIP 244 structure. In this ZIP, the top hash is a BLAKE2b-256 hash of these values:

A.1: transparent_scripts_digest (32-byte hash output)
A.2: tze_witnesses_digest       (32-byte hash output)
A.3: sprout_auth_digest         (32-byte hash output)
A.4: sapling_auth_digest        (32-byte hash output)

The personalization field of this hash is the same as in ZIP 244.

2: tze_witnesses_digest

This digest is a BLAKE2b-256 hash of the field encoding of the witness payload data for each TZE input of the transaction.

The value of the personalization field of this hash is:

"ZTxAuthTZE__Hash" (2 underscore characters)

Reference implementation

Source errata

The source has this typo. This page has the repaired form.

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"
[zip-0200]
ZIP 200: Network Upgrade Mechanism
[zip-0222]
ZIP 222: Transparent Zcash Extensions
[zip-0244]
ZIP 244: Transaction Identifier Non-Malleability