Zcash in Simplified Technical English

This page is the Simplified Technical English version of ZIP 317. The source ZIP is the normative text. Read the writing rules to understand the marked words.

ZIP 317: Proportional Transfer Fee Mechanism

ZIP: 317
Title: Proportional Transfer Fee Mechanism
Owners: Daira-Emma Hopwood <daira@jacaranda.org>
        Kris Nuttycombe <kris@nutty.land>
        Jack Grigg <thestr4d@gmail.com>
Original-Authors: Aditya Bharadwaj
Credits: Madars Virza
         Francisco Gindre
Status: [Revision 0] Active, [Revision 1: NU6.3] Active, [Revision 2] Proposed
Category: Standards / Wallet
Obsoletes: ZIP 313
Created: 2022-08-15
Last-Updated: 2026-10-22
License: MIT
Discussions-To: <https://forum.zcashcommunity.com/t/zip-proportional-output-fee-mechanism-pofm/42808>
Pull-Request: <https://github.com/zcash/zips/pull/631>

Terminology

On this page, STE words are in the place of the BCP 14 key words of the source. Refer to the key word table.

In this document, the "conventional transaction fee" is the value of a transaction fee that has these two properties:

In this document, these terms have the definitions in [protocol-networks]:

Abstract

The goal of this ZIP is to change the conventional transaction fees. After the change, these fees depend on the number of inputs and outputs in a transaction. The goal is also to get agreement for this change from these groups:

Motivation

Because of recent network activity on Mainnet, it is time to examine and update the conventional transaction fee of 1,000 zatoshis. This fee was set in ZIP 313 [zip-0313].

At this time, the conventional transaction fee is 0.00001 ZEC or 1,000 zatoshis, as specified in ZIP 313. With this fee, it was possible to try new use cases of the Zcash blockchain. For almost 2 years, the conventional transaction fee on the Zcash network was 1,000 zatoshis. This fee did not depend on the total number of inputs and outputs in each transaction. With this conventional transaction fee, some use of the chain included high-output transactions that had 1,100 outputs. The conventional transaction fee for each such transaction was the same as for a transaction that had 2 outputs.

The objective of the new fee policy applies after enforcement of the policy starts. The objective is that the fees paid by transactions are a fair measure of their processing costs. These are the costs that different participants in the network have because of the inputs and outputs of the transactions. With this policy, there will usually be less incentive for patterns of use that result in intentional or unintentional denial of service. At the same time, low fees are still possible for regular use cases of transactions.

Requirements

Specification

Notation

Let \(\mathsf{min}(a, b)\) be the smaller of \(a\) and \(b\).
Let \(\mathsf{max}(a, b)\) be the larger of \(a\) and \(b\).
Let \(\mathsf{floor}(x)\) be the largest integer \(\leq x\).
Let \(\mathsf{ceiling}(x)\) be the smallest integer \(\geq x\).

Revisions

  • Revision 0: This revision is the initial fee mechanism of this ZIP. It was in effect before NU6.3.
  • Revision 1: In this revision, there is an additional contribution for Ironwood-pool [zip-0229] Actions. This revision came into effect at NU6.3. The Ironwood pool [zip-0258] [Ironwood-book] was introduced at NU6.3.
  • Revision 2: In this revision, \(\mathit{marginal\_fee}\) decreases from 5000 to 1000 zatoshis per logical action. Also, \(\mathit{weight\_ratio\_cap}\) increases from 4 to 10. These changes are specified in ZIP 2009 [zip-2009].

    Revision 2 applies from \(\mathsf{FEE\_REDUCTION\_HEIGHT}\). This height is 3590000 on Mainnet and 4465026 on Testnet. The applicability of Revision 2 depends on one block height. For a wallet, this is the height of the block that is expected to include the transaction. For a node, this is the height of the next block.

Fee calculation

If a wallet implements this specification, we recommend that the wallet uses this conventional transaction fee. The fee is in zatoshis:

\[ \mathit{conventional\_fee} = \mathit{marginal\_fee} \cdot \mathsf{max}(\mathit{grace\_actions},\, \mathit{logical\_actions}) \]

In this formula, \(\mathit{logical\_actions}\) is the sum of the contributions in the applicable revision of this specification. (Refer to Revisions.) A contribution in a given revision is also in all later revisions. This calculation has these parameters:

