This section states the fee a wallet pays. It fixes the fee as a consensus quantity, defines the conventional fee of ZIP 317 over logical actions and bounds it before signing; it states the padded Action counts on which the fee is computed; and it states the relay, mempool and block-template rules that apply to a transaction paying less.
For a transaction other than a coinbase transaction, the transaction fee is the value remaining in its transparent transaction value pool: the sum of its transparent input values and of the balancing values of its shielded pools, minus the sum of its transparent output values (protocol specification, §“Transactions and Treestates”; Ironwood Guide, Definition “Transparent transaction value pool” and Definition “Balancing value”, in “The balancing value”). Consensus requires it to be non-negative. No transaction field encodes it, and every term of the sum is public, so the fee is public.
A fee rule for a shielded protocol meets the requirements of ZIP 317, “Requirements”: the fee is computable from the public data of the transaction alone, since a fee that depended on private construction data, such as which notes were spent or what change was returned, would disclose that data; it scales linearly with the numbers of inputs and outputs, which makes transaction-rate denial of service costly (ZIP 317, “Motivation” and “Denial of Service”); it neither penalises padding for privacy nor favours any pool; and it lets a small number of inputs of value below the marginal fee be spent. A fee other than the one every wallet pays distinguishes the wallet that chose it: non-standard fees may reveal specific users, wallets or wallet versions (ZIP 317, “Security and Privacy considerations”).
The conventional fee (Definition 10.2) is not a consensus rule. ZIP 317, “Fee calculation”, states that it is not a consensus requirement that fees follow the formula, and that wallets SHOULD create transactions that pay it, to reduce information leakage, unless overridden by the user. It binds through relay and block-template policy only (§10.3). ZIP 259, “NU7 consensus changes”, changes neither the formula nor its parameters.
In what follows, is the least integer and the greatest integer , for real .
Let a transaction of version or version have the following public fields of its final encoding (protocol specification, §“Transaction Encoding and Consensus”; ZIP 229, “Transaction Format”), each a non-negative integer:
and , the byte lengths of the encoded fields and , the concatenations of the encoded transparent inputs and outputs;
, the number of Sprout JoinSplit descriptions;
and , the numbers of Sapling spend and output descriptions;
, the number of Orchard-pool Actions;
, the number of Ironwood-pool Actions, in a version transaction.
With the parameters and , in bytes, the number of logical actions of the transaction is
the sum of the transparent, Sprout, Sapling, Orchard and Ironwood contributions, in that order (ZIP 317, “Fee calculation”, the contributions of Revision and Revision ).
The Sprout contribution is in every valid transaction: transactions of version and version have no JoinSplit field, and transactions of version are invalid under NU7 (ZIP 2003; ZIP 259, “NU7 consensus changes”). The term is kept so that the definition is that of ZIP 317. The two divisors are the maximal encoded sizes of a P2PKH input and output (ZIP 317, “Rationale for the chosen parameters”):
Charging transparent parts by size rather than by count charges a large script in proportion to its size; a 2-of-3 P2SH multisig input, about 70% larger than a P2PKH input, is counted so (same section).
Let zatoshi per logical action and . The conventional fee of a transaction with as in Definition 10.1 is
The parameter values and their rationale are ZIP 317’s (“Rationale for the chosen parameters”).
ZIP 317, “Fee calculation”, defines as the sum of the contributions of the applicable revision, and a contribution defined by a revision is included in every later one (ZIP 317, “Revisions”). Revision defines the transparent, Sprout, Sapling and Orchard contributions. Revision adds the Ironwood contribution : Ironwood-pool Actions have the Action structure of Orchard-pool Actions and are counted identically. Revision adds a contribution for memo bundles (ZIP 231), defined on the transaction format of ZIP 248, which NU7 does not introduce (ZIP 259, “Rationale for no new transaction format”). Definition 10.1 is therefore Revision with the Revision term. The statuses of these ZIPs are those of Table 1.
Every transaction with has conventional fee zatoshi, and no transaction has a smaller conventional fee.
By Definition 10.2, since when , and always. □
A wallet computes the fee before it signs, and the encoded size of a transparent input depends on its signature. The following proposition bounds the fee from the unsigned transaction.
Let a wallet fix, before signing, every field of a transaction except the scripts of its transparent inputs , and assign to each input a bound on its encoded size after signing, as follows:
for a P2PKH input spending a public key with a compressed -byte encoding, such as each of the wallet’s own transparent keys;
otherwise any known to bound the encoded size of the signed input.
Let be the conventional fee computed with replaced by . Then is at least the conventional fee of the signed transaction.
Signatures enter only the scripts of the transparent inputs, so the field and every shielded count of Definition 10.1 are the same in the unsigned and the signed transaction. A DER-encoded signature has at most bytes, so the script of a P2PKH input with a compressed key has at most bytes and the input at most bytes; under clause (ii) the bound holds by hypothesis. The signed is therefore at most . The maps , , the addition of the unchanged remaining contributions, and are each non-decreasing in every argument, so their composition is, and is at least the conventional fee of the signed transaction. □
Hypothesis (i) does not extend to a P2PKH input with an uncompressed -byte key encoding, which has up to bytes and needs under (ii). For an input with no known bound on its signed size, the fee is unknown before signing.
The fields of Definition 10.1 are those of the final encoded transaction: every bundle padded and every change output included (ZIP 317, “Fee calculation”). A wallet therefore prices a transaction by predicting its padded shape (Definition 10.6) and its change before it selects inputs; a fee computed on unpadded counts underpays whenever padding adds a logical action. This rule is ZIP 317’s and is not a consensus rule.
Let a bundle of the Orchard protocol, in the Orchard pool or the Ironwood pool, have real spends and real outputs, and let be its flag value (Ironwood Guide, §“Bundle flags”, Definition “Flag values and expanded receiver”). Its requested Action count is
and its padded Action count is if and otherwise. The counts and of Definition 10.1 are the padded Action counts of the two bundles. A non-empty Sapling bundle with real spends and real outputs has and .
The count is that of the pairing a wallet performs when cross-address transfers are disabled: the note an Action creates has the expanded receiver of the note it consumes, so each real spend occupies an Action with a fabricated zero-valued output at its own receiver, and each real output an Action with a fabricated zero-valued spend at its receiver (ZIP 326, “Fabricated same-address outputs and randomized note ciphertexts”; ZIP 374, “Fabricated same-address outputs (NU6.3)”), respectively. Every Orchard-pool bundle has (Ironwood Guide, “Chain state and pool rules”, rule (i); ZIP 258, “Consensus rules from NU6.3 activation”); an Ironwood-pool bundle may set it to .
The floor and the Sapling padding are a padding policy, designed but unspecified in the sense of Definition 1.1. Their only general ZIP anchor is non-normative: ZIP 317, “Requirements”, notes that standard builders pad to two inputs and two outputs for each shielded pool, and “Rationale for the chosen parameters” calls padding to two actions the standard approach; ZIP 318 fixes the padding of its migration and note-preparation transactions only (below). The Sapling rule departs from ZIP 317’s remark by adding no spend beyond those needed. Dummy Sapling spends, which this policy does not use, are constructed as in protocol specification, §“Dummy Notes (Sapling)”; the dummy Actions of the Orchard protocol are those of §11.7. Logical actions count an Action once: a charge per input plus per output would penalise the padding that the Action structure forces, since each Action consumes one note and creates one, and the maximum in each contribution favours no pool (ZIP 317, “Rationale for logical actions”).
ZIP 318 specifies two exceptions. Under “Canonical migration transaction structure”, a canonical migration transaction has one Orchard-pool spend in an Orchard-pool bundle of exactly two Actions, one spend Action and one output Action that carries either change or a zero-valued dummy output (ZIP 318, “Rationale for the canonical transaction shape”), and one Ironwood-pool output in an unpadded Ironwood-pool bundle of one Action. Its is and its conventional fee zatoshi. The “canonical fee (provisionally the ZIP 317 minimum fee)” of ZIP 318 is read here as this conventional fee: read as zatoshi, it leaves one unpaid action (Definition 10.8). A note-preparation transaction SHOULD have an Orchard-pool bundle of exactly Actions, padded as needed (ZIP 318, “Note preparation transactions”), so its count is , not .
Consider a transaction with no transparent inputs or outputs, one input note and one payment output, with or without one change output, whose bundles are padded as in Definition 10.6.
If the input note and every output lie in the Ironwood pool, in a bundle with , or all lie in the Sapling pool, the conventional fee is zatoshi.
If the input is a single Orchard-pool note, the payment output lies in the Ironwood pool, and the change output, if any, lies in the Orchard pool or the Ironwood pool, then the conventional fee is zatoshi.
(a) In the Ironwood pool and , so and . In the Sapling pool the contribution is . In either case , and Corollary 10.4 gives zatoshi.
(b) No value enters the Orchard pool, since for every transaction (Ironwood Guide, “Chain state and pool rules”, rule (ii); ZIP 258, “Consensus rules from NU6.3 activation”), and an Orchard-pool output lies at the receiver of the note consumed in its Action; so a payment to another party cannot lie in the Orchard pool, and the full routing rule is that of §11.2. The payment lies in the Ironwood pool by hypothesis. The Orchard-pool bundle has and , so and . The Ironwood-pool bundle has and , so . Hence and the conventional fee is zatoshi. □
The conventional fee binds through three mechanisms, none of them a consensus rule. Nodes that normally relay transactions are expected to relay those paying at least the conventional fee, unless other reasons of robustness or denial-of-service mitigation apply (ZIP 317, “Transaction relaying”). Mempool size limiting adds a penalty to the eviction weight of a transaction paying less than the conventional fee (ZIP 401; ZIP 317, “Mempool size limiting”). Block-template construction limits the unpaid actions of a block (Definition 10.8).
For a transaction with fee as in §10.1 and as in Definition 10.1, the number of unpaid actions is if is a coinbase transaction, and otherwise
The unpaid actions of a block are the sum over its transactions. The recommended block-template algorithm adds a transaction that pays less than the conventional fee only while that sum stays at most (ZIP 317, “Recommended algorithm for block template construction”).
A transaction other than a coinbase transaction has if and only if its fee is at least its conventional fee.
A transaction with more than unpaid actions is never included by the recommended algorithm, and nodes MAY drop it, or any transaction with more unpaid actions than a configurable limit (ZIP 317, “Transaction relaying”). A relay policy may set that limit to ; by Lemma 10.9 it then drops exactly the transactions that pay less than the conventional fee. The conventional fee is therefore the least fee that passes every unpaid-action limit, whatever its value. For example, the migration transaction of §10.2 with has one unpaid action at a fee of zatoshi.
A logical action is not the unit of the block limits of ZIP 218, “Shielded pool action limits”: these count the sum of a block’s Sapling descriptions, not the maximum that Definition 10.1 charges, so paying the conventional fee does not ensure that a transaction fits a given block (Consensus Guide, “A block budget for shielded work”). The limits add no transaction field. ZIP 259, “Rationale for no new transaction format”, refers to a block-level fee contribution that needs no transaction field; no published ZIP specifies that calculation, so it is designed but unspecified (Definition 1.1), and the conventional fee does not depend on it.