This section fixes the heights and the set of notes from which a wallet builds a transaction. It states the confirmation policy of ZIP 315; the target height and the anchor height, with the lemma that ties the anchor depth to the trusted confirmation depth; the expiry rule of ZIP 203 and the expiry height a wallet sets; the record a wallet keeps of the transactions it creates and the notes those transactions lock; and the spendability categories of ZIP 315, with the spendable set defined from the wallet’s state.
An output mined in a block of the best chain leaves the chain when a reorganisation replaces that block (Ironwood Guide, §“Anchors”, Definition “Reorganisation”), so a wallet spends an output only once it has a number of confirmations fixed by a policy. The rules of this subsection are those of ZIP 315 and are specified (Definition 1.1); the status of ZIP 315 is that of Table 1.
A confirmation policy is a triple of integers , the trusted and the untrusted confirmation depth, and a flag that permits zero-confirmation shielding. Confirmations are those of the Consensus Guide, §“Work, and the best chain”, Definition “Confirmations”: at a tip of height , an output mined in the block of height of the best chain has confirmations, its own block being the first; an output of a transaction that no block of the best chain contains has . ZIP 315 RECOMMENDS the depths and (“Trusted and untrusted TXOs”) and permits, without recommending, (“Transparent UTXOs”, MAY); a wallet SHOULD have a policy that it communicates to the user in a clear form (“Trusted and untrusted TXOs”).
A TXO is an output, transparent coin or shielded note, of a transaction of the best chain or of a mempool visible to the wallet (ZIP 315, “Terminology”). A TXO received by the wallet is trusted if it is an output of a transaction created by the wallet itself, which a wallet SHOULD treat as trusted, or of an external transaction that the user has marked trusted, a marking that a wallet MAY offer; every other received TXO is untrusted (ZIP 315, “Trusted and untrusted TXOs”; ZIP 315, “Prompt accessibility of funds”). A trusted TXO requires confirmations and an untrusted TXO . The output of a shielding transaction is not trusted by virtue of its internal receiver (ZIP 315, “Transparent UTXOs”); its depth rule is stated below.
The rationale of the default depths is ZIP 315’s and is cited, not derived (ZIP 315, “Rationale for the given numbers of confirmations”): the trusted depth is because reorganisations are anecdotally shorter than three blocks, and the two depths differ because the value of a trusted TXO is recoverable after a rollback, the wallet re-creating its transaction, whereas an untrusted TXO may need the sender to pay again. The modelled double-spend risk of a given count is that of the Consensus Guide, §“Waiting for confirmations” and §“Wallet confirmation policy”: three confirmations give an attacker with of the hash rate a success probability of , and ten about . A confirmation count bounds the modelled double-spend probability only for a stated attacker share of the hash rate and a tolerated probability (Consensus Guide, §“Wallet confirmation policy”); it is not a guarantee.
Confirmation counts are in blocks, not in time. At the -second target spacing (ZIP 218, “Block target spacing”; Consensus Guide, §“Zcash time: 25-second blocks”), blocks are s and blocks are s. ZIP 218 does not argue for reducing confirmation counts (ZIP 218, “Motivation”) and keeps the anchor depth at blocks (ZIP 218, “Anchor selection depth”). Neither an equal count nor an equal elapsed time establishes an equal risk, whose model is that of the Consensus Guide.
Two kinds of transaction enter the rules below; both are constructed in “TEX transfers and shielding transactions” (§11.3). A shielding transaction spends transparent UTXOs of the wallet and pays their value, less the fee, to an internal shielded receiver of the spending account, with no other recipient. An ephemeral UTXO is the transparent output that the first transaction of a transfer to a TEX address creates and its second transaction spends (ZIP 320, “Design considerations for Senders”; ZIP 315, “Trusted and untrusted TXOs”).
The following rules are specified. Floor: wallets SHOULD NOT permit the spending of TXOs with fewer than confirmations, except (i) transparent UTXOs spent in shielding transactions and (ii) ephemeral UTXOs of a ZIP 320 transfer, whose second transaction spends an output that may be unmined (ZIP 315, “Trusted and untrusted TXOs”). Zero-confirmation shielding: wallets MAY spend received transparent UTXOs in wallet-internal shielding transactions with zero confirmations (ZIP 315, “Transparent UTXOs”); the flag of Definition 9.1 records whether the wallet does. Shielding outputs: a shielded output of a wallet-internal shielding transaction meets its depth requirement if and only if every transparent UTXO that the transaction spent has at least confirmations and the shielding transaction has at least (ZIP 315, “Shielded TXOs”). With the greatest mining height of the spent UTXOs and the tip, the first condition is .
ZIP 315 states the rule for shielding outputs twice, and the two statements differ. The paragraph “Shielded TXOs” requires confirmations of the source UTXOs; the paragraph “Transparent UTXOs” requires confirmations of the transaction that produced them. Both require confirmations of the shielding transaction. Let the sources be mined at greatest height and the shielding transaction at with . At the policy , the first reading is met at every tip
and the second at every tip ; the two agree for . Indeed, a block at height has confirmations at tip (Definition 9.1), and
The rule stated above is the first reading, the one inside ZIP 315’s definition of a confirmed-spendable TXO. Which reading the ZIP intends is an open problem (Definition 1.1).
Let be the height of the tip of the wallet’s view of the chain, the height returned by (Definition 5.10). The target height of a transaction built at that view is , the height of the first block that could include it. Every height-dependent rule of construction is fixed by : the consensus branch, the fee rule and the expiry height are those of a block of height , and confirmation counts are taken at the tip .
Let be a confirmation policy (Definition 9.1) and a target height. The anchor height of a transaction with target height is
a function of and the policy alone. One anchor height serves every anchor that the transaction carries, including that of an Orchard-protocol bundle whose Actions spend no note. For a pool , the anchor of the transaction’s bundle of is the root of ’s note commitment tree in the final treestate of the block at height (Ironwood Guide, §“Anchors”, Definition “Treestate and anchor”), and the authentication path of every note that the transaction spends from is computed to that root (Ironwood Guide, §“Authentication paths”). Since , the block at height precedes the block at height , as the consensus anchor rules require (Ironwood Guide, §“Anchors”; protocol specification, §“Action Transfers and their Descriptions” and §“Spend Transfers, Output Transfers, and their Descriptions”). A transaction therefore carries, for each pool it touches, its own anchor and authentication paths, the Orchard pool and the Ironwood pool of the Orchard protocol separately.
Let be the tip, and . For a note mined at height of the best chain, the following are equivalent:
the note’s commitment is a leaf of the tree rooted by the anchor of its pool at ;
;
the note has at least confirmations at .
The anchor depth thus equals the trusted confirmation depth: a note with exactly confirmations lies in the block at height . At the anchor height is , and a note with at least confirmations is mined at a height at most .
The final treestate of the block at height holds exactly the commitments appended in the blocks at heights (Ironwood Guide, §“Anchors”, Definition “Treestate and anchor” and Remark “Old anchors”), so (i) and (ii) are equivalent. By Definition 9.1 the note has confirmations, and if and only if , so (ii) and (iii) are equivalent. The instances follow with , , and if and only if . □
The rule for the anchor is specified: a wallet SHOULD choose an anchor a number of blocks back from the head of the chain equal to the trusted confirmation depth, the ZIP’s instance being the final treestate of the block at height when the current block is at height (ZIP 315, “Anchor selection”). ZIP 218 recommends that the depth stay blocks at the -second spacing, s (ZIP 218, “Anchor selection depth”). The rule is a recommendation to the builder, not a consensus rule: the anchor rules admit the final treestate of any earlier block.
ZIP 315 counts the anchor depth back from the head of the chain, and ZIP 218, “Anchor selection depth”, reads it as the tip, so that a -block reorganisation is needed to remove the anchor; the Ironwood Guide, §“Anchors”, Remark “Recommended anchor depth”, follows that reading, which puts the anchor at with confirmations. This volume’s convention counts from the block being built, , one block shallower, which gives Lemma 9.6: the anchor block has exactly confirmations. Both satisfy the consensus anchor rules.
The anchor depth is whatever the trust of the notes spent. The eligibility of each note is decided by its own depth (Definition 9.2), so an untrusted note spent at depth is proved against the anchor at depth , whose tree contains it by Lemma 9.6. ZIP 315 gives three reasons for the rule, specified and cited (ZIP 315, “Rationale for anchor selection”): a rollback past the anchor block invalidates the transaction, whose revealed nullifiers then link it to any later transaction spending the same notes; too deep an anchor keeps recently received notes from being spent; and a fixed depth, rather than one depending on whether the notes spent are trusted, does not reveal their trust. The anchor is published data (Ironwood Guide, §“Anchors”, Remark “Anchor choice as public data”).
Every Orchard-protocol bundle with at least one Action carries an anchor, which must refer to the final treestate of an earlier block in its pool, whether or not any Action spends a note of nonzero value (protocol specification, §“Action Transfers and their Descriptions”; consensus rule). Giving such a bundle the anchor at makes it indistinguishable by its anchor from a bundle that spends (Ironwood Guide, §“Anchors”, Remark “Anchor choice as public data”).
Every transaction of version at least carries a field , a block height and never a timestamp; for a non-coinbase transaction, (consensus rule). A non-coinbase transaction with is expired at height if and only if , and it MUST NOT be mined at a height greater than (consensus rule), so the block at height is the last that may include it; the value disables expiry (protocol specification, §“Transaction Encoding and Consensus”; ZIP 203, “Specification”). Coinbase transactions, which a wallet does not create, are outside the definition.
Let be a non-coinbase transaction with expiry height , and the tip. The expiry rule permits in the block at the target height if and only if or ; when , it permits in no block of height greater than . Inclusion requires the other consensus rules as well; the lemma concerns expiry only.
By Definition 9.8, the rule permits at height if and only if or , and if and only if . The second claim is the rule itself. □
A wallet sets , where is the target height (Definition 9.4) and is an expiry delta chosen by the wallet. Reading ZIP 203’s “current height” as the target height is designed but unspecified (Definition 1.1). Every later rule that depends on the delta, the locking of notes (§9.4) and the polling and re-sending of transactions (§13), uses the actually chosen.
ZIP 315 specifies (SHOULD) that a wallet create transactions using the default expiration height of ZIP 203, which it gives as blocks from the current height (ZIP 315, “Expiration height”). ZIP 218 changes the default of node implementations that create transactions to blocks (SHOULD), to keep an expiry of about minutes, and keeps an explicitly configured delta (ZIP 218, “Default expiry delta”); ZIP 315 is not updated for the -second spacing. At that spacing, ZIP 315’s SHOULD therefore has two readings: the literal blocks, about s, and the ZIP 203 default as ZIP 218 changes it, blocks, about s. Which one a wallet uses is an open problem (Definition 1.1). Either time is an estimate, since block intervals vary, and not a guaranteed period of validity.
The choice of delta has a privacy consequence, specified. ZIP 315 lists the expiry height, with the anchor position, among the data that reveal to which height the creator was synchronised and some of its policy (ZIP 315, “Kinds of information leakage”), and it specifies a common default (ZIP 315, “Expiration height”). An expiry delta other than the common one therefore distinguishes its creator, as a fee other than the conventional fee does (§10).
The expiry height is fixed by the transaction identifier: is effecting data, an input of the header digest (ZIP 244, “T.1: header_digest”), so by Lemma 13.1(ii) a party matches a transaction, and rejects it once expired, by its identifier alone.
When a transaction expires, nodes remove it from their mempools together with every transaction that depends on it (ZIP 203, “Specification”). This is node policy layered on the consensus rule, which constrains only the contents of blocks.
The transaction record of a wallet holds, for each transaction that the wallet creates:
the identifier and the encoding of , once the wallet holds it;
its fee, its target height and its expiry height ;
the set of its inputs: the notes it spends in each shielded pool and the transparent outpoints it spends;
its mined height, or while it is unmined;
the earliest height at which it was observed: initially for a transaction the wallet builds, and the height of the block in which it was first seen mined for a record entered from compact blocks;
the latest tip at which the server reported it unmined.
A record entered without the encoding of the transaction has unknown; such is the record of a transaction learnt from compact blocks, whose compact transaction carries no expiry height (Definition 4.3), and later unmined by a rollback (Definition 7.23). The transitions of the record are those of “Status tracking and terminal states” (§13.2). The record is information that the wallet retains, not a storage layout.
Fix an expiry delta , a parameter of the definition, whose default at the -second spacing is the open problem of §9.3. At target height , a note is locked if and only if some recorded transaction that spends it satisfies one of:
is mined, necessarily at a height below ;
;
;
is unknown and .
A locked note is excluded from selection.
Let be a recorded transaction with known expiry height that spends a note. At target height , the conditions of Definition 9.12 hold for if and only if is mined or the expiry rule permits at (Lemma 9.9). Hence, for a note that no mined recorded transaction spends and whose recorded spending transactions all have known expiry heights, being unlocked is the clause of ZIP 315 that the TXO is not committed to be spent in another unexpired transaction created by the wallet (ZIP 315, “Categories of TXOs according to spendability”); a mined spend, which condition (a) locks, makes the note spent, and ZIP 315’s clause that the TXO is unspent excludes it; and an unmined with releases its inputs, as far as is concerned, at every target height .
For known , condition (d) of Definition 9.12 is void. By Lemma 9.9, the expiry rule permits at if and only if or , which are conditions (b) and (c); with condition (a) this gives the first claim. By Definition 9.8, is unexpired at if and only if or , so for an unmined the conditions hold exactly when is an unexpired transaction of the wallet that spends the note, and a note is unlocked exactly when no such transaction exists, which is ZIP 315’s clause (ZIP 203, “Specification”). For and unmined, each of (a) to (d) fails. □
Condition (d) of Definition 9.12 assumes that was created with the delta at a target height at most , so that . If , or its creator used a larger delta with , the note is released from while can still be mined (for , or at every if ), and a re-spend conflicts with the late mining of . If its creator used a smaller delta, the note stays locked longer than necessary. Either misjudgement lasts until the wallet sees mined, or obtains its encoding and hence by the query (Definition 5.10).
The watched nullifiers are the set of the tracked sets of Definition 6.7: the nullifiers of the wallet’s detected notes not marked spent. A lock (Definition 9.12) removes a note from selection and never removes its nullifier from . A nullifier leaves only when Construction 6.8 marks its note spent, that is, when a transaction revealing it is mined, whatever that transaction’s expiry height, included; or when a rollback unmines the creating transaction of a Sapling note, whose nullifier is then discarded until a later scan derives it again (Definition 7.23(iii)). A rollback that clears the spent mark returns the nullifier to .
The mining of any transaction that spends a note of the wallet is therefore detected by scanning through , independently of status queries (Ironwood Guide, §“Nullifier sets”). A rule that removed from the nullifiers spent by transactions with , combined with status polling that ends at the first report of an unmined transaction, would leave such a transaction, when it has no output to the wallet, mined and never observed as mined: no block would reveal a watched nullifier, and no note of the wallet would be created by it.
Relative to a chain and a wallet state (ZIP 315, “Categories of TXOs according to spendability”):
a TXO is known-spendable if and only if (1) it is unspent at the wallet’s view of the tip and that view is reasonably up to date, (2) it is not committed to be spent in another unexpired transaction created by the wallet (Proposition 9.13), and (3) the wallet can effect the spend, by holding its spending key or by mediating interaction with a hardware device or another offline signing protocol;
a shielded TXO is confirmed-spendable if and only if it is known-spendable, the wallet can construct its witness (Theorem 7.14), and either it is not an output of a wallet-internal shielding transaction and has confirmations if trusted, if untrusted (Definition 9.2), or it is such an output and meets the rule for shielding outputs of §9.1 (ZIP 315, “Shielded TXOs”);
a known-spendable TXO that is not confirmed-spendable is unconfirmed-spendable;
a TXO is watch-only if and only if the wallet holds its full viewing key, or for a transparent TXO its address, but not its spending key;
a transparent UTXO is confirmed-shieldable if and only if it is known-spendable and the wallet can construct a correct redeem script for it (ZIP 315, “Transparent UTXOs”).
The following rule is specified: a wallet MUST NOT attempt to spend, in a user-initiated transaction, a TXO that is not confirmed-spendable. ZIP 315 notes that the confirmed-spendable balance is until the wallet has synchronised at least the nullifier set to the tip (ZIP 315, “Reporting of balances”).
Let be the tip, , (Definition 9.5), and the fully scanned height (Definition 6.11). A shielded note of pool , mined at height , is spendable at if and only if:
the note is in the note state (Definition 6.7), it is not marked spent, and ;
it is not locked at (Definition 9.12);
the wallet holds the spending key of the account of , or mediates a signer for it;
The spendable set at is the set of notes spendable at , each with its value, pool, position and authentication path at .
Condition (d) implies in each case, since and the shielding transaction has at least confirmations, so lies in the tree of the anchor by Lemma 9.6. The spendable set at is the set of confirmed-spendable shielded notes of Definition 9.16, with ZIP 315’s “reasonably up-to-date” instantiated as ; the instantiation is designed but unspecified (Definition 1.1). Clause (a) is clause (1) of known-spendability: with , every block up to the tip has been scanned, and a note is marked spent exactly when its nullifier is revealed on the best chain at or below (Theorem 6.14, item (ii)). Clause (b) is clause (2) by Proposition 9.13, with condition (d) of Definition 9.12 in place of the expiry height where that is unknown; clause (c) is clause (3); clauses (e) and (d) are the witness and depth clauses of confirmed-spendability. The spendable set is the input state of construction (“Transaction construction”, §11): it is reconstructed by synchronisation (§6, Theorem 6.14) and taken as given by fee computation and note selection.
A policy that admits a note once the block extent of its own subtree is scanned up to (Definition 7.16), before every range up to is scanned, departs from clause (a) of Definition 9.17 and from ZIP 315, whose clause on an up-to-date view carries an open TODO in the ZIP. The departure fails as follows. A note whose spend was mined in a range not yet scanned passes the policy; a transaction that spends it again is rejected by the consensus rule that a nullifier must not repeat (Ironwood Guide, §“Nullifier sets”), and its repeated nullifier links it to the earlier spend for every party that sees it. The departure is designed but unspecified (Definition 1.1).