ParameterValueUnits
\(\mathit{marginal\_fee}\)\(5000\) before Revision 2;
\(1000\) from Revision 2
zatoshis per logical action (refer to the definition below)
\(\mathit{grace\_actions}\)\(2\)logical actions
\(\mathit{p2pkh\_standard\_input\_size}\)\(150\)bytes
\(\mathit{p2pkh\_standard\_output\_size}\)\(34\)bytes

From Revision 0, the specification has these contributions:

\[ \begin{array}{lcl} \mathit{contribution}_{\,\mathsf{Transparent}} &=& \mathsf{max}\big(\mathsf{ceiling}\big(\frac{\mathit{tx\_in\_total\_size}}{\mathit{p2pkh\_standard\_input\_size}}\big),\, \mathsf{ceiling}\big(\frac{\mathit{tx\_out\_total\_size}}{\mathit{p2pkh\_standard\_output\_size}}\big)\big) \\ \mathit{contribution}_{\,\mathsf{Sprout}} &=& 2 \cdot \mathit{nJoinSplit} \\ \mathit{contribution}_{\,\mathsf{Sapling}} &=& \mathsf{max}(\mathit{nSpendsSapling},\, \mathit{nOutputsSapling}) \\ \mathit{contribution}_{\,\mathsf{Orchard}} &=& \mathit{nA\kern-0.1em ctionsOrchard} \end{array} \]

These contributions are calculated from transaction fields that are in the Zcash protocol specification [protocol-txnencoding]:

InputUnitsDescription
\(\mathit{tx\_in\_total\_size}\)bytesthe total size in bytes of the tx_in field
\(\mathit{tx\_out\_total\_size}\)bytesthe total size in bytes of the tx_out field
\(\mathit{nJoinSplit}\)numberthe number of Sprout JoinSplits
\(\mathit{nSpendsSapling}\)numberthe number of Sapling spends
\(\mathit{nOutputsSapling}\)numberthe number of Sapling outputs
\(\mathit{nA\kern-0.1em ctionsOrchard}\)numberthe number of Orchard actions

From Revision 1, the \(\mathit{logical\_actions}\) sum also includes a contribution for Ironwood-pool [zip-0229] Actions. These Actions have the same Action structure as Orchard-pool Actions:

\[ \mathit{contribution}_{\,\mathsf{Ironwood}} = \mathit{nA\kern-0.1em ctionsIronwood} \]

This contribution is calculated from one more transaction field:

InputUnitsDescription
\(\mathit{nA\kern-0.1em ctionsIronwood}\)numberthe number of Ironwood actions

It is not a consensus requirement that fees agree with this formula. But we recommend that wallets create transactions with this fee, to decrease information leakage, unless the user overrides this.

Rationale for logical actions

Click to show/hide

The intention is that the fee for a transaction depends on the effect of the transaction on the network. The intention is also that there is no discrimination between these different transaction components:

  • Ironwood
  • Orchard
  • Sapling
  • transparent

The effect on the network depends on the numbers of inputs and outputs.

An earlier proposal had \(\mathit{inputs} + \mathit{outputs}\) in the place of logical actions. With that proposal, Orchard transactions have a disadvantage, because an Orchard Action is a combination of an input and an output. As a result, padding of inputs or of outputs is necessary for Orchard. The purpose is to make sure that the number of inputs and the number of outputs are the same. This padding is not necessary for the use of the Sapling and transparent protocols. Thus, in effect, discrimination against Orchard is possible with that proposal.

Rationale for the chosen parameters

Click to show/hide

Why not just charge per-action, without a grace window?

  • With the grace window, there is no penalty for the padding of a 1-action transaction to a 2-action transaction. Such padding is desirable to decrease information leakage from input and output arity. It is also the standard approach of zcashd and the transaction builder of the mobile SDK.
  • Without a grace window, it is never worthwhile to include an input with a value below the marginal fee in the resulting transaction. With a grace window, it is worthwhile to include an input with a value below \(\mathit{marginal\_fee}\) in one condition. The condition is that a second input is available that is sufficient for 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 can have both an output to a recipient and a change output. But, as stated above, zcashd and the transaction builder of the mobile SDK pad the number of inputs to at least 2.

Let \(\mathit{min\_actions}\) be the minimum number of logical actions that is sufficient to execute economically relevant transactions that have change. Because of the padding described above, \(\mathit{min\_actions} = 2\).

