The Zcash ArboretumThe Complete Arboretum PDF

6 The chain-history commitment

This section states the commitment that Zcash block headers carry, each rule cited to the ZIP or the protocol specification section that fixes it, and each object before its first use: the upgrade epochs over which it ranges, the node vector of its Merkle mountain range, the hashing of the tree and its root commitment, the authorising-data root and the block commitment hash of ZIP 244 that wraps the root from NU5, the header consensus rules, and the range of blocks to which each header commits.

6.1 The deployed chain commitment

ZIP 221 (Final), “FlyClient - Consensus-Layer Changes”, changes the semantics of the block header and the consensus rules from Heartwood. The 32-byte header field that held the root of the Sapling note commitment tree instead commits to the root of a Merkle mountain range (Definition 3.1; ZIP 221, “Terminology”: a binary hash tree that admits appends of new leaves “without changing the value of existing nodes”) whose nodes carry aggregated metadata. Its leaves are the blocks from the last activation height below the committing block up to the parent of that block: the epoch tree of Definition 6.2. ZIP 221 thus deploys the invariant of Construction 5.1 restricted to one upgrade epoch, the heights from one activation height up to the next (Definition 6.1), and not from the genesis block. The tree and its node fields 1 to 14 are ZIP 221’s; fields 15 to 17 are ZIP 258’s (Draft, in force from NU6.3 by Definition 1.2); and from NU5 the root is committed as the first input of the block commitment hash, a personalised hash of the root together with the block’s authorising-data root (ZIP 244; “The block commitment hash”, §6.6). Seven node fields serve reasoning about difficulty without matching the node of Definition 5.6 (ePrint 2019/226, Definition 7) field for field (Remark 6.4). Each term of this paragraph carries here only its defining clause; its definition is in the subsection named.

The purpose of the commitment, after ZIP 221, “Motivation”, is to let a light client verify, with a number of headers logarithmic rather than linear in the chain length and correctly with high probability, the validity of a chain received from a full node, the inclusion of a block in it, and metadata of any block or range of blocks; the commitment also admits subtree proofs, which check only blocks later than the most recently verified one. Transaction inclusion within a block is left to ZIP 307 (Draft). No claim of this paragraph is proved in this section; the protocol that would realise it is that of “The FlyClient protocol” (§5), and its relation to the deployed commitment is classified in “The deployment boundary” (§7).

6.2 Upgrade epochs and epoch trees

Definition 6.1 (Upgrade epoch).

Let 0=A0<A1<A2<⋯ be the distinct activation heights of the network upgrades of a chain (ZIP 200, “Activation mechanism”), height 0 counted as an activation height (ZIP 221, “Specification”). The named upgrades and their order are those of Definition 1.1; the list of activation heights includes those of upgrades that definition does not name. The upgrade epoch beginning at Ai is the interval of heights [Ai,Ai+1), unbounded for the last activation height. For i≥1 its blocks are validated under one consensus rule set and one consensus branch ID, the 32-bit identifier of the last upgrade that activates at Ai (ZIP 200, “Specification”; Ironwood Guide, §“The transaction format”). The upgrade epoch is distinct, by name and by object, from the retarget epoch of Definition 4.5; the word “epoch” is not used alone. The Heartwood activation height is written AH, and BAH is the Heartwood activation block.

Definition 6.2 (Epoch tree).

For a block height η>0, the preceding activation height α⁢(η) is the largest activation height Ai<η, the “preceding network upgrade height” of ZIP 221, “Specification”; α⁢(0) is undefined. For η>AH the epoch tree 𝒯η is the Merkle mountain range MnL under the left fold BagL (Definition 3.5), bagging nodes included as internal nodes, with the

n=η−α⁢(η)≥1

leaves Bα⁢(η),…,Bη−1 in height order: leaf j is Bα⁢(η)+j−1. Since α⁢(η) is the last activation height below η, all its leaves lie in the one upgrade epoch beginning at α⁢(η). Its node contents are fixed in “The node vector” (§6.3) and its hashing in “The epoch tree and its root commitment” (§6.4). No epoch tree is defined for η≤AH.

Which header commits to 𝒯η is not part of Definition 6.2: it is Definition 6.22 in “The header consensus rules” (§6.7), and its consequences for the committed ranges are stated in “The committed range” (§6.8).

6.3 The node vector

Definition 6.3 (Node vector).

The epoch tree 𝒯η is an instance of Definition 3.19 under BagL. Every node v of it, leaf, internal node, bagging node or root, carries one node vector of fields, serialised canonically by the map ser of Definition 6.5; that serialisation is used whenever a parent commitment is formed. The fields are numbered as in ZIP 221, “Tree Node specification”. For a block Bη′ with header hdr′, the leaf map sets both members of each earliest/latest pair from Bη′ itself:

  1. (1)

    field 𝗁𝖺𝗌𝗁𝖲𝗎𝖻𝗍𝗋𝖾𝖾𝖢𝗈𝗆𝗆𝗂𝗍𝗆𝖾𝗇𝗍 is 𝖡𝗅𝗈𝖼𝗄𝖧𝖺𝗌𝗁⁢(hdr′) (Definition 2.3), in internal byte order and unpersonalised;

  2. (2), (3)

    fields 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖳𝗂𝗆𝖾𝗌𝗍𝖺𝗆𝗉 and 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖳𝗂𝗆𝖾𝗌𝗍𝖺𝗆𝗉 are the field 𝗇𝖳𝗂𝗆𝖾 of hdr′;

  3. (4), (5)

    fields 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖳𝖺𝗋𝗀𝖾𝗍𝖡𝗂𝗍𝗌 and 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖳𝖺𝗋𝗀𝖾𝗍𝖡𝗂𝗍𝗌 are the field 𝗇𝖡𝗂𝗍𝗌 of hdr′ (the semantics of 𝗇𝖳𝗂𝗆𝖾 and 𝗇𝖡𝗂𝗍𝗌: Consensus Guide, §“Difficulty in motion”);

  4. (6), (7)

    fields 𝗁𝖺𝗌𝗁𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖱𝗈𝗈𝗍 and 𝗁𝖺𝗌𝗁𝖫𝖺𝗍𝖾𝗌𝗍𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖱𝗈𝗈𝗍 are 𝖫𝖤𝖡𝖲𝟤𝖮𝖲𝖯256⁢(𝗋𝗍) for 𝗋𝗍 the root of the Sapling note commitment tree of the final Sapling treestate of Bη′ (protocol specification, §“Block Header Encoding and Consensus”), an opaque 32-byte value in this volume;

  5. (8)

    field 𝗇𝖲𝗎𝖻𝖳𝗋𝖾𝖾𝖳𝗈𝗍𝖺𝗅𝖶𝗈𝗋𝗄 is the work ⌊2256/(𝖳𝗈𝖳𝖺𝗋𝗀𝖾𝗍⁢(𝗇𝖡𝗂𝗍𝗌)+1)⌋ of Bη′ (Consensus Guide, §“Work, and the best chain”, Definition “Work of a block”);

  6. (9), (10)

    fields 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍 and 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍 are the height η′;

  7. (11)

    field 𝗇𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖳𝗑𝖢𝗈𝗎𝗇𝗍 is the number of transactions of Bη′ in which 𝗏𝖲𝗉𝖾𝗇𝖽𝗌𝖲𝖺𝗉𝗅𝗂𝗇𝗀 or 𝗏𝖮𝗎𝗍𝗉𝗎𝗍𝗌𝖲𝖺𝗉𝗅𝗂𝗇𝗀 is non-empty;

  8. (12), (13)

    fields 𝗁𝖺𝗌𝗁𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖮𝗋𝖼𝗁𝖺𝗋𝖽𝖱𝗈𝗈𝗍 and 𝗁𝖺𝗌𝗁𝖫𝖺𝗍𝖾𝗌𝗍𝖮𝗋𝖼𝗁𝖺𝗋𝖽𝖱𝗈𝗈𝗍 are the Orchard-pool anchor of Bη′, the root of the Orchard pool’s note commitment tree in the final treestate of Bη′ (Ironwood Guide, §“Anchors”, Definition “Treestate and anchor”);

  9. (14)

    field 𝗇𝖮𝗋𝖼𝗁𝖺𝗋𝖽𝖳𝗑𝖢𝗈𝗎𝗇𝗍 is the number of transactions of Bη′ in which 𝗏𝖠𝖼𝗍𝗂𝗈𝗇𝗌𝖮𝗋𝖼𝗁𝖺𝗋𝖽 is non-empty (Ironwood Guide, §“The transaction format”);

  10. (15)–(17)

    fields 𝗁𝖺𝗌𝗁𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽𝖱𝗈𝗈𝗍, 𝗁𝖺𝗌𝗁𝖫𝖺𝗍𝖾𝗌𝗍𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽𝖱𝗈𝗈𝗍 and 𝗇𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽𝖳𝗑𝖢𝗈𝗎𝗇𝗍 are the Ironwood-pool anchor of Bη′ and the number of its transactions in which 𝗏𝖠𝖼𝗍𝗂𝗈𝗇𝗌𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽 is non-empty, computed as fields 12 to 14.

