This section states the compact block as an abstract message format: the records of a block and of a transaction, the compact outputs, spends and Actions and the fields they omit, the compact variant of trial decryption with the soundness of accepting a plaintext that no tag authenticates, and the placement of notes in the note commitment trees from per-block tree sizes. The service that delivers compact blocks is the subject of “The light-client service” (§5).
A compact block carries only the data of a block that a wallet needs to detect payments to its addresses, to detect spends of its notes and to maintain the witnesses of its notes (ZIP 307, “Compact Stream Format”); for the transparent pool it carries, on request, the data needed to detect spends of the wallet’s transparent coins.
ZIP 307, “Compact Stream Format”, “Output Compression” and “Spend Compression”, specifies the compact format for the Sapling pool only: a compact block of height, block hash and transactions, and a compact transaction of index, transaction identifier, spends and outputs. It names neither the Orchard pool nor the Ironwood pool, nor per-block tree sizes, nor transparent data. ZIP 318 and ZIP 326 address light wallets and specify no compact format. The remainder of the format below (the parent hash of a block, the tree sizes, the compact Actions of both Orchard-protocol pools, the transparent part and pool selection) is designed but unspecified (Definition 1.1). For the compact Actions, the rationale of ZIP 218, “Rationale: Compact sync bandwidth per action”, takes the compact form of the Actions of both pools to be one message of the format served by light-client servers, with the fields and the 148 -byte payload of Definition 4.5; a rationale is not normative, so the classification stands. The volume states the format as an abstract message format, not as a serialisation, and states no field number, field width or encoded size. The status of each ZIP cited is that of Table 1.
A compact block of height h is a tuple
| CB = (h, hash, prevHash, hdr, vtx, S) |
where
hash and prevHash are the 32 -byte hashes of the block and of its parent block (protocol specification, §“Block Header Encoding and Consensus”);
hdr is either the encoded block header or empty; the abstract format does not guarantee that it is present;
Each S pool is an integer in [0, 2 32] , where 2 32 is
the leaf capacity of a tree of depth
A compact transaction is a tuple
| ctx = (i, txid, SSp, SOut, A Orchard, A Ironwood, T) |
where
txid is the 32 -byte transaction identifier in protocol byte order, the form in which it is computed, not the byte-reversed form used for display (Ironwood Guide, §“Transaction digests and signatures”, Definition “Transaction identifier”; protocol specification, §“Transaction Identifiers”);
SSp and SOut are the sequences of compact Sapling spends and compact Sapling outputs, and A Orchard and A Ironwood the sequences of compact Actions of the Orchard pool and of the Ironwood pool (Definition 4.5), each in the order of the transaction’s descriptions, on which note positions depend (§4.4);
T is an optional transparent part (O in, O out) : O in is the sequence of outpoints (txid ′, n) spent by the transaction’s transparent inputs, in input order, and O out the sequence of pairs (value, script) of its transparent outputs, in output order, with value in zatoshi.
The coinbase transaction of a block is its first transaction and the one
whose single transparent input has a null previous outpoint (protocol
specification, §“Coinbase Transactions”); it spends no outpoint, its
O in is empty, and it is recognised by
Let
For every shielded pool in P the restriction keeps every commitment of that pool in its order, since an omitted compact transaction has no component of the pool. The per-pool counts and offsets of Definition 4.11 are therefore the same on a restricted block as on the unrestricted one.
Let C enc be the note ciphertext of a Sapling output or of an Action: 580 bytes, the encryption of the 564 -byte note plaintext followed by the 16 -byte tag. Its split at the offsets 52 and 564 is that of the Ironwood Guide, §“Transaction digests and signatures”, Definition “Transaction identifier”.
A compact Sapling spend is the 32 -byte nullifier nf of a Spend description.
A compact Sapling output is the triple
A compact Action, of the Orchard pool and of the Ironwood pool
alike, is the tuple
Parts (a) and (b) are specified (ZIP 307, “Output Compression” and “Spend Compression”); part (c) is designed but unspecified (Definition 1.1). The fields are those of the protocol specification, §“Spend Description Encoding and Consensus”, §“Output Description Encoding and Consensus” and §“Action Description Encoding and Consensus”. Only payload sizes are stated; the size of any serialisation lies outside the abstract format.
The nullifier nf of a compact Action has two roles. It detects a spend of the note that the Action consumes, and it is the element ρ of the note that the Action creates (Ironwood Guide, §“Nullifier chaining”, Construction “Chaining rule”), an input of esk , ψ and rcm and hence of the commitment that acceptance recomputes (Definition 4.9). A compact Action without nf therefore cannot be accepted.
A compact block omits the memo
Let CB be a compact block of height h , and let a wallet hold incoming viewing keys and the nullifiers of its notes.
Receipt detection, that is compact decryption and acceptance of an
output (§4.3), is a function of the key, of h ,
and of the record
Spend detection is a function of the fields nf of SSp , A Orchard and A Ironwood .
Note placement is a function of the order of the commitments in vtx and of S (§4.4).
No field omitted by the compact block enters (i) to (iii).
(i) Trial decryption and acceptance read the ephemeral key, the ciphertext prefix that encrypts the lead byte, diversifier, value and note seed, the commitment, the height through the admissible lead bytes, and, for an Action, nf as ρ (Ironwood Guide, §“Trial decryption and note acceptance”, Constructions “Trial decryption” and “Acceptance of an Ironwood-pool output”; ZIP 307, “Scanning for relevant transactions” for Sapling); the memo and the tag enter only the full decryption. (ii) A spend of a note is detected by membership of its nullifier among the published ones (ZIP 307, “Detecting spends”). (iii) The chain appends each pool’s commitments in block, transaction and description order to the least unused leaf (Ironwood Guide, §“The Merkle hash and the tree”, Definition “Note commitment tree”; protocol specification, §“Note Commitment Trees”), so positions follow from that order and a tree size. □
The omitted fields serve the verification of the chain, which the client delegates to the server; that delegation and its assumption are stated in “Architecture and authority” (§5.1).
Trial decryption and acceptance of full outputs are those of the Ironwood Guide, §“Trial decryption and note acceptance” (Constructions “Trial decryption” and “Acceptance of an Ironwood-pool output”), cited and not re-derived. This subsection states the compact variant.
The compact note plaintext is the tuple
| leadByte ‖ LEBS2OSP 88 (d) ‖ I2LEOSP 64 (v) ∥ rseed, |
of
Input: an incoming viewing key ivk of the pool’s protocol and a compact
output or compact Action with fields ephemeralKey and
Compute
Compute
Compute
Return np c parsed as a compact note plaintext (Definition 4.7).
The tag is never checked. The result is a candidate, not an accepted note (ZIP 307, “Scanning for relevant transactions”).
Let
| allowedLeadBytes pool (h) := { { 0x01 } if h < H C, { 0x01, 0x02 } if H C ≤ h < H C + ZIP212GracePeriod, { 0x02 } otherwise, if pool ≠ Ironwood, { 0x03 } otherwise |
(protocol specification, §“Note Plaintexts and Memo Fields”), so that an Orchard-pool note has lead byte 0x02 and an Ironwood-pool note 0x03 . The wallet accepts np c if and only if every check passes:
with
for every lead byte other than 0x01 , the field ephemeralKey equals the encoding of [esk] g d , with esk re-derived from rseed , and from ρ for either Orchard-protocol pool.
The accepted note is
Check (iii) is a step of the specification’s decryption procedure and of ZIP 307, not an addition (ZIP 212, “Changes to the process of receiving Sapling or Orchard notes”). For an Ironwood-pool note it is made directly after the computation of g d , in the order of ZIP 2005. Without it a sender could agree the key with one address of a recipient while naming the diversifier of another, and link the two addresses by observing acceptance (Ironwood Guide, §“Trial decryption and note acceptance”, Remark “Role of check (iii)”; ZIP 212, “Motivation”). A Sapling note with lead byte 0x01 , created under the rules before ZIP 212, skips check (iii), since its esk is not derivable from rseed .
For a note n the commitment input is the pair of committed values
and trapdoor from which check (ii) computes its commitment:
((g d, pk d, v), rcm) for Sapling and ((g d, pk d, v, ρ, ψ), rcm) for either Orchard-protocol pool. An address of ivk is a
pair (d, [ivk] DiversifyHash (d)) with
Let cm ∗ be the commitment, cmu or cmx , that a compact output or compact Action carries.
Every note n accepted by Definition 4.9 is an opening of cm ∗ . For every efficient sender, which chooses ephemeralKey , C enc and the keys under which they are formed, the probability that the wallet accepts n while the sender outputs a note n ′ whose commitment input differs from that of n and whose commitment extracts to cm ∗ is negligible, under the binding of the pool’s note commitment scheme. The tag of the AEAD gives no integrity against the sender, who holds K , so its omission loses none.
For an output honestly formed for a note n ′ whose address is not an address of ivk , the probability that ivk accepts a candidate is negligible under the same assumption.
Whether cm ∗ is the commitment of an output of the best chain is not a property of decryption; it is settled under the assumption of “Architecture and authority” (§5.1).
(a) Check (ii) recomputes the commitment of n deterministically from its
commitment input and compares it with cm ∗ , whatever the
ciphertext and whichever key decrypted it, so n opens cm ∗ .
Consider the algorithm that generates the wallet’s key, runs the sender and
the compact decryption and acceptance, and outputs the commitment inputs of
n and n ′ . When the event of (a) occurs it outputs two distinct
commitment inputs whose commitments extract to the same
(b) Let n be accepted. By check (ii) its address is
(d, [ivk] g d) with
For each shielded pool, every note commitment of a block, not only those of the wallet’s notes, is appended to the wallet’s copy of that pool’s note commitment tree in block order, transaction order and description order: cmx of each Action of the pool and cmu of each Sapling output (ZIP 307, “Creating and updating note witnesses”; Ironwood Guide, §“The Merkle hash and the tree”, Definition “Note commitment tree”; protocol specification, §“Note Commitment Trees”). The leaf of each accepted note is marked for witness retention. The part of the tree a wallet must retain is fixed in “Commitment-tree synchronisation” (§7).
Let pool be a shielded pool, b a block height with compact block CB , and n pool (b) the number of commitments of pool in CB . The start size of b is
| S start pool (b) := { S end pool (b − 1) if the wallet knows it, 0 otherwise, if b lies below the activation of pool, S end pool (b) − n pool (b) otherwise, |
the wallet knowing
| position (o) := S start pool (b) + off (ctx) + j, |
where off (ctx) is the number of commitments of pool in the compact transactions of b before ctx . Positions are per pool. A block scanned out of order thus places its notes from its own compact block. Note positions are designed but unspecified (Definition 1.1).
For a pool outside the pool set P of the query that returned b , the count n pool (b) is not served, and neither position nor check is defined.
The position of a note is the leaf index of its commitment (Ironwood
Guide, §“The Merkle hash and the tree”, Definition “Note commitment tree”,
item 1). Every spend needs it
for the authentication path. A Sapling nullifier depends on it, through
Let the wallet reject a block b unless, for each shielded pool of the pool set P of the query that returned b ,
| S end pool (b) ≥ n pool (b) and S start pool (b) + n pool (b) = S end pool (b) . |
If every reported size is the true size, no block is rejected, and every position of Definition 4.11 is the leaf index of the commitment in the pool’s tree.
A reported S end pool (b) that is inconsistent
with the block’s own commitment count, or with the known end size of
A block with
A size that is false but consistent with both conditions is not detected; its exclusion is clause (a) of the server assumption of “Architecture and authority” (§5.1).
(a) The chain appends the commitments of a pool in block, transaction and
description order, each to the least unused index (Ironwood Guide,
§“The Merkle hash and the tree”, Definition “Note commitment tree”). The
true start size of b is thus the true end size of
Comparison of the running position with S end pool (b)
identifies the last commitment of pool in b , at position