With a grace window size larger than \(\mathit{min\_actions}\), the cost to create such a minimal transaction is higher. We think that users will tolerate some cost for a minimal transaction. If this cost is \(B\), then \(B / \mathsf{max}(\mathit{min\_actions}, \mathit{grace\_actions})\) is an upper bound on the possible choices of \(\mathit{marginal\_fee}\).

Thus, for a given \(B\), one choice of \(\mathit{grace\_actions}\) is optimal to maximize the cost per logical action of denial-of-service attacks. This choice is \(\mathit{grace\_actions} = \mathit{min\_actions = 2}\). With this choice, a denial-of-service adversary also does not get a significant cost advantage per logical action. This is true when the adversary uses transactions that have a smaller or larger number of logical actions.

Transparent Contribution

In the specified formula, the contribution of transparent inputs and outputs is calculated from their total size, relative to a typical input or output. We also considered a different approach, to calculate this contribution as only \(\mathsf{max}(\mathit{transparent\_inputs}, \mathit{transparent\_outputs})\). But with that approach, a denial-of-service adversary can create transactions with transparent components that contain arbitrarily large scripts.

The values that we chose for \(\mathit{p2pkh\_standard\_input\_size}\) and \(\mathit{p2pkh\_standard\_output\_size}\) are based on the maximum encoded length of P2PKH inputs and outputs, as follows:

  • \(\mathit{p2pkh\_standard\_input\_size}\)
    • 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
  • \(\mathit{p2pkh\_standard\_output\_size}\)
    • value: 8 bytes
    • script: 26 bytes
      • 1 (script length) + 25 (P2PKH script)

P2SH outputs are smaller than P2PKH outputs, but P2SH inputs can be larger than P2PKH inputs. For example, a 2-of-3 multisig input is approximately 70% larger. It is counted as such in the calculation of the number of logical actions.

Marginal Fee

Before Revision 2, \(\mathit{marginal\_fee} = 5000\). With this value, the conventional transaction fee for a minimal transaction (refer to the description above) returns to the original conventional transaction fee of 10000 zatoshis from [zip-0313]. With this value, possible denial-of-service attacks also have a non-trivial cost.

From Revision 2, \(\mathit{marginal\_fee} = 1000\), and thus the fee for a minimal transaction is 2000 zatoshis. The fee is a fixed number of zatoshis, and thus its cost increased with the price of ZEC. With a marginal fee of 1000 zatoshis, denial-of-service attacks still have a non-trivial cost. This includes attacks where an adversary fills the limit on shielded actions per block, and thus pushes the transactions of other users out of blocks. The full rationale is in ZIP 2009 [zip-2009]. That rationale includes the reason why the marginal fee is not decreased more.

Transaction relaying

These node implementations apply fee-based restrictions when they relay mempool transactions:

  • zcashd
  • zebrad
  • possibly, other node implementations

Nodes that usually relay transactions are expected to relay transactions that have at least the conventional transaction fee of this ZIP. The exception is when there are other reasons not to do so, for robustness or for denial-of-service mitigation.

The definition of "unpaid actions" is in the Recommended algorithm for block template construction. If a transaction has more than \(\mathit{block\_unpaid\_action\_limit}\) unpaid actions, it will never be mined by that algorithm. Nodes can drop these transactions, or transactions that have more unpaid actions than a configurable limit. (Refer to the Deployment section for the actual behaviour of node implementations.)

Mempool size limiting

zcashd and zebrad limit the size of the mempool as described in [zip-0401]. That ZIP has a \(\mathit{low\_fee\_penalty}\). This penalty is added to the "eviction weight" if the transaction has a fee less than the conventional transaction fee. This threshold is changed to the conventional transaction fee from the new formula.

Block production

These block producers use different criteria to select transactions for inclusion in blocks:

  • miners
  • mining pools
  • other block producers

The plan is that zcashd and zebrad implement the algorithm in the section that follows.

Rationale for block template construction algorithm

It is probable that some wallets will not immediately update to pay the generally higher fees in this ZIP. Thus we let each block contain a limited number of "unpaid" logical actions. As a result, we can deploy this block template construction algorithm more quickly. The transactions that such wallets create still have a reasonable chance that miners mine them. Approximately, we count unpaid actions as follows. If the fee of a transaction is less than the conventional transaction fee by \(k\) times the marginal fee, that is \(k\) unpaid actions.

