ZIP: 2002 Title: Explicit Fees Owners: Daira-Emma Hopwood <daira-emma@electriccoin.co> Kris Nuttycombe <kris@electriccoin.co> Jack Grigg <jack@electriccoin.co> Credits: Simon Liu Status: Draft Category: Consensus License: MIT Discussions-To: <https://github.com/zcash/zips/issues/803> Pull-Request: <https://github.com/zcash/zips/pull/919>
The key word "MUST" in this document is to be interpreted as described in BCP 14 1 when, and only when, it appears in all capitals.
The term "network upgrade" in this document is to be interpreted as described in ZIP 200. 7
The character § is used when referring to sections of the Zcash Protocol Specification. 2
The terms "Mainnet" and "Testnet" are to be interpreted as described in § 3.12 ‘Mainnet and Testnet’. 4
This proposal adds an explicit fee
field to the v6 transaction format. Instead of fees being implicit in the difference between the input value and output value of the transaction, all value transfers, including fee transfers to miners, will be explicit and committed to via the txid.
When it comes to fee selection, it should be very hard to make mistakes. The current transparent fee computation (inherited from Bitcoin) — input value less output value — is prone to user error. It is very easy to forget to add an output for a change address, make a calculation error 6, mix up units etc.
In addition, when signing a transaction with a hardware wallet, using an implicit fee means that the hardware wallet must recompute the fee on its own and cannot simply display the value being committed to.
Finally, this change will make it possible for light clients to determine the fee paid by a transaction without needing to download and inspect transparent inputs to the transaction.
Parties that see a transaction, even in isolation, reliably know its fee. That is, the fee must be explicit in the encoding of the transaction, and no potentially error-prone calculations or additional chain data are needed to compute it.
The following field is appended to the Common Transaction Fields of the v6 transaction format after nExpiryHeight
9:
Bytes | Name | Data Type | Description |
---|---|---|---|
8 | fee |
uint64 |
The fee to be paid by this transaction, in zatoshis. |
Note: If both this ZIP and ZIP 233 are selected for inclusion in the same Network Upgrade, then the ambiguity in ordering of the fields added by these ZIPs would need to be resolved.
In § 3.4 ‘Transactions and Treestates’ 3 (last modified by ZIP 236 10), add the following consensus rule and note:
- [NU7 onward] For v6 and later transactions, the remaining value in the transparent transaction value pool, in zatoshis, MUST be equal to the value of the transaction’s
fee
field.Non-normative note: The effect of these rules is that the
fee
field of v6 and later coinbase transactions will always be zero.
In § 7.1 ‘Transaction Encoding and Consensus’ 5, add:
[NU7 onward]
fee
MUST be in the range \(\{ 0 .. \mathsf{MAX\_MONEY} \}\!\) .
Relative to the sighash algorithm defined in ZIP 244, the sighash algorithm that applies to v6 transactions differs by appending the fee
field to the Common Transaction Fields that are the input to the digest in T.1: header_digest 12:
T.1f: fee (8-byte little-endian fee amount)
Note: If both this ZIP and ZIP 233 are selected for inclusion in the same Network Upgrade, then the ambiguity in ordering of the fields added by these ZIPs would need to be resolved.
All of these changes apply identically to Mainnet and Testnet.
This ZIP is proposed to be deployed with the next transaction version change, which is assumed to be v6. 8
TBD
1 | 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" |
---|
2 | Zcash Protocol Specification, Version 2024.5.1 [NU6] or later |
---|
3 | Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 3.4: Transactions and Treestates |
---|
4 | Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 3.12: Mainnet and Testnet |
---|
5 | Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.1.2: Transaction Consensus Rules |
---|
6 | Bitcoin Forum post by @Voiceeeeee, March 8, 2017. "PLEASE HELP.. I sent a transaction with a 2.5 BTC transaction fee" |
---|
7 | ZIP 200: Network Upgrade Mechanism |
---|
8 | ZIP 230: Version 6 Transaction Format |
---|
9 | ZIP 230: Version 6 Transaction Format. Specification: Transaction Format |
---|
10 | ZIP 236: Blocks should balance exactly |
---|
11 | ZIP 244: Transaction Identifier Non-Malleability |
---|
12 | ZIP 244: Transaction Identifier Non-Malleability. Section T.1: Header Digest |
---|
13 | ZIP draft: Version 6 Transaction Signature Validation |
---|