The parent rule: an internal node with left child ℓ and right child r takes each earliest field (2, 4, 6, 9, 12, 15) from ℓ and each latest field (3, 5, 7, 10, 13, 16) from r; it sums the additive fields, field 8 modulo 2256 and the per-pool counts 11, 14 and 17 in ℤ; and it sets field 1 by Construction 6.10, the personalised hash of ser⁢(ℓ)∥ser⁢(r). Fields 12 to 14 are ZIP 221’s own, added at NU5 (ZIP 252). Fields 15 to 17 are ZIP 258’s, “Changes to ZIP 221” (Draft), whose rules apply from NU6.3 activation (Definition 1.2).

For field 8, ZIP 221, “Tree Node specification”, states that computations modulo 2256 are fine because cumulative chain work is assumed to be at most 2256, an aggregate effort of 2256 or more being infeasible; under that assumption, with the total below 2256, the field of a node is the integer sum of the work of its leaves (Lemma 3.21(2)). Table 2 summarises the definition.

Field Type Leaf value for Bη′ Internal node ZIP
1 𝗁𝖺𝗌𝗁𝖲𝗎𝖻𝗍𝗋𝖾𝖾𝖢𝗈𝗆𝗆𝗂𝗍𝗆𝖾𝗇𝗍 char[32] 𝖡𝗅𝗈𝖼𝗄𝖧𝖺𝗌𝗁⁢(hdr′) hash 221
2 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖳𝗂𝗆𝖾𝗌𝗍𝖺𝗆𝗉 uint32 𝗇𝖳𝗂𝗆𝖾 inherit left 221
3 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖳𝗂𝗆𝖾𝗌𝗍𝖺𝗆𝗉 uint32 𝗇𝖳𝗂𝗆𝖾 inherit right 221
4 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖳𝖺𝗋𝗀𝖾𝗍𝖡𝗂𝗍𝗌 uint32 𝗇𝖡𝗂𝗍𝗌 inherit left 221
5 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖳𝖺𝗋𝗀𝖾𝗍𝖡𝗂𝗍𝗌 uint32 𝗇𝖡𝗂𝗍𝗌 inherit right 221
6 𝗁𝖺𝗌𝗁𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖱𝗈𝗈𝗍 char[32] final Sapling root inherit left 221
7 𝗁𝖺𝗌𝗁𝖫𝖺𝗍𝖾𝗌𝗍𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖱𝗈𝗈𝗍 char[32] final Sapling root inherit right 221
8 𝗇𝖲𝗎𝖻𝖳𝗋𝖾𝖾𝖳𝗈𝗍𝖺𝗅𝖶𝗈𝗋𝗄 uint256 work of the block sum mod 2256 221
9 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍 CompactSize height η′ inherit left 221
10 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍 CompactSize height η′ inherit right 221
11 𝗇𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖳𝗑𝖢𝗈𝗎𝗇𝗍 CompactSize transactions with Sapling spends or outputs sum 221
12 𝗁𝖺𝗌𝗁𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖮𝗋𝖼𝗁𝖺𝗋𝖽𝖱𝗈𝗈𝗍 char[32] Orchard-pool anchor inherit left 221
13 𝗁𝖺𝗌𝗁𝖫𝖺𝗍𝖾𝗌𝗍𝖮𝗋𝖼𝗁𝖺𝗋𝖽𝖱𝗈𝗈𝗍 char[32] Orchard-pool anchor inherit right 221
14 𝗇𝖮𝗋𝖼𝗁𝖺𝗋𝖽𝖳𝗑𝖢𝗈𝗎𝗇𝗍 CompactSize transactions with Orchard-pool Actions sum 221
15 𝗁𝖺𝗌𝗁𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽𝖱𝗈𝗈𝗍 char[32] Ironwood-pool anchor inherit left 258
16 𝗁𝖺𝗌𝗁𝖫𝖺𝗍𝖾𝗌𝗍𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽𝖱𝗈𝗈𝗍 char[32] Ironwood-pool anchor inherit right 258
17 𝗇𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽𝖳𝗑𝖢𝗈𝗎𝗇𝗍 CompactSize transactions with Ironwood-pool Actions sum 258
Table 2: The fields of the node vector of Definition 6.3: serialised type, value at the leaf for the block Bη′ with header hdr′, rule at an internal node (“hash” is Construction 6.10), and source: ZIP 221, “Tree Node specification”, for fields 1 to 14, and ZIP 258, “Changes to ZIP 221”, for fields 15 to 17.
Remark 6.4 (The FlyClient fields).