It does not matter how full the mempool is (by the cost limiting of ZIP 401 [zip-0401]). It also does not matter what strategy a denial-of-service adversary can use. In all cases, the number of unpaid actions in each block is never more than \(\mathit{block\_unpaid\_action\_limit}\).

With the weighting in step 2, an adversary that pays more than the conventional transaction fee gets no significant advantage over other users. There are two reasons:

  1. Because of the weight ratio cap, the relative probability of selection of a given transaction has a limit. This probability is at most \(\mathit{weight\_ratio\_cap}\) times larger than the probability for a transaction that has exactly the conventional transaction fee.
  2. Compare these two cases. In the first case, the adversary pays \(c\) times the conventional transaction fee for one transaction. In the second case, the adversary pays the conventional transaction fee for \(c\) transactions.

    In the first case, the adversary is more likely to get each transaction into the block, relative to competing transactions from other users. But the block space for those transactions is smaller, if all other things are equal (for example, the choice of input or output types). This is not what the adversary wants. The adversary gets a transaction into the block only at a cost: the adversary leaves more block space for the transactions of the other users.

We chose \(\mathit{weight\_ratio\_cap} = 10\) from Revision 2 as a compromise between two alternatives. One alternative is no prioritization of transactions relative to those that have the conventional transaction fee. The other alternative is arbitrary prioritization that depends on the ability to pay. The cap is a multiple of the conventional transaction fee. Thus the weight ratio of a transaction saturates at a fee that decreases with \(\mathit{marginal\_fee}\). With a cap of 10 at \(\mathit{marginal\_fee} = 1000\), that point is below its position at \(\mathit{weight\_ratio\_cap} = 4\) and \(\mathit{marginal\_fee} = 5000\).

\(\mathit{tx.weight\_ratio}\) is calculated from \(\mathsf{max}(1,\, \mathit{tx.fee})\), and not from only \(\mathit{tx.fee}\). Thus it is not necessary to give a definition of "with a probability in direct proportion to its \(\mathit{weight\_ratio}\)" for one special case. In that case, all the remaining candidate transactions have \(\mathit{weight\_ratio} = 0\).

Incentive compatibility for miners

Miners have an incentive to make this change for these reasons:

  • With this change, the fees that are due to the miners will usually increase.
  • Fees will be a damping factor on the time that is necessary to process blocks, and thus on the orphan rate.

Security and Privacy considerations

From non-standard transaction fees, it is possible to identify one or more of these:

Privacy then decreases for those specific users and for the remainder of the network. But the advantage of faster deployment was an argument against synchronization of the change in wallet behaviour at a specific block height.

In the long term, it is necessary to examine the issue of fees again in separate future proposals. This is necessary when the blocks start to become consistently full. We recommend that wallet developers and operators do these two things:

Denial of Service

A transaction-rate-based denial-of-service attack occurs when an adversary generates many transactions in a window of time. The number of transactions is sufficient to prevent the mining of legitimate transactions, or to make block sync difficult for full nodes or miners.

Zcash has two primary protections against this type of attack: the block size limit and transaction fees. Because of the block size limit, full nodes and miners can stay in sync with the blockchain, even if blocks are completely full. But it is possible that users who send legitimate transactions do not get confirmation of their transactions sufficiently quickly.

With this proposal, there is no change to how fees are paid from transactions to miners.

Deployment

We recommend that wallets deploy these changes immediately. We recommend that nodes immediately deploy the change to the \(\mathit{low\_fee\_penalty}\) threshold described in Mempool size limiting.

We recommend that nodes that support block template construction immediately deploy the new Recommended algorithm for block template construction. We recommend that miners use nodes that have the upgrade to this algorithm.

We recommend that node developers coordinate on schedules to deploy restrictions to their policies for mempool acceptance of transactions and for peer-to-peer relaying. We recommend that these policy changes are not deployed before the changes to block template construction for miners described in the preceding paragraph.

Revision 1 is in effect from the activation of NU6.3 [zip-0258].

Revision 2 applies from \(\mathsf{FEE\_REDUCTION\_HEIGHT}\), as specified in ZIP 2009 [zip-2009].

Deployment in zcashd

zcashd v5.5.0 implemented the use of the conventional transaction fee of this ZIP by default for its internal wallet in these PRs:

zcashd v5.5.0 implemented the Recommended algorithm for block template construction in these PRs:

A user can override the value that zcashd uses for \(\mathit{block\_unpaid\_action\_limit}\) with the -blockunpaidactionlimit configuration parameter.

