ZIP 317
Proportional Transfer Fee Mechanism
- Active
- Draft
Contents
- Terminology
- Abstract
- Motivation
- Requirements
- Specification
- Notation
- Revisions
- Fee calculation
- Transaction relaying
- Mempool size limiting
- Block production
- Security and Privacy considerations
- Denial of Service
- Deployment
- Deployment in zcashd
- Deployment in zebra
- Considered Alternatives
- Endorsements
- Acknowledgements
- Change History
- 2026-06-26
- References
Preamble
- ZIP
- 317
- Title
- Proportional Transfer Fee Mechanism
- Original-Authors
- Aditya Bharadwaj
- Credits
- Madars Virza
- Francisco Gindre
- Status
- [Revision 0] Active, [Revision 1: NU6.3] Draft, [Revision 2] Draft
- Category
- Standards / Wallet
- Obsoletes
- ZIP 313
- Created
- 2022-08-15
- Last-Updated
- 2026-06-26
- License
- MIT
- Pull-Request
- https://github.com/zcash/zips/pull/631
Terminology
The key words "SHOULD", "SHOULD NOT", "RECOMMENDED", and "MAY" in this document are to be interpreted as described in BCP 141 when, and only when, they appear in all capitals.
The term "conventional transaction fee" in this document is in reference to the value of a transaction fee that is conventionally used by wallets, and that a user can reasonably expect miners on the Zcash network to accept for including a transaction in a block.
The terms "Mainnet", "Testnet", and "zatoshi" in this document are defined as in2.
Abstract
The goal of this ZIP is to change the conventional fees for transactions by making them dependent on the number of inputs and outputs in a transaction, and to get buy-in for this change from wallet developers, miners and Zcash users.
Motivation
In light of recent Mainnet network activity, it is time to review and update the standard 1,000 zatoshi transaction fee set in ZIP 3133.
The conventional transaction fee presently is 0.00001 ZEC or 1,000 zatoshis, as specified in ZIP 313. This allowed exploration of novel use cases of the Zcash blockchain. The Zcash network has operated for almost 2 years at a conventional transaction fee of 1,000 zatoshis, without consideration for the total number of inputs and outputs in each transaction. Under this conventional fee, some usage of the chain has been characterized by high-output transactions with 1,100 outputs, paying the same conventional fee as a transaction with 2 outputs.
The objective of the new fee policy, once it is enforced, is for fees paid by transactions to fairly reflect the processing costs that their inputs and outputs impose on various participants in the network. This will tend to discourage usage patterns that cause either intentional or unintentional denial of service, while still allowing low fees for regular transaction use cases.
Requirements
- The conventional fee formula should not favour or discriminate against transactions involving any of the Ironwood, Orchard, Sapling, or transparent pools.
- The fee for a transaction should scale linearly with the number of inputs and/or outputs.
- Users should not be penalised for sending transactions constructed with padding of inputs and outputs to reduce information leakage. (The default policy employed by zcashd and the mobile SDKs pads to two inputs and two outputs for each shielded pool used by the transaction).
- Users should be able to spend a small number of UTXOs or notes with value below the marginal fee per input.
- The conventional fee should not leak private information used in constructing the transaction; that is, it should be computable from only the public data of the transaction.
Specification
Notation
<br/>
Let be the lesser of and . Let be the greater of and . Let be the largest integer . Let be the smallest integer .
Revisions
- Revision 0: The initial fee mechanism specified by this ZIP, in effect prior to NU6.3.
Fee calculation
Wallets implementing this specification SHOULD use a conventional fee, calculated in zatoshis, of
where is the sum of the contributions defined by the applicable revision of this specification (see Revisions). A contribution defined by a given revision is also included in all later revisions. This calculation uses the following parameters:
| Parameter | Value | Units |
|---|---|---|
| zatoshis per logical action (as defined below) | ||
| logical actions | ||
| bytes | ||
| bytes |
As of Revision 0, the following contributions are defined:
These contributions are computed from transaction fields defined in the Zcash protocol specification9:
| Input | Units | Description |
|---|---|---|
| bytes | total size in bytes of the tx_in field |
|
| bytes | total size in bytes of the tx_out field |
|
| number | the number of Sprout JoinSplits | |
| number | the number of Sapling spends | |
| number | the number of Sapling outputs | |
| number | the number of Orchard actions |
As of Revision 1, the sum additionally includes a contribution for Ironwood-pool10 Actions, which use the same Action structure as Orchard-pool Actions:
This contribution is computed from one additional transaction field:
| Input | Units | Description |
|---|---|---|
| number | the number of Ironwood actions |
As of Revision 2 (draft), the sum additionally includes a contribution for memo bundles11:
This contribution is computed from one additional transaction field:
| Input | Units | Description |
|---|---|---|
| number | the number of memo chunks |
It is not a consensus requirement that fees follow this formula; however, wallets SHOULD create transactions that pay this fee, in order to reduce information leakage, unless overridden by the user.
Rationale for logical actions
Click to show/hide
The intention is to make the fee paid for a transaction depend on its impact on the network, without discriminating between different transaction components (Ironwood, Orchard, Sapling, or transparent). The impact on the network depends on the numbers of inputs and outputs.
A previous proposal used instead of logical actions. This would have disadvantaged Orchard transactions, as a result of an Orchard Action combining an input and an output. The effect of this combining is that Orchard requires padding of either inputs or outputs to ensure that the number of inputs and outputs are the same. Usage of Sapling and transparent protocols does not require this padding, and so this could have effectively discriminated against Orchard.
Rationale for the chosen parameters
Click to show/hide
Why not just charge per-action, without a grace window?
- This ensures that there is no penalty to padding a 1-action transaction to a 2-action transaction. Such padding is desirable to reduce information leakage from input and output arity, and is the standard approach used by zcashd and the mobile SDK transaction builder.
- Without a grace window, an input with value below the marginal fee would never be worth including in the resulting transaction. With a grace window, an input with value below is worth including, if a second input is available that covers both the primary output amount and the conventional transaction fee.
Why a grace window of 2?
A 1-in, 2-out (or 2-action) transaction is the smallest possible transaction that permits both an output to a recipient, and a change output. However, as stated above, zcashd and the mobile SDK transaction builder will pad the number of inputs to at least 2.
Let be the minimum number of logical actions that can be used to execute economically relevant transactions that produce change. Due to the aforementioned padding, .
Having a grace window size greater than would increase the cost to create such a minimal transaction. If the cost we believe that users will tolerate for a minimal transaction is , then possible choices of are bounded above by . Therefore, the optimal choice of to maximize the per-logical-action cost of denial-of-service attacks for a given , is . This also ensures that a denial-of-service adversary does not gain a significant per-logical-action cost advantage by using transactions with a smaller or larger number of logical actions.
Transparent Contribution
The specified formula calculates the contribution of transparent inputs and outputs based on their total size relative to a typical input or output. Another considered approach was to calculate this contribution simply as . However, this would allow a denial-of-service adversary to create transactions with transparent components containing arbitrarily large scripts.
The chosen values for and are based on the maximum encoded length for P2PKH inputs and outputs, as follows:
-
- outpoint: 36 bytes
- script: 110 bytes
- 1 (overall length) + 1 (signature length) + 72 (signature) + 1 (sighash type) + 1 (pubkey length) + 33 (pubkey) + 1 (margin)
- sequence: 4 bytes
-
- value: 8 bytes
- script: 26 bytes
- 1 (script length) + 25 (P2PKH script)
P2SH outputs are smaller than P2PKH outputs, but P2SH inputs may be larger than P2PKH inputs. For example a 2-of-3 multisig input is around 70% larger, and is counted as such when computing the number of logical actions.
Marginal Fee
This returns the conventional fee for a minimal transaction (as described above) to the original conventional fee of 10000 zatoshis specified in12, and imposes a non-trivial cost for potential denial-of-service attacks.
Memo Chunks
Making the fee linear in the number of memo chunks has the following properties:
- The required fee to add more memo chunks scales at the same rate as adding logical actions, so it isn't a cheaper mechanism for an adversary to bloat chain size.
- A "baseline transaction" (one spent note, one output to an external recipient with a memo, one change output without a memo) has the same fee as before.
- A "broadcast transaction" (many outputs to different recipients all given the same memo) is the same fee as before (but a smaller transaction).
- A "many memos transaction" (many outputs to different recipients all with unique memos) is at most around twice the fee as before.
Combined with the memo bundle size restriction, the maximum additional fee for a ZIP 231 memo bundle13 over prior transactions is 0.0019 ZEC.
Transaction relaying
zcashd, zebrad, and potentially other node implementations, implement fee-based restrictions on relaying of mempool transactions. Nodes that normally relay transactions are expected to do so for transactions that pay at least the conventional fee as specified in this ZIP, unless there are other reasons not to do so for robustness or denial-of-service mitigation.
If a transaction has more than "unpaid actions" as defined by the Recommended algorithm for block template construction, it will never be mined by that algorithm. Nodes MAY drop these transactions, or transactions with more unpaid actions than a configurable limit (see the Deployment section for actual behaviour of node implementations).
Mempool size limiting
zcashd and zebrad limit the size of the mempool as described in14. This specifies a that is added to the "eviction weight" if the transaction pays a fee less than the conventional transaction fee. This threshold is modified to use the new conventional fee formula.
Block production
Miners, mining pools, and other block producers, select transactions for inclusion in blocks using a variety of criteria. The algorithm in the following section is planned to be implemented by zcashd and zebrad.
Recommended algorithm for block template construction
Define constants and .
Let be the conventional fee for transaction calculated according to the section Fee calculation.
Let
Let .
The following algorithm is RECOMMENDED for constructing a block template from a set of transactions in a node's mempool:
- Set the block template to include a placeholder for the coinbase transaction (see Note below).
- For each transaction in the mempool, calculate and add the transaction to the set of candidate transactions.
- Repeat while there is any candidate transaction that pays at least the conventional fee:
- Pick one of those transactions at random with probability in direct proportion to its , and remove it from the set of candidate transactions. Let be the block template with this transaction included.
- If would be within the block size limit and block sigop limit15, set .
- Repeat while there is any candidate transaction:
- Pick one of those transactions at random with probability in direct proportion to its , and remove it from the set of candidate transactions. Let be the block template with this transaction included.
- If would be within the block size limit and block sigop limit16 and , set .
- Return .
Note: In step 1, the final coinbase transaction cannot be included at this stage because it depends on the fees paid by other transactions. In practice, this difficulty can be overcome by reserving sufficient space and sigops to allow modifying the coinbase transaction as needed, when testing against the block space and block sigop limits in steps 3b and 4b.
Rationale for block template construction algorithm
It is likely that not all wallets will immediately update to pay the (generally higher) fees specified by this ZIP. In order to be able to deploy this block template algorithm more quickly while still giving transactions created by such wallets a reasonable chance of being mined, we allow a limited number of "unpaid" logical actions in each block. Roughly speaking, if a transaction falls short of paying the conventional transaction fee by times the marginal fee, we count that as unpaid logical actions.
Regardless of how full the mempool is (according to the ZIP 40117 cost limiting), and regardless of what strategy a denial-of-service adversary may use, the number of unpaid logical actions in each block is always limited to at most .
The weighting in step 2 does not create a situation where the adversary gains a significant advantage over other users by paying more than the conventional fee, for two reasons:
- The weight ratio cap limits the relative probability of picking a given transaction to be at most times greater than a transaction that pays exactly the conventional fee.
- Compare the case where the adversary pays times the conventional fee for one transaction, to that where they pay the conventional fee for transactions. In the former case they are more likely to get each transaction into the block relative to competing transactions from other users, but those transactions take up less block space, all else (e.g. choice of input or output types) being equal. This is not what the attacker wants; they get a transaction into the block only at the expense of leaving more block space for the other users' transactions.
The rationale for choosing is as a compromise between not allowing any prioritization of transactions relative to those that pay the conventional fee, and allowing arbitrary prioritization based on ability to pay.
Calculating in terms of rather than just avoids needing to define "with probability in direct proportion to its " for the case where all remaining candidate transactions would have .
Incentive compatibility for miners
Miners have an incentive to make this change because:
- it will tend to increase the fees they are due;
- fees will act as a damping factor on the time needed to process blocks, and therefore on orphan rate.
Security and Privacy considerations
Non-standard transaction fees may reveal specific users or wallets or wallet versions, which would reduce privacy for those specific users and the rest of the network. However, the advantage of faster deployment weighed against synchronizing the change in wallet behaviour at a specific block height.
Long term, the issue of fees needs to be revisited in separate future proposals as the blocks start getting consistently full. Wallet developers and operators should monitor the Zcash network for rapid growth in transaction rates, and consider further changes to fee selection and/or other scaling solutions if necessary.
Denial of Service
A transaction-rate-based denial of service attack occurs when an attacker generates enough transactions over a window of time to prevent legitimate transactions from being mined, or to hinder syncing blocks for full nodes or miners.
There are two primary protections to this kind of attack in Zcash: the block size limit, and transaction fees. The block size limit ensures that full nodes and miners can keep up with the blockchain even if blocks are completely full. However, users sending legitimate transactions may not have their transactions confirmed in a timely manner.
This proposal does not alter how fees are paid from transactions to miners.
Deployment
Wallets SHOULD deploy these changes immediately. Nodes SHOULD deploy the change to the threshold described in Mempool size limiting immediately.
Nodes supporting block template construction SHOULD deploy the new Recommended algorithm for block template construction immediately, and miners SHOULD use nodes that have been upgraded to this algorithm.
Node developers SHOULD coordinate on schedules for deploying restrictions to their policies for transaction mempool acceptance and peer-to-peer relaying. These policy changes SHOULD NOT be deployed before the changes to block template construction for miners described in the preceding paragraph.
Deployment in zcashd
zcashd v5.5.0 implemented use of ZIP 317 fees by default for its internal wallet in the following PRs:
- https://github.com/zcash/zcash/pull/6527 (fee computation)
- https://github.com/zcash/zcash/pull/6524 (main implementation)
- https://github.com/zcash/zcash/pull/6559 (follow-up to #6524)
- https://github.com/zcash/zcash/pull/6568 (for
z_shieldcoinbase) - https://github.com/zcash/zcash/pull/6576 (follow-up to #6568)
- https://github.com/zcash/zcash/pull/6569 (for
z_mergetoaddress)
zcashd v5.5.0 implemented the Recommended algorithm for block template construction in:
- https://github.com/zcash/zcash/pull/6460 (preparation)
- https://github.com/zcash/zcash/pull/6607 (follow-up to #6460)
- https://github.com/zcash/zcash/pull/6527 (fee computation)
- https://github.com/zcash/zcash/pull/6564 (block template construction)
The value used for by zcashd can be overridden using the -blockunpaidactionlimit configuration parameter.
zcashd v5.5.0 also implemented the change to Mempool size limiting to use the ZIP 317 fee for the low fee penalty threshold, in:
As described in section Transaction relaying, nodes MAY drop transactions with more unpaid actions than a given limit. From zcashd v5.6.0, this is controlled by the -txunpaidactionlimit configuration option, which defaults to 50 unpaid actions (the same default as -blockunpaidactionlimit). This behaviour is implemented in:
Note that zcashd also requires transactions to pay at least a "relay threshold" fee. As part of the ZIP 317 work, this rule was simplified for zcashd v5.5.0:
Deployment in zebra
zebra does not provide a wallet, and so does not need to calculate ZIP 317 fees in order to construct transactions.
zebra v1.0.0-rc.3 implemented the current Recommended algorithm for block template construction in:
- https://github.com/ZcashFoundation/zebra/pull/5724
- https://github.com/ZcashFoundation/zebra/pull/5776 (algorithm update)
zebra v1.0.0-rc.2 had implemented an earlier version of this algorithm. The value used for in zebra is not configurable.
zebra v1.0.0-rc.2 implemented the change to Mempool size limiting in:
zebra v1.0.0-rc.8 implemented Transaction relaying changes in:
zebra uses a similar relay threshold rule to zcashd, but additionally enforces a minimum fee of 100 zatoshis (this differs from zcashd only for valid transactions of less than 1000 bytes, assuming that zcashd uses its default value for -minrelaytxfee).
Considered Alternatives
This section describes alternative proposals that have not been adopted.
In previous iterations of this specification, the marginal fee was multiplied by the sum of inputs and outputs. This means that the alternatives given below are roughly half of what they would be under the current formula.
Possible alternatives for the parameters:
- in @nuttycom's proposal.
- adapted from @madars' proposal18.
- in @daira's proposal.
- for Shielded, Shielding and De-shielding transactions, and for Transparent transactions adapted from @nighthawk24's proposal.
(In @madars' and @nighthawk24's original proposals, there was an additional parameter that caused the relationship between fee and number of inputs/outputs to be non-proportional above the threshold. This is no longer expressible with the formula specified above.)
Endorsements
The following entities and developers of the listed software expressed their support for the updated fee mechanism:
- Zecwallet Suite (Zecwallet Lite for Desktop/iOS/Android & Zecwallet FullNode)
- Nighthawk Wallet for Android & iOS
- Electric Coin Company
- Zcash Foundation
Acknowledgements
Thanks to Madars Virza for initially proposing a fee mechanism similar to that proposed in this ZIP19, and for finding a potential weakness in an earlier version of the block template construction algorithm. Thanks also to Kris Nuttycombe, Jack Grigg, Francisco Gindre, Greg Pfeil, Teor, and Deirdre Connolly for reviews and suggested improvements.
Change History
2026-06-26
- Added a draft of Revision 1, which adds an Ironwood-pool Action contribution, to be enacted at the Ironwood network upgrade (NU6.3).
- Introduced the revisions mechanism: recast the existing fee mechanism as Revision 0, and moved the memo bundle fee handling into a draft Revision 2.
- Removed the ZSA issuance and asset-creation fee contributions (ZIP 227).
References
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"↩︎
Zcash Protocol Specification, Version 2022.3.8. Section 3.12: Mainnet and Testnet↩︎
ZIP 313: Reduce Conventional Transaction Fee to 1000 zatoshis↩︎
Zcash Protocol Specification, Version 2022.3.8. Section 7.1: Transaction Encoding and Consensus↩︎
ZIP 313: Reduce Conventional Transaction Fee to 1000 zatoshis↩︎
zcash/zips issue #568 - Document block transparent sigops limit consensus rule↩︎
zcash/zips issue #568 - Document block transparent sigops limit consensus rule↩︎
Citation graph
Cites
Cited by
- 218 — 25-second Block Target Spacing
- 226 — Transfer and Burn of Zcash Shielded Assets
- 227 — Issuance of Zcash Shielded Assets
- 231 — Memo Bundles
- 235 — Remove 60% of Transaction Fees From Circulation
- 258 — Deployment of the NU6.3 Network Upgrade
- 313 — Reduce Conventional Transaction Fee to 1000 zatoshis
- 315 — Best Practices for Wallet Implementations
- 318 — Orchard to Ironwood Migration
- 326 — NU6.3 Consequences for Wallets
- 401 — Addressing Mempool Denial-of-Service
- 2009 — Reduce Marginal Fee to 1000 Zatoshis and Raise the Weight Ratio Cap to 10