ZIP 221, “FlyClient Requirements and Recommendations”, designates seven fields, 2 to 5 and 8 to 10, which “enable FlyClient in the variable-difficulty model” by letting a light client reason about the application of the difficulty adjustment over a range of blocks. They serve the purpose of Definition 5.6 without matching it field for field. The leaf count of a node, the field 𝗇 of the difficulty MMR, is 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍−𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍+1 (Lemma 6.6). The field 𝗐 of the difficulty MMR sums difficulty levels (Definition 4.2), whereas 𝗇𝖲𝗎𝖻𝖳𝗋𝖾𝖾𝖳𝗈𝗍𝖺𝗅𝖶𝗈𝗋𝗄 sums work, a different normalisation. The field 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖳𝖺𝗋𝗀𝖾𝗍𝖡𝗂𝗍𝗌 is a compact target, ordered inversely to 𝖣𝗌𝗍𝖺𝗋𝗍. No field carries the elapsed time 𝗍; the timestamps of the first and last block stand in its place. No field carries 𝖣𝗇𝖾𝗑𝗍: the next target of a Zcash block is a function of an averaging window of preceding blocks (Consensus Guide, §“Difficulty in motion”), which the aggregates of a node do not determine.

Fields 6, 7 and 11 to 14 are ZIP 221’s “Non-FlyClient Commitments”, chosen “primarily to improve light client security guarantees”, with no counterpart in ePrint 2019/226. Field 1 “forms the structure of the commitment tree” (ZIP 221, “Tree nodes”), and fields 15 to 17 are the ZIP 258 counterparts for the Ironwood pool. The earliest roots let a client check the treestate transitions over a range of blocks without recomputing the roots from genesis. ZIP 221, “Non-FlyClient Commitments”, states that 𝗁𝖺𝗌𝗁𝖫𝖺𝗍𝖾𝗌𝗍𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖱𝗈𝗈𝗍 serves the purpose of the former header field 𝗁𝖺𝗌𝗁𝖥𝗂𝗇𝖺𝗅𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖱𝗈𝗈𝗍, one block delayed (Proposition 6.23). The per-pool counts follow the rule of the same section that a new shielded pool adds a count of its transactions, applied at NU5 (fields 12 to 14) and at NU6.3 (fields 15 to 17, ZIP 258).

Definition 6.5 (Field vector by upgrade epoch).

The fields are encoded as follows: a char[32] field as its 32 bytes; a uint32 or uint256 field little-endian, as 𝖨𝟤𝖫𝖤𝖮𝖲𝖯32 or 𝖨𝟤𝖫𝖤𝖮𝖲𝖯256 (protocol specification, §“Integers, Bit Sequences, and Endianness”); a height or count as its CompactSize encoding in minimal form (Definition 2.2); and each pool-root field as 𝖫𝖤𝖡𝖲𝟤𝖮𝖲𝖯256 of the root, as the specification encodes the Orchard anchor (protocol specification, §“Transaction Encoding and Consensus”). For a node v, ser⁢(v) is the concatenation of the encodings of its fields in field order. The field vector of an upgrade epoch is:

  1. 1.

    fields 1 to 11 in the Heartwood and Canopy upgrade epochs;

  2. 2.

    fields 1 to 14 in the NU5, NU6, NU6.1 and NU6.2 upgrade epochs;

  3. 3.

    fields 1 to 17 in the NU6.3 and NU7 upgrade epochs.

The vectors are named by their fields. ZIP 221, “Tree Node specification”, omits fields 12 to 14 “before NU5 activation”, and ZIP 258, “Changes to ZIP 221”, omits fields 15 to 17 “before NU6.3 activation”; neither says whether the height of a leaf’s block or that of the committing block governs, and the two differ only for the tree committed by an activation block. Adopted reading, resolving that ambiguity: every node of 𝒯η uses the field vector of the upgrade epoch beginning at α⁢(η), the upgrade epoch of its leaves.

The reading is adopted for the following reason. Under the other reading the tree 𝒯A committed by BA, at an activation height A that adds fields, would serialise every node of the previous upgrade epoch with the added fields; every internal node would change value, and 𝒯A would not be an append of 𝒯A−1, contrary to the property by which ZIP 221, “Terminology”, defines a Merkle mountain range. The ZIP’s pseudocode, which takes a leaf’s Orchard fields from the leaf’s own block and serialises them only when present, is consistent with the reading. Two consequences rest on it: 𝒯A uses the previous upgrade epoch’s vector, and 𝒯A+1 is the first tree with the new one; under the other reading 𝒯A would carry the new vector. For NU7, no ZIP among the sources of NU7 consensus changes listed in ZIP 259 (Draft), “NU7 consensus changes”, amends ZIP 221 or ZIP 244, so the nodes of the trees of the NU7 upgrade epoch carry fields 1 to 17 under either reading.

The fixed-width fields occupy 144, 208 and 272 bytes in the three vectors, and the three, four and five CompactSize fields 1 to 9 bytes each, so a serialised node has 147 to 171, 212 to 244 and 277 to 317 bytes, the ranges that ZIP 221 and ZIP 258 state. A toy chain computed by script illustrates the reading, with an activation block that commits a tree of the previous vector and the next block the first to commit a tree of the new one; it establishes nothing.

Lemma 6.6 (Leaf count and shape).

Every node v of 𝒯η, bagging nodes included, spans a run of consecutive leaves Bη1,…,Bη2 with v.𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍=η1 and v.𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍=η2, so its leaf count is 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍−𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍+1. The node v roots a perfect subtree of 𝒯η if and only if that count is a power of two. In particular a leaf is the only kind of node with count 1.

Proof.

By induction on the parent rule of Definition 6.3. A leaf has both heights equal to its block’s. An internal node inherits 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍 from its left child and 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍 from its right child, and in a range under BagL the run of the left child immediately precedes that of the right child, the heights of the leaves of 𝒯η being consecutive by Definition 6.2. A perfect subtree of altitude a spans 2a leaves (Definition 3.1), and every node inside a peak roots a perfect subtree. A bagging node of the left fold spans the peaks P1,…,Pi for some i≥2 (Definition 3.5), whose sizes are distinct powers of two, set bits of n (Definition 3.4); a sum of two or more distinct powers of two has at least two set bits and is not a power of two. An internal node spans at least two leaves. A script checks the statement for 1≤n≤1,024. □

Lemma 6.7 (Leaves and header linkage).

For α⁢(η)≤η′≤η−1, field 1 of the leaf of 𝒯η for Bη′ equals the field 𝗁𝖺𝗌𝗁𝖯𝗋𝖾𝗏𝖡𝗅𝗈𝖼𝗄 of the header of Bη′+1, which for η′=η−1 is the committing block Bη. Consequently a received header is matched to its leaf by computing its block hash and comparing it with field 1, and the leaves add no hashing beyond the block hashes.

