Zcash in Simplified Technical English

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

ZIP 2002: Explicit Fees

ZIP: 2002
Title: Explicit Fees
Owners: Daira-Emma Hopwood <daira@jacaranda.org>
        Kris Nuttycombe <kris@nutty.land>
        Jack Grigg <thestr4d@gmail.com>
Credits: Simon Liu
Status: Draft
Category: Consensus
Created: 2024-10-29
License: MIT
Discussions-To: <https://github.com/zcash/zips/issues/803>
Pull-Request: <https://github.com/zcash/zips/pull/919>

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.

The term "network upgrade" has the same meaning as in ZIP 200 [zip-0200].

The character § is the mark for a reference to a section of the Zcash Protocol Specification [protocol].

The terms "Mainnet" and "Testnet" have the meaning in § 3.12 ‘Mainnet and Testnet’ [protocol-networks].

The terms "v7 transaction format" and "v7 transaction" have the definitions in ZIP 248 [zip-0248].

Abstract

With this ZIP, the transaction fee is explicit in the v7 transaction format. The fee is an entry in the transparent transaction value pool balance map. This map is defined in ZIP 248 [zip-0248].

Fees will not be implicit in the difference between the input value and the output value of the transaction. All value transfers will be explicit, and they will be committed to through the txid. These value transfers include the fee transfers to miners.

Motivation

For fee selection, we recommend that errors are very difficult to make.

At this time, the transparent fee is the input value minus the output value. This calculation is from Bitcoin. Users can easily make errors with this calculation. It is very easy to make these errors:

Also, when a hardware wallet signs a transaction that has an implicit fee, the hardware wallet must calculate the fee again by itself. It cannot simply show the value that is committed to.

Last, after this change, light clients will be able to find the fee of a transaction. For this, it will not be necessary for them to download and examine the transparent inputs of the transaction.

Requirements

A party that sees a transaction knows its fee reliably. This is also true when the party sees the transaction in isolation.

That is, the fee must be explicit in the encoding of the transaction. Also, to calculate the fee, a calculation that can cause errors is not necessary. More chain data is not necessary also.

Specification

Changes to ZIP 248

We propose to register bundle type 5, variant 0 ("Transaction fee"), in the registry of v7 transaction bundle types. This registry is defined in ZIP 248 [zip-0248].

BundleTypeBundleVariantmValuePoolDeltasmEffectBundlesmAuthBundles
50✅❌❌

The fee bundle has no effecting data and no authorizing data. The only representation of the transaction fee is an entry in mValuePoolDeltas with bundleType = 5.

For non-coinbase transactions, the value field of this entry must be nonpositive. This value is a representation of the fee that is removed from the transparent transaction value pool.

For coinbase transactions, the value field must be nonnegative. This value is a representation of the total fees that are collected from other transactions in the block. These fees are added to the transparent transaction value pool. This value is the gross fee amount, before the removal of the fee contribution from circulation under ZIP 235 [zip-0235]. The value pool delta of the coinbase bundle includes that removal, as specified in ZIP 248. That removal does not decrease the value of the fee bundle.

Changes to the Zcash Protocol Specification

Let \(\mathsf{FeeBundleId} = 5.\)

In § 3.4 'Transactions and Treestates' [protocol-transactions] (the last change to this section was by ZIP 236 [zip-0236]), add these consensus rules:

  • [NU7 onward] For non-coinbase v7 transactions, the value of \(\mathsf{mValuePoolDeltas}[\mathsf{FeeBundleId}]\) MUST be nonpositive. Its absolute value represents the transaction fee in zatoshis.
  • [NU7 onward] For coinbase v7 transactions, the value of \(\mathsf{mValuePoolDeltas}[\mathsf{FeeBundleId}]\) MUST be nonnegative. It represents the total transaction fees collected from all other transactions in the block.

In § 7.1 'Transaction Encoding and Consensus' [protocol-txnconsensus], add:

[NU7 onward] The absolute value of the fee bundle's value pool delta MUST be in the range \(\{ 0 .. \mathsf{MAX\_MONEY} \}\).

Modifications to Digest Algorithms

The fee amount is committed to the transaction identifier through value_pool_deltas_digest, as defined in ZIP 248 [zip-0248]. The fee bundle (bundle type 5) has no effecting data and no authorizing data. Thus its only contribution to the transaction identifier is through its entry in mValuePoolDeltas.

The fee amount is also committed to in the variant 0 signature digest, as defined in ZIP 248 [zip-0248]. With this variant, each signature is a commitment to the full value pool delta map. The hash_type byte of the transparent script has no effect on this.

Applicability

All of these changes apply to Mainnet and Testnet in the same way.

Deployment

This ZIP is proposed for deployment with the next change of the transaction version. The next transaction version is assumed to be v7 [zip-0248].

Reference implementation

The reference implementation is to be determined.

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]
Zcash Protocol Specification, Version 2025.6.2 [NU6.1] or later
[protocol-transactions]
Zcash Protocol Specification, Version 2025.6.2 [NU6.1]. Section 3.4: Transactions and Treestates
[protocol-networks]
Zcash Protocol Specification, Version 2025.6.2 [NU6.1]. Section 3.12: Mainnet and Testnet
[protocol-txnconsensus]
Zcash Protocol Specification, Version 2025.6.2 [NU6.1]. Section 7.1.2: Transaction Consensus Rules
[bitcointalk-fee-error]
Bitcoin Forum post by @Voiceeeeee, March 8, 2017. "PLEASE HELP.. I sent a transaction with a 2.5 BTC transaction fee"
[zip-0200]
ZIP 200: Network Upgrade Mechanism
[zip-0235]
ZIP 235: Remove 60% of Transaction Fees From Circulation
[zip-0236]
ZIP 236: Blocks should balance exactly
[zip-0248]
ZIP 248: Extensible Transaction Format
[zip-0317]
ZIP 317: Proportional Transfer Fee Mechanism