zcashd v5.5.0 also implemented the change to Mempool size limiting. With this change, the low fee penalty threshold is the conventional transaction fee of this ZIP. The implementation is in this PR:

As described in the section Transaction relaying, nodes can drop transactions that have more unpaid actions than a given limit. From zcashd v5.6.0, this is controlled by the -txunpaidactionlimit configuration option. The default of this option is 50 unpaid actions (the same default as -blockunpaidactionlimit). This behaviour is implemented in this PR:

Note that zcashd also accepts only transactions that have at least a "relay threshold" fee. As part of the ZIP 317 work, this rule was made simpler for zcashd v5.5.0 in this PR:

Deployment in zebra

zebra does not supply a wallet. Thus it is not necessary for zebra to calculate the conventional transaction fee of this ZIP to create transactions.

zebra v1.0.0-rc.3 implemented the current Recommended algorithm for block template construction in these PRs:

zebra v1.0.0-rc.2 implemented an earlier version of this algorithm. The value that zebra uses for \(block\_unpaid\_action\_limit\) is not configurable.

zebra v1.0.0-rc.2 implemented the change to Mempool size limiting in this PR:

zebra v1.0.0-rc.8 implemented the Transaction relaying changes in this PR:

zebra uses a relay threshold rule that is similar to the rule of zcashd. But zebra also enforces a minimum fee of 100 zatoshis. This is different from zcashd only for valid transactions of less than 1000 bytes. This is true if zcashd uses its default value for -minrelaytxfee.

Considered Alternatives

This section contains alternative proposals that were not adopted.

In earlier versions of this specification, the marginal fee was multiplied by the sum of inputs and outputs. Thus the alternatives below are approximately half of their equivalent values with the current formula.

These are possible alternatives for the parameters:

(The original proposals of @madars and @nighthawk24 had an additional \(\mathit{base\_fee}\) parameter. Because of this parameter, the relation between the fee and the number of inputs/outputs was non-proportional above the \(\mathit{grace\_actions}\) threshold. It is no longer possible to express this with the formula above.)

Endorsements

These entities, and the developers of the software in this list, gave their support for the updated fee mechanism:

Acknowledgements

We thank Madars Virza, who first proposed a fee mechanism similar to the mechanism of this ZIP [madars-1]. Madars Virza also found a possible weakness in an earlier version of the block template construction algorithm. We also thank these persons for reviews and suggested improvements:

Change History

2026-10-22

  • We added Revision 2. In this revision, from \(\mathsf{FEE\_REDUCTION\_HEIGHT}\), \(\mathit{marginal\_fee}\) decreases to 1000 zatoshis per logical action and \(\mathit{weight\_ratio\_cap}\) increases to 10. This is as specified in ZIP 2009. Revision 2 is Proposed.

2026-10-21

  • We removed the draft Revision 2. That draft contained fee handling for memo bundles (ZIP 231). Do not apply its changes to this ZIP until ZIP 231 has at least Proposed status. Until then, these changes are specified in ZIP 231.
  • Revision 1 is Active. It is in effect from NU6.3.

2026-06-26

  • We added a draft of Revision 1, to come into effect at the Ironwood network upgrade (NU6.3). This draft contains a contribution for Ironwood-pool Actions.
  • We added the revisions mechanism. We made the existing fee mechanism Revision 0. We moved the memo bundle fee handling into a draft Revision 2.
  • We removed the fee contributions for ZSA issuance and asset creation (ZIP 227).

References

[BCP14]
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"
[protocol-networks]
Zcash Protocol Specification, Version 2022.3.8. Section 3.12: Mainnet and Testnet
[protocol-txnencoding]
Zcash Protocol Specification, Version 2022.3.8. Section 7.1: Transaction Encoding and Consensus
[sigop-limit]
zcash/zips issue #568 - Document block transparent sigops limit consensus rule
[madars-1]
Madars concrete soft-fork proposal
[zip-0229]
ZIP 229: Version 6 Transaction Format
[zip-0258]
ZIP 258: Deployment of the NU6.3 Network Upgrade
[zip-0313]
ZIP 313: Reduce Conventional Transaction Fee to 1000 zatoshis
[zip-0401]
ZIP 401: Addressing Mempool Denial-of-Service
[zip-2009]
ZIP 2009: Reduce Marginal Fee to 1000 Zatoshis and Raise the Weight Ratio Cap to 10
[Ironwood-book]
The Ironwood Book