Proof.

By Definition 6.3, field 1 of the leaf is 𝖡𝗅𝗈𝖼𝗄𝖧𝖺𝗌𝗁 of the header of Bη′ in internal byte order; by Definition 2.3, the field 𝗁𝖺𝗌𝗁𝖯𝗋𝖾𝗏𝖡𝗅𝗈𝖼𝗄 of Bη′+1 is that same hash. ZIP 221, “Tree Node specification”, states the identity. □

Remark 6.8 (Non-monotone timestamps).

Consensus bounds the field 𝗇𝖳𝗂𝗆𝖾 of a block below, strictly above the median of the timestamps of the preceding eleven blocks, and above, by that median plus 90 minutes (protocol specification, §“Block Header Encoding and Consensus”; Consensus Guide, §“Difficulty in motion”). It orders two timestamps only at a distance: the median-time-past never decreases and rises by at least one second every eleven blocks, so a block at least 11⋅5,400=59,400 heights after another has the strictly later timestamp. By the same count, 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖳𝗂𝗆𝖾𝗌𝗍𝖺𝗆𝗉≥𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖳𝗂𝗆𝖾𝗌𝗍𝖺𝗆𝗉 holds for every node with 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍−𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍≥11⋅5,399=59,389, and for a leaf, whose two timestamps are equal; for smaller spans this argument gives no order. ZIP 221, “Tree Node specification”, says that the reverse order “may occur within subtrees smaller than 𝖯𝗈𝖶𝖬𝖾𝖽𝗂𝖺𝗇𝖡𝗅𝗈𝖼𝗄𝖲𝗉𝖺𝗇 blocks”; this is an example, not a bound. A block whose timestamp lies up to 90 minutes ahead of the median exceeds the timestamps of the later blocks whose timestamps track real time, until real time passes it, and 90 minutes spans more than eleven target spacings (protocol specification, §“Constants”; from NU7, ZIP 218).

6.4 The epoch tree and its root commitment

The tree is defined from the prose of ZIP 221, “Background”, “Specification”, “Tree Node specification” and “Block header semantics and consensus rules”, with ZIP 258, “Changes to ZIP 221”. That prose is ambiguous at two points, both at an activation block: the field vector, settled by the adopted reading of Definition 6.5, and the branch ID of the personalisation, settled by Definition 6.9. The pseudocode of ZIP 221 is cited only as corroboration of the two readings; it carries editorial defects, among them in the serialisation of the Orchard fields, none of which bears on either reading.

Definition 6.9 (Branch ID of a tree).

ZIP 221, “Tree Node specification”, states that the personalisation encodes “the consensus branch ID for the epoch of the block containing the commitment”, and continues: “Which is to say, each node in the tree commits to the consensus branch that produced it.” The two sentences agree at every η>AH that is not an activation height, since Bη and the leaves of 𝒯η then lie in one upgrade epoch. At an activation height A>AH the first names the upgrade epoch beginning at A and the second the upgrade epoch of the leaves Bα⁢(A),…,BA−1. At AH no epoch tree is defined (Definition 6.2). Adopted reading, resolving an ambiguity of specified text: the branch ID b⁢(𝒯) of an epoch tree 𝒯 is the consensus branch ID of the upgrade epoch whose blocks are the leaves of 𝒯, and every internal node and the root commitment of 𝒯 are hashed under it.

The reading is adopted for three reasons. (1) “Which is to say” introduces the second sentence as a restatement of the first, and it is the sentence that assigns a branch ID to each node. (2) Under the first reading the tree committed by BA would not be an append of the tree committed by BA−1, every internal node changing value, contrary to the property by which ZIP 221, “Terminology”, defines a Merkle mountain range (the reason for which Definition 6.5 adopts the leaves’ vector); and the whole previous upgrade epoch would be rehashed in one block, the cost that ZIP 221, “Header Format Change”, calls impractical and avoids by a special case at the Heartwood activation block and at no later one. (3) The pseudocode of ZIP 221 hashes each parent under the branch ID of its left child and the root commitment under that of the root node, each leaf carrying the branch ID of its own block. Every later statement about the tree committed by an activation block rests on this reading and cites it; under the first reading each holds with the branch ID of the new upgrade epoch in place of b⁢(𝒯A).

Construction 6.10 (Hashing of the epoch tree).

Let 𝗁⁢(P,x) be BLAKE2b-256 with the 16-byte personalisation P on input x (Ironwood Guide, §“Transaction digests and signatures”; Crypto Guide, §“Domain separation and personalisation”), and let β be the 4-byte little-endian encoding of b⁢(𝒯η). The personalisation is the 12 ASCII bytes ZcashHistory followed by β, 16 bytes in all. The tree 𝒯η is the range MnL whose nodes are node vectors (Definition 6.3) under the field vector of Definition 6.5. Its bagging nodes, which join the two leftmost remaining peaks until one remains,

(⋯⁢((P1∥P2)∥P3)⁢⋯)∥Pd,

are ordinary internal nodes, and a single peak is the root node. For an internal node with children ℓ and r, field 1 is

𝗁(ZcashHistory∥β,ser(ℓ)∥ser(r)),

over the children’s full serialisations; its other fields follow the parent rule of Definition 6.3. The branch ID is not a node field: it enters only through the personalisation, and whoever recomputes a node hash supplies b⁢(𝒯η) by Definition 6.9, the upgrade epoch being fixed by the node’s heights. For the Heartwood branch ID 𝟶⁢𝚡⁢𝙵⁢𝟻⁢𝙱⁢𝟿𝟸𝟹𝟶⁢𝙱 the last four bytes of the personalisation are 𝟶⁢𝙱⁢ 23⁢𝙱𝟿⁢𝙵𝟻.

Upgrade epoch Branch ID Fixed by Bytes 13 to 16 of the personalisation Fields
Heartwood 𝟶⁢𝚡⁢𝙵⁢𝟻⁢𝙱⁢𝟿𝟸𝟹𝟶⁢𝙱 ZIP 250 𝟶⁢𝙱⁢ 23⁢𝙱𝟿⁢𝙵𝟻 1 to 11
Canopy 𝟶⁢𝚡⁢𝙴⁢𝟿⁢𝙵⁢𝙵⁢𝟽𝟻⁢𝙰⁢𝟼 ZIP 251 𝙰𝟼⁢ 75⁢𝙵𝙵⁢𝙴𝟿 1 to 11
NU5 𝟶⁢𝚡⁢𝙲⁢𝟸⁢𝙳⁢𝟼⁢𝙳⁢𝟶⁢𝙱⁢𝟺 ZIP 252 𝙱𝟺⁢𝙳𝟶⁢𝙳𝟼⁢𝙲𝟸 1 to 14
NU6 𝟶⁢𝚡⁢𝙲⁢𝟾⁢𝙴⁢𝟽𝟷𝟶𝟻𝟻 ZIP 253 55 10⁢𝙴𝟽⁢𝙲𝟾 1 to 14
NU6.1 𝟶⁢𝚡⁢𝟺⁢𝙳⁢𝙴⁢𝙲⁢𝟺⁢𝙳⁢𝙵⁢𝟶 ZIP 255 𝙵𝟶⁢ 4⁢𝙳⁢𝙴𝙲⁢ 4⁢𝙳 1 to 14
NU6.2 𝟶⁢𝚡⁢𝟻𝟺𝟹𝟽⁢𝙵⁢𝟹𝟹𝟶 ZIP 257 𝟹𝟶⁢𝙵𝟹⁢ 37 54 1 to 14
NU6.3 𝟶⁢𝚡⁢𝟹𝟽⁢𝙰⁢𝟻𝟷𝟼𝟻⁢𝙱 ZIP 258 (Draft) 𝟻⁢𝙱⁢ 16⁢𝙰𝟻⁢ 37 1 to 17
NU7 𝟶⁢𝚡⁢𝟽𝟽𝟷𝟿𝟶⁢𝙰⁢𝙳⁢𝟿 ZIP 259 (Draft) 𝙳𝟿⁢ 0⁢𝙰⁢ 19 77 1 to 17
Table 3: The branch IDs entering the personalisation ZcashHistory∥β of Construction 6.10: one row per upgrade epoch that bears an epoch tree, each tree hashed under its own personalisation, with the ZIP that fixes the branch ID (ZIP 258, “NU6.3 deployment”; ZIP 259, “NU7 network constants”), the little-endian bytes β and the field vector of Definition 6.5.
Definition 6.11 (Chain-history root).

For η>AH the chain-history root of 𝒯η is

𝗁𝖺𝗌𝗁𝖢𝗁𝖺𝗂𝗇𝖧𝗂𝗌𝗍𝗈𝗋𝗒𝖱𝗈𝗈𝗍⁢(𝒯η):=𝗁⁢(ZcashHistory∥β,ser⁢(root node of ⁢𝒯η)),

with β encoding b⁢(𝒯η) (ZIP 221, “Tree Node specification”). It is not field 1 of the root node: the committed value covers the root’s aggregates, namely the total work modulo 2256, the first and last timestamps, target bits and heights, the boundary pool roots and the per-pool counts. When α⁢(η)=η−1 the tree has one leaf, which is its root node, and the value is defined there too. ZIP 258, “Changes to ZIP 221”, leaves the definition unchanged apart from the added fields.

Definition 6.12 (History input of a block).

For η≥AH the history input of Bη is

𝗁𝖺𝗌𝗁𝖫𝗂𝗀𝗁𝗍𝖢𝗅𝗂𝖾𝗇𝗍𝖱𝗈𝗈𝗍⁢(η):={the string of 32 zero bytesif ⁢η=AH,𝗁𝖺𝗌𝗁𝖢𝗁𝖺𝗂𝗇𝖧𝗂𝗌𝗍𝗈𝗋𝗒𝖱𝗈𝗈𝗍⁢(𝒯η)if ⁢η>AH.

The value at AH is the sentinel that ZIP 221, “Block header semantics and consensus rules”, requires in the Heartwood activation block and states “MUST NOT be interpreted as a root hash”. The history input is a total function of the height from AH on, and it is the value that ZIP 244, “Block Header Changes”, names “hashLightClientRoot (as described in ZIP 221)”.

Proposition 6.13 (Binding of the chain-history root).

Let 𝒯 and 𝒯′ be epoch trees hashed under one branch ID b. If 𝗁𝖺𝗌𝗁𝖢𝗁𝖺𝗂𝗇𝖧𝗂𝗌𝗍𝗈𝗋𝗒𝖱𝗈𝗈𝗍⁢(𝒯)=𝗁𝖺𝗌𝗁𝖢𝗁𝖺𝗂𝗇𝖧𝗂𝗌𝗍𝗈𝗋𝗒𝖱𝗈𝗈𝗍⁢(𝒯′), then either 𝒯 and 𝒯′ agree on every field of every node, or a collision of 𝗁⁢(ZcashHistory∥β,⋅) is computed from them efficiently. If in addition SHA-256d is collision resistant, the leaves’ block hashes bind the headers of the leaf blocks.

Proof.

The proposition is the ZIP 221 instance of Lemma 3.20(1), whose hypotheses are checked as follows. Serialisation. The branch ID b fixes one upgrade epoch and hence one field vector for both trees (Table 3; Definitions 6.9 and 6.5). Its field order is fixed, and each field is of fixed width or a minimal CompactSize, whose first byte fixes its length (Definition 2.2). A serialised node therefore parses field by field: ser is injective, and no serialised node is a proper prefix of another, since the two parse to the same fields up to the end of the shorter and the number of fields is fixed; minimality makes ser a function of the node. Root and shape. If the root commitments are equal, then the two root serialisations are equal, or they are distinct inputs with equal images, a collision. Equal root nodes have equal 𝗇𝖤𝖺𝗋𝗅𝗂𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍 and 𝗇𝖫𝖺𝗍𝖾𝗌𝗍𝖧𝖾𝗂𝗀𝗁𝗍, hence equal leaf count n by Lemma 6.6, hence the same shape MnL. The shape fixes which positions are leaves, so no leaf of one tree is compared with an internal node of the other, although the tree carries no layer tags (ZIP 221, “Tree nodes”, identifies leaves by their block range of 1). Extraction. Lemma 3.20(1) then yields a collision at the first level of disagreement. Headers. Field 1 of each leaf is the SHA-256d block hash of its header (Definition 2.3; Crypto Guide, §“The transparent layer’s hashes”); equal leaves with distinct headers are a collision of SHA-256d. □

Proposition 6.14 (Binding of range transaction counts).

Let a node v of 𝒯η be authenticated by an inclusion path (Definition 3.13, in the tuple form of Definition 3.19, siblings as full node vectors) accepted against the chain-history root of the epoch tree of a chain the client trusts. Barring a collision as in Proposition 6.13, v.𝗇𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖳𝗑𝖢𝗈𝗎𝗇𝗍, and where present v.𝗇𝖮𝗋𝖼𝗁𝖺𝗋𝖽𝖳𝗑𝖢𝗈𝗎𝗇𝗍 and v.𝗇𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽𝖳𝗑𝖢𝗈𝗎𝗇𝗍, equal the numbers of transactions in the blocks of the height range of v in which 𝗏𝖲𝗉𝖾𝗇𝖽𝗌𝖲𝖺𝗉𝗅𝗂𝗇𝗀 or 𝗏𝖮𝗎𝗍𝗉𝗎𝗍𝗌𝖲𝖺𝗉𝗅𝗂𝗇𝗀, 𝗏𝖠𝖼𝗍𝗂𝗈𝗇𝗌𝖮𝗋𝖼𝗁𝖺𝗋𝖽 and 𝗏𝖠𝖼𝗍𝗂𝗈𝗇𝗌𝖨𝗋𝗈𝗇𝗐𝗈𝗈𝖽, respectively, are non-empty. Hence a client that obtains the transactions of those blocks, each authenticated against its block’s transaction root, detects the withholding of any such transaction by a count mismatch, and a range whose count is zero contains none and may be skipped; the count does not identify the missing transaction.

Proof.

By Lemma 3.20(2), an accepted path binds the full vector of every node it recomputes and of every sibling it carries, so v is the node of the trusted tree at its position, barring a collision; the serialisation is prefix-free by the proof of Proposition 6.13. In that tree the count fields are consistent, and by the parent rule of Definition 6.3 and Lemma 6.6 the value of each count field of v is its sum over the leaves of v’s height range. The reading as detection of withholding is ZIP 221, “Non-FlyClient Commitments”. □

Proposition 6.15 (Cross-branch separation).

For branch IDs b≠b′ with encodings β≠β′ the personalisations ZcashHistory∥β and ZcashHistory∥β′ differ. Model 𝗁⁢(P,⋅), for each personalisation P, as an independent random oracle with 256-bit output. An adversary making q oracle queries, the queries of the verification of its output included, outputs x,x′ with

𝗁⁢(ZcashHistory∥β,x)=𝗁⁢(ZcashHistory∥β′,x′)

with probability at most q2/2256. Hence no internal-node hash or root commitment computed under b equals one computed under b′, except with that probability. Leaves are unpersonalised block hashes, identical in every branch, and are not separated.

Proof.

The modelling hypothesis is that of the Crypto Guide, §“Domain separation and personalisation”, Proposition “Domain separation yields independent oracles”: distinct tags give independent random oracles. Both values must be answers to queries, one to each oracle; each of the at most q2 pairs of such queries agrees with probability 2−256, and the union bound (Math Guide, §“The union bound and a birthday calculation”) gives the bound. ZIP 221, “Tree nodes”, states the design intent: “valid nodes from one consensus branch cannot be used to make false statements about parallel consensus branches”. □

6.5 The authorising-data root

The header field 𝗁𝖺𝗌𝗁𝖬𝖾𝗋𝗄𝗅𝖾𝖱𝗈𝗈𝗍 (Definition 2.3) is the root of Bitcoin’s SHA-256d transaction Merkle tree over the transaction identifiers of the block (protocol specification, §“Block Header Encoding and Consensus”). The identifier of a version-5 or version-6 transaction excludes its authorising data (ZIP 244; Ironwood Guide, §“Transaction digests and signatures”, Definition “Authorising-data digest; effecting and authorising data”), so for such transactions 𝗁𝖺𝗌𝗁𝖬𝖾𝗋𝗄𝗅𝖾𝖱𝗈𝗈𝗍 does not commit to the authorising data; the identifier of a version-4 transaction covers its whole encoding. The version-4 format is valid until NU7, from which ZIP 2003 (Draft), deployed by ZIP 259 (Draft), makes it invalid.

Construction 6.16 (Authorising-data root).

Let a block have the transactions t1,…,tm, where m≥1 because of the coinbase transaction. Leaf i is the authorising-data commitment of ti: for version 5, the digest 𝖺𝗎𝗍𝗁⁢_⁢𝖽𝗂𝗀𝖾𝗌𝗍 of ZIP 244, “Authorizing Data Commitment”; for version 6, the digest of the Ironwood Guide’s Definition “Authorising-data digest; effecting and authorising data” (ZIP 229 (Draft), “Block Commitments”: 𝗁𝖺𝗌𝗁𝖠𝗎𝗍𝗁𝖣𝖺𝗍𝖺𝖱𝗈𝗈𝗍 takes the version-6 digest “with no further structural change”); and for a transaction of a version before 5, the 32 bytes 𝟶⁢𝚡⁢𝙵⁢𝙵, a placeholder used only in this tree and occurring only in blocks before NU7. The leaves are padded with leaves of 32 zero bytes to 2⌈log2⁡m⌉, and 𝗁𝖺𝗌𝗁𝖠𝗎𝗍𝗁𝖣𝖺𝗍𝖺𝖱𝗈𝗈𝗍 is the root of the binary Merkle tree of height ⌈log2⁡m⌉ over them, each non-leaf node being 𝗁⁢(ZcashAuthDatHash,𝑙𝑒𝑓𝑡∥𝑟𝑖𝑔ℎ𝑡), under a 16-byte personalisation without branch ID. The insertion order MUST equal that of the transaction identifiers in the tree under 𝗁𝖺𝗌𝗁𝖬𝖾𝗋𝗄𝗅𝖾𝖱𝗈𝗈𝗍, so that one path identifies the same transaction in both trees (ZIP 244, “Block Header Changes”).

Proposition 6.17 (Joint binding of the two transaction roots).

Assume, with ZIP 244, “Authorizing Data Commitment”, that the pair of a transaction’s identifier and its authorising-data commitment is binding: distinct transactions with equal pairs form a collision of that pair map. Let two lists of m transactions have equal 𝗁𝖺𝗌𝗁𝖬𝖾𝗋𝗄𝗅𝖾𝖱𝗈𝗈𝗍 and equal 𝗁𝖺𝗌𝗁𝖠𝗎𝗍𝗁𝖣𝖺𝗍𝖺𝖱𝗈𝗈𝗍. Then the lists are equal, or a collision of SHA-256d, of 𝗁⁢(ZcashAuthDatHash,⋅) or of the pair map is computed from them. The binding is claimed for lists of the given length only: the identifier tree is Bitcoin’s transaction Merkle tree and inherits its duplicate-last-node caveat, and the header commits to no transaction count.

Proof.

For fixed m, Bitcoin’s duplication rule and the zero padding of Construction 6.16 are fixed maps of the list, so the path argument of the Crypto Guide, §“Binary Merkle trees”, Proposition “Binding of the root”, applies to each tree: the two lists of identifiers agree, else a collision of SHA-256d is extracted, and the two lists of authorising-data commitments agree, else a collision of 𝗁⁢(ZcashAuthDatHash,⋅). The common insertion order aligns the two leaf sequences, so each position carries equal pairs, and distinct transactions there form a collision of the pair map. ZIP 244, “Authorizing Data Commitment”, states that the pair “constitutes a commitment to all the data of a serialized transaction”; for a transaction of a version before 5 the identifier covers all data and the second member is the constant placeholder. The caveat is the Crypto Guide, §“Layer and domain separation”, Remark “Unbalanced trees, padding, and a deployed failure”. □

6.6 The block commitment hash

In this subsection 032 denotes the string of 32 zero bytes.

Definition 6.18 (Block commitment hash).

For a block Bη at a height in or after the NU5 upgrade epoch, the block commitment hash is

𝗁𝖺𝗌𝗁𝖡𝗅𝗈𝖼𝗄𝖢𝗈𝗆𝗆𝗂𝗍𝗆𝖾𝗇𝗍𝗌⁢(Bη):=𝗁⁢(ZcashBlockCommit,𝗁𝖺𝗌𝗁𝖫𝗂𝗀𝗁𝗍𝖢𝗅𝗂𝖾𝗇𝗍𝖱𝗈𝗈𝗍⁢(η)⁢‖𝗁𝖺𝗌𝗁𝖠𝗎𝗍𝗁𝖣𝖺𝗍𝖺𝖱𝗈𝗈𝗍⁢(Bη)‖⁢ 032),

with 𝗁𝖺𝗌𝗁𝖫𝗂𝗀𝗁𝗍𝖢𝗅𝗂𝖾𝗇𝗍𝖱𝗈𝗈𝗍⁢(η) the history input of Definition 6.12, 𝗁𝖺𝗌𝗁𝖠𝗎𝗍𝗁𝖣𝖺𝗍𝖺𝖱𝗈𝗈𝗍⁢(Bη) the root of Construction 6.16 for Bη, and 032 the terminator (ZIP 244, “Block Header Changes”). The input has 32+32+32=96 bytes, and the 16-byte personalisation carries no branch ID. The history input is a function of the blocks before Bη; the authorising-data root is a function of Bη itself.

Proposition 6.19 (Reopening the block commitment).

From NU5 the chain-history root appears in no header. Let c be the value 𝗁𝖺𝗌𝗁𝖡𝗅𝗈𝖼𝗄𝖢𝗈𝗆𝗆𝗂𝗍𝗆𝖾𝗇𝗍𝗌⁢(Bη) of a block in or after the NU5 upgrade epoch. A verifier given a claimed history input r, or a claimed root node vector from which it computes r=𝗁⁢(ZcashHistory∥β,ser⁢(root)) with β encoding the branch ID of Definition 6.9, and a 32-byte value a, accepts r if and only if

c=𝗁⁢(ZcashBlockCommit,r⁢‖a‖⁢ 032);

only the 32-byte value of 𝗁𝖺𝗌𝗁𝖠𝗎𝗍𝗁𝖣𝖺𝗍𝖺𝖱𝗈𝗈𝗍 is needed, not its tree. Two distinct accepted pairs (r,a)≠(r′,a′) exhibit a collision of 𝗁⁢(ZcashBlockCommit,⋅). Hence an accepted r is the block’s history input except with that collision probability, and an inclusion path in the epoch tree is checked against a header through it.

Proof.

The pair (𝗁𝖺𝗌𝗁𝖫𝗂𝗀𝗁𝗍𝖢𝗅𝗂𝖾𝗇𝗍𝖱𝗈𝗈𝗍⁢(η),𝗁𝖺𝗌𝗁𝖠𝗎𝗍𝗁𝖣𝖺𝗍𝖺𝖱𝗈𝗈𝗍⁢(Bη)) is accepted by Definition 6.18. The input r⁢‖a‖⁢ 032 has fixed length, so distinct pairs give distinct inputs, and two accepted pairs with equal image c are a collision. □

Remark 6.20 (Extension of the block commitment hash).

ZIP 244, “Block Header Changes”, treats the value as “a linked list of hashes terminated by arbitrary data”: a later upgrade may replace the terminator by the hash of a new structure that ends in its own terminator. The same section states two interoperability rules: fully validating nodes MUST always use the entire structure defined by the latest activated protocol version they support, and a third-party server that supports a later protocol version SHOULD provide a value that can be used in place of the all-zero terminator, so that a light client can validate the parts it needs. No upgrade through NU7 replaces the terminator: ZIP 258, “Changes to ZIP 221”, leaves 𝗁𝖺𝗌𝗁𝖡𝗅𝗈𝖼𝗄𝖢𝗈𝗆𝗆𝗂𝗍𝗆𝖾𝗇𝗍𝗌 “unaffected” beyond the added node fields; ZIP 229, “Block Commitments”, changes no structure; and no source of NU7 consensus changes listed in ZIP 259, “NU7 consensus changes”, amends ZIP 244.

6.7 The header consensus rules

Definition 6.21 (The commitment field by upgrade epoch).

The 32-byte header field that follows 𝗁𝖺𝗌𝗁𝖬𝖾𝗋𝗄𝗅𝖾𝖱𝗈𝗈𝗍 (Definition 2.3) is named 𝗁𝖺𝗌𝗁𝖱𝖾𝗌𝖾𝗋𝗏𝖾𝖽 before Sapling, 𝗁𝖺𝗌𝗁𝖥𝗂𝗇𝖺𝗅𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖱𝗈𝗈𝗍 in the Sapling and Blossom upgrade epochs, 𝗁𝖺𝗌𝗁𝖫𝗂𝗀𝗁𝗍𝖢𝗅𝗂𝖾𝗇𝗍𝖱𝗈𝗈𝗍 in the Heartwood and Canopy upgrade epochs, and 𝗁𝖺𝗌𝗁𝖡𝗅𝗈𝖼𝗄𝖢𝗈𝗆𝗆𝗂𝗍𝗆𝖾𝗇𝗍𝗌 from NU5 (protocol specification, §“Block Header Encoding and Consensus”; ZIP 221, “Block header semantics and consensus rules”; ZIP 244, “Block Header Changes”). The header byte format and version are unchanged by each renaming.

Definition 6.22 (Header commitment rule).

For a block Bη the commitment field satisfies the following rules.

  1. (i)

    For η<AH it follows the earlier rules of the protocol specification, §“Block Header Encoding and Consensus”, not restated here: in the Sapling and Blossom upgrade epochs it is 𝖫𝖤𝖡𝖲𝟤𝖮𝖲𝖯256 of the root of the Sapling note commitment tree of the block’s final Sapling treestate.

  2. (ii)

    For AH≤η in the Heartwood or Canopy upgrade epoch it MUST equal the history input 𝗁𝖺𝗌𝗁𝖫𝗂𝗀𝗁𝗍𝖢𝗅𝗂𝖾𝗇𝗍𝖱𝗈𝗈𝗍⁢(η) of Definition 6.12, which supplies the sentinel at AH.

  3. (iii)

    For η in or after the NU5 upgrade epoch, the NU5 activation block included and without sentinel, it MUST equal 𝗁𝖺𝗌𝗁𝖡𝗅𝗈𝖼𝗄𝖢𝗈𝗆𝗆𝗂𝗍𝗆𝖾𝗇𝗍𝗌⁢(Bη) of Definition 6.18.

(ZIP 221, “Block header semantics and consensus rules”; ZIP 244, “Block Header Changes”; protocol specification, §“Block Header Encoding and Consensus”.) The value is undefined for the genesis block, which no case covers.

In the NU5 activation block BANU5, ANU5 the NU5 activation height, the history input is 𝗁𝖺𝗌𝗁𝖢𝗁𝖺𝗂𝗇𝖧𝗂𝗌𝗍𝗈𝗋𝗒𝖱𝗈𝗈𝗍⁢(𝒯ANU5), the root of the completed tree of the Canopy upgrade epoch. It is hashed under the Canopy branch ID 𝟶⁢𝚡⁢𝙴⁢𝟿⁢𝙵⁢𝙵⁢𝟽𝟻⁢𝙰⁢𝟼 (ZIP 251) by the adopted reading of Definition 6.9, the first sentence of ZIP 221 giving the NU5 branch ID instead, and it is built from nodes of fields 1 to 11 by the adopted reading of Definition 6.5. By Definition 6.22 every valid block after the Heartwood activation block commits to the root of its epoch tree: directly in the Heartwood and Canopy upgrade epochs, and from NU5 as the first input of the block commitment hash.

6.8 The committed range

Proposition 6.23 (One-block delay).

For η>AH the tree to which Bη commits (Definition 6.22) has the leaves Bα⁢(η),…,Bη−1. No header commits to a tree that contains its own block, and Bη−1 first enters a committed tree at Bη. Consequently the final Sapling root of a block at a height of at least AH is committed one block later, as the field 𝗁𝖺𝗌𝗁𝖫𝖺𝗍𝖾𝗌𝗍𝖲𝖺𝗉𝗅𝗂𝗇𝗀𝖱𝗈𝗈𝗍 of the root node committed by the next block. ZIP 221, “Non-FlyClient Commitments”, accepts the delay because “using the most recent treestate as a transaction anchor is already unsafe in reorgs”.

Proof.

By Definition 6.2, η lies outside [α⁢(η),η−1]. Since η−1≥AH and α⁢(η) is the largest activation height below η, α⁢(η)≤η−1, so Bη−1 is the last leaf of 𝒯η; it is no leaf of 𝒯η′ for η′≤η−1, whose leaves lie below η′. Then Definition 6.22. The latest-root field of the root node is that of its last leaf, by the parent rule of Definition 6.3. □

Theorem 6.24 (Reset at each activation height).

Let A>AH be an activation height and A′=α⁢(A) the preceding one. Then:

  1. 1.

    BA commits to the complete tree 𝒯A over BA′,…,BA−1, the whole upgrade epoch beginning at A′, hashed under that upgrade epoch’s branch ID b⁢(𝒯A) by the adopted reading of Definition 6.9 and built with that upgrade epoch’s field vector by the adopted reading of Definition 6.5; the commitment field equals 𝗁𝖺𝗌𝗁𝖢𝗁𝖺𝗂𝗇𝖧𝗂𝗌𝗍𝗈𝗋𝗒𝖱𝗈𝗈𝗍⁢(𝒯A) before NU5, and 𝗁𝖺𝗌𝗁𝖡𝗅𝗈𝖼𝗄𝖢𝗈𝗆𝗆𝗂𝗍𝗆𝖾𝗇𝗍𝗌⁢(BA) with it as first input from NU5;

  2. 2.

    BA+1 commits to the single-leaf tree over BA;

  3. 3.

    for A′<η<A, the leaves of 𝒯η are a proper prefix of those of 𝒯A, so every ended upgrade epoch from Heartwood on is committed completely by exactly one header, that of the next activation block;

  4. 4.

    the reset occurs at every upgrade, including those that leave the field vector unchanged (Canopy, NU6, NU6.1, NU6.2 and NU7).

Proof.

By the definition of α, α⁢(A)=A′ and α⁢(A+1)=A. For A′<η<A, α⁢(η)=A′, so 𝒯η has the leaves BA′,…,Bη−1, a proper prefix of those of 𝒯A; only 𝒯A has the full leaf set, and for η>A no tree has the leaf BA′, since α⁢(η)≥A. The commitment fields follow from Definition 6.22. Part (4) holds because α depends on the activation heights alone. A script illustrates (1) to (3) on a toy chain, a one-block upgrade epoch included; it establishes nothing. □

Figure 4 shows the ranges of the theorem.

Refer to caption
Figure 4: Committed ranges on a height axis, one cell per block, with the Heartwood activation height AH and two later activation heights A′<A, consecutive, and A′<η<A. Grey: heights below AH, a leaf of no epoch tree (Corollary 6.25). The Heartwood activation block carries the sentinel of Definition 6.12 and commits no tree. Each bar is the leaf range of the tree to which the header at the arrow’s head commits: Bη commits BA′,…,Bη−1; the activation block BA commits the whole upgrade epoch BA′,…,BA−1 (Theorem 6.24(1)); and BA+1 commits the single leaf BA (Theorem 6.24(2)). No bar reaches below AH.
Corollary 6.25 (No commitment below the Heartwood activation height).

The Heartwood activation block BAH commits to no tree, its history input being the sentinel of Definition 6.12. For η>AH, α⁢(η)≥AH, so no committed tree has a leaf below AH. Below AH the commitment field holds a Sapling root or is reserved (Definition 6.21).

Proof.

The height AH is an activation height below every η>AH, and α⁢(η) is the largest such; then Definition 6.22, item (ii). □

Corollary 6.26 (The NU7 upgrade epoch).

Let ANU7 be the NU7 activation height. The block BANU7 commits, as the first input of its block commitment hash, to the completed tree of the NU6.3 upgrade epoch, hashed under the NU6.3 branch ID 𝟶⁢𝚡⁢𝟹𝟽⁢𝙰⁢𝟻𝟷𝟼𝟻⁢𝙱 by the adopted reading of Definition 6.9. The block BANU7+1 commits to a new tree over BANU7, hashed under the NU7 branch ID 𝟶⁢𝚡⁢𝟽𝟽𝟷𝟿𝟶⁢𝙰⁢𝙳⁢𝟿 (ZIP 259, Draft) with the field vector of Definition 6.5 for the NU7 upgrade epoch.

Proof.

The instance A=ANU7 of Theorem 6.24, NU6.3 being the upgrade that precedes NU7 (Definition 1.1), with the constants of ZIP 259, “NU7 network constants”, and ZIP 258, “NU6.3 deployment”. □