diff --git a/rendered/zip-0230.html b/rendered/zip-0230.html index 1ef67e07e..6f12ff6a4 100644 --- a/rendered/zip-0230.html +++ b/rendered/zip-0230.html @@ -25,20 +25,33 @@ Discussions-To: <https://github.com/zcash/zips/issues/686>

Terminology

The key words "MUST", "SHOULD", and "MAY" in this document are to be interpreted as described in BCP 14 1 when, and only when, they appear in all capitals.

-

The character § is used when referring to sections of the Zcash Protocol Specification 2.

+

The terms "Zcash Shielded Asset", "ZSA" and "Asset" in this document are to be interpreted as described in ZIP 226 7.

+

The term "Issuance" and "Issuance Action" in this document are to be interpreted as described in ZIP 227 8.

+

We define the following additional terms:

+ +

The character § is used when referring to sections of the Zcash Protocol Specification 2.

Abstract

This proposal defines a new Zcash peer-to-peer transaction format, which includes data that supports the Orchard-ZSA protocol and all operations related to Zcash Shielded Assets (ZSAs). The new format adds and describes new fields containing ZSA-specific elements. Like the existing v5 transaction format, it keeps well-bounded regions of the serialized form to serve each pool of funds.

-

This ZIP also depends upon and defines modifications to the computation of the values TxId Digest, Signature Digest, and Authorizing Data Commitment defined by ZIP 244 8.

+

This ZIP also depends upon and defines modifications to the computation of the values TxId Digest, Signature Digest, and Authorizing Data Commitment defined by ZIP 244 9.

+

This ZIP additionally defines the fee mechanism associated with the Orchard Zcash Shielded Assets (OrchardZSA) protocol as described in ZIP 226 7 and ZIP 227 8. The fee mechanism is defined in terms of modifications to the Proportionak Transfer Fee Mechanism 10.

Motivation

The Orchard-ZSA protocol requires serialized data elements that are distinct from any previous Zcash transaction. Since ZIP 244 was activated in NU5, the v5 and later serialized transaction formats are not consensus-critical. Thus, this ZIP defines format that can easily accommodate future extensions, where elements or a given pool are kept separate.

+

The upgrade to the OrchardZSA protocol will also need to define a fee structure consistent with the objectives of ZIP 317 10. This involves adaptation for the transfer protocol 7, as well as additional considerations for the issuance protocol 8 such as fees for asset issuance. Specifically, the OrchardZSA Transfer and Burn mechanism should follow the same fee mechanism in order to not discriminate between transfer bundle types. When it comes to Issuance of ZSA, however, there should be a disincentive that will stop users from flooding the chain with useless asset identifiers. In the case of Issuance, the computational power needed to verify the bundle is not large. The transaction size, however, can be an issue as the number of output notes can be large. Furthermore, as defined in ZIP 227 8, there is an additional data structure in the global state that needs to be maintained as part of the consensus. This motivates further the addition of an Issuance-specific fee.

Requirements

The new format must fully support the Orchard-ZSA protocol.

The new format should lend itself to future extension or pruning to add or remove value pools.

The computation of the non-malleable transaction identifier hash must include all newly incorporated elements except those that attest to transaction validity.

The computation of the commitment to authorizing data for a transaction must include all newly incorporated elements that attest to transaction validity.

+

In addition to the requirements of ZIP 317 10, the fee mechanism for the OrchardZSA protocol should satisfy the following requirements:

+

Non-requirements

More general forms of extensibility, such as definining a key/value format that allows for parsers that are unaware of some components, are not required.

@@ -306,7 +319,7 @@ 64 issueAuthSig byte[64] - The signature of the transaction SIGHASH, signed by the issuer, validated as in Issuance Authorization Signature Scheme 7. + The signature of the transaction SIGHASH, signed by the issuer, validated as in Issuance Authorization Signature Scheme 8. @@ -371,7 +384,7 @@ -

The encodings of each of these elements are defined in §7.3 ‘Spend Description Encoding and Consensus’ of the Zcash Protocol Specification 3.

+

The encodings of each of these elements are defined in §7.3 ‘Spend Description Encoding and Consensus’ of the Zcash Protocol Specification 3.

Sapling Output Description (OutputDescriptionV6)

@@ -418,7 +431,7 @@
-

The encodings of each of these elements are defined in §7.4 ‘Output Description Encoding and Consensus’ of the Zcash Protocol Specification 4.

+

The encodings of each of these elements are defined in §7.4 ‘Output Description Encoding and Consensus’ of the Zcash Protocol Specification 4.

Orchard-ZSA Action Description (OrchardZsaAction)

@@ -477,7 +490,7 @@
-

The encodings of each of these elements are defined in §7.5 ‘Action Description Encoding and Consensus’ of the Zcash Protocol Specification 5.

+

The encodings of each of these elements are defined in §7.5 ‘Action Description Encoding and Consensus’ of the Zcash Protocol Specification 5.

Orchard-ZSA Asset Burn Description

An Orchard-ZSA Asset Burn description is encoded in a transaction as an instance of an AssetBurn type:

@@ -507,7 +520,7 @@ -

The encodings of each of these elements are defined in ZIP 226 6.

+

The encodings of each of these elements are defined in ZIP 226 7.

Issuance Action Description (IssueAction)

An issuance action, IssueAction, is the instance of issuing a specific Custom Asset, and contains the following fields:

@@ -625,6 +638,89 @@
+

OrchardZSA Fee Calculation

+

In addition to the parameters defined in the Fee calculation section of ZIP 317 11, the OrchardZSA protocol upgrade defines the following additional parameters:

+ + + + + + + + + + + + + +
ParameterValue
+ \(issuance\_fee\) + + \(100 \cdot marginal\_fee\) + per issuance action (as defined below)
+

Wallets implementing this specification SHOULD use a conventional fee, viz. + \(zsa\_conventional\_fee\) + , that is calculated in zatoshis. Additional definitions that are used in the formula for the calculation are in the table below:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
InputUnitsDescription
+ \(nOrchardActions\) + numberthe number of OrchardZSA transfer actions (including ZEC actions)
+ \(nTotalOutputsZsaIssuance\) + numberthe total number of OrchardZSA issuance outputs (added across issuance actions)
+ \(nCreateActions\) + numberthe number of OrchardZSA issuance actions that issue a Custom Asset that is not present in the Global Issuance State
+

The other inputs to this formula are taken from transaction fields defined in the Zcash protocol specification 6 and the global state. They are defined in the Fee calculation section of ZIP 317 11. Note that + \(nOrchardActions\) + , that is used in the computation of + \(logical\_actions\) + , is redefined in the above table, and now combines the actions for native ZEC as well as OrchardZSA transfer actions for Custom Assets.

+

The formula for the computation of the + \(zsa\_logical\_actions\) + (with the updated computation of + \(logical\_actions\) + as described above) is:

+
\(zsa\_logical\_actions = logical\_actions \;+ nTotalOutputsZsaIssuance\)
+

The formula for the computation of the + \(zsa\_conventional\_fee\) + is:

+
\(\begin{array}{rcl} + zsa\_conventional\_fee &=& marginal\_fee \cdot \mathsf{max}(grace\_actions, zsa\_logical\_actions) \;+ \\ + & & issuance\_fee \cdot nCreateActions +\end{array}\)
+

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 OrchardZSA Fee calculation

+

The OrchardZSA fee calculation accounts for the additions to the Global Issuance State that are required for the OrchardZSA protocol. Every newly created Custom Asset adds a new row to the Global Issuance State. Subsequent issuance, finalization, or burn of existing Custom Assets only changes the values in the corresponding row.

+

This explains the need for a higher fee for the creation of entirely new Custom Assets, in order to disincentivize the creation of "junk" assets.

+
+

OrchardZSA Fee Considerations

+

We choose to maintain the native ZEC Asset as the primary token for the Zcash blockchain, similar to how ETH is needed for ERC20 transactions to the benefit of the Ethereum ecosystem.

+

An alternative proposal for the OrchardZSA fee mechanism that was not adopted was to adopt a new type of fee, denominated in the custom Asset being issued or transferred. In the context of transparent transactions, such a fee allows miners to “tap into” the ZSA value of the transactions, rather than the ZEC value of transactions. However when transactions are shielded, any design that lifts value from the transaction would also leak information about it.

+
+

Reference implementation

TODO

@@ -669,10 +765,18 @@ - +
+ + + +
6Zcash Protocol Specification, Version 2022.3.8. Section 7.1: Transaction Encoding and Consensus
+ + + + @@ -680,7 +784,7 @@
7 ZIP 226: Transfer and Burn of Zcash Shielded Assets
- + @@ -688,11 +792,27 @@
78 ZIP 227: Issuance of Zcash Shielded Assets
- +
89 ZIP 244: Transaction Identifier Non-Malleability
+ + + + + + + +
10ZIP 317: Proportional Transfer Fee Mechanism
+ + + + + + + +
11ZIP 317: Proportional Transfer Fee Mechanism, Fee calculation
diff --git a/zips/zip-0230.rst b/zips/zip-0230.rst index 2bed2e300..90199da29 100644 --- a/zips/zip-0230.rst +++ b/zips/zip-0230.rst @@ -24,6 +24,14 @@ Terminology The key words "MUST", "SHOULD", and "MAY" in this document are to be interpreted as described in BCP 14 [#BCP14]_ when, and only when, they appear in all capitals. +The terms "Zcash Shielded Asset", "ZSA" and "Asset" in this document are to be interpreted as described in ZIP 226 [#zip-0226]_. + +The term "Issuance" and "Issuance Action" in this document are to be interpreted as described in ZIP 227 [#zip-0227]_. + +We define the following additional terms: + +- Issuance Fee: This is the specific fixed fee that has to be paid to the network for every given issuance action. + The character § is used when referring to sections of the Zcash Protocol Specification [#protocol]_. @@ -41,6 +49,10 @@ This ZIP also depends upon and defines modifications to the computation of the v **TxId Digest**, **Signature Digest**, and **Authorizing Data Commitment** defined by ZIP 244 [#zip-0244]_. +This ZIP additionally defines the fee mechanism associated with the Orchard Zcash Shielded Assets (OrchardZSA) protocol +as described in ZIP 226 [#zip-0226]_ and ZIP 227 [#zip-0227]_. +The fee mechanism is defined in terms of modifications to the Proportionak Transfer Fee Mechanism [#zip-0317]_. + Motivation ========== @@ -51,6 +63,15 @@ v5 and later serialized transaction formats are not consensus-critical. Thus, this ZIP defines format that can easily accommodate future extensions, where elements or a given pool are kept separate. +The upgrade to the OrchardZSA protocol will also need to define a fee structure consistent with the objectives of ZIP 317 [#zip-0317]_. +This involves adaptation for the transfer protocol [#zip-0226]_, as well as additional considerations for the issuance protocol [#zip-0227]_ such as fees for asset issuance. +Specifically, the OrchardZSA Transfer and Burn mechanism should follow the same fee mechanism in order to not discriminate between transfer bundle types. +When it comes to Issuance of ZSA, however, there should be a disincentive that will stop users from flooding the chain with useless asset identifiers. +In the case of Issuance, the computational power needed to verify the bundle is not large. +The transaction size, however, can be an issue as the number of output notes can be large. +Furthermore, as defined in ZIP 227 [#zip-0227]_, there is an additional data structure in the global state that needs to be maintained as part of the consensus. +This motivates further the addition of an Issuance-specific fee. + Requirements ============ @@ -66,6 +87,14 @@ newly incorporated elements except those that attest to transaction validity. The computation of the commitment to authorizing data for a transaction must include all newly incorporated elements that attest to transaction validity. +In addition to the requirements of ZIP 317 [#zip-0317]_, the fee mechanism for the OrchardZSA protocol should satisfy the following requirements: + +* 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. +* Users should be discouraged from issuing new “garbage” custom Assets. + The fee should reflect the cost of adding new data to the global state. + Non-requirements ================ @@ -363,6 +392,70 @@ An issuance note, ``IssueNote`` contains the following fields: | | | |protocol §3.2.1 'Note Plaintexts and Memo Fields'. | +-----------------------------+--------------------------+--------------------------------------+--------------------------------------------------------------------+ +OrchardZSA Fee Calculation +========================== + +In addition to the parameters defined in the Fee calculation section of ZIP 317 [#zip-0317-fee-calc]_, the OrchardZSA protocol upgrade defines the following additional parameters: + +===================================== ========================================================================== +Parameter Value +===================================== ========================================================================== +:math:`issuance\_fee` :math:`100 \cdot marginal\_fee` per issuance action (as defined below) +===================================== ========================================================================== + +Wallets implementing this specification SHOULD use a conventional fee, viz. :math:`zsa\_conventional\_fee`, that is +calculated in zatoshis. Additional definitions that are used in the formula for the calculation are in the table below: + +================================ ====== ==================================================================================================================== +Input Units Description +================================ ====== ==================================================================================================================== +:math:`nOrchardActions` number the number of OrchardZSA transfer actions (including ZEC actions) +:math:`nTotalOutputsZsaIssuance` number the total number of OrchardZSA issuance outputs (added across issuance actions) +:math:`nCreateActions` number the number of OrchardZSA issuance actions that issue a Custom Asset that is not present in the Global Issuance State +================================ ====== ==================================================================================================================== + +The other inputs to this formula are taken from transaction fields defined in the Zcash protocol specification [#protocol-txnencoding]_ and the global state. +They are defined in the Fee calculation section of ZIP 317 [#zip-0317-fee-calc]_. +Note that :math:`nOrchardActions`, that is used in the computation of :math:`logical\_actions`, is redefined in the above table, and now combines the actions for native ZEC as well as OrchardZSA transfer actions for Custom Assets. + +The formula for the computation of the :math:`zsa\_logical\_actions` (with the updated computation of :math:`logical\_actions` as described above) is: + +.. math:: + zsa\_logical\_actions = logical\_actions \;+ nTotalOutputsZsaIssuance + +The formula for the computation of the :math:`zsa\_conventional\_fee` is: + +.. math:: + \begin{array}{rcl} + zsa\_conventional\_fee &=& marginal\_fee \cdot \mathsf{max}(grace\_actions, zsa\_logical\_actions) \;+ \\ + & & issuance\_fee \cdot nCreateActions + \end{array} + + + + +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 OrchardZSA Fee calculation +---------------------------------------- + +The OrchardZSA fee calculation accounts for the additions to the Global Issuance State that are required for the OrchardZSA protocol. +Every newly created Custom Asset adds a new row to the Global Issuance State. +Subsequent issuance, finalization, or burn of existing Custom Assets only changes the values in the corresponding row. + +This explains the need for a higher fee for the creation of entirely new Custom Assets, in order to disincentivize the creation of "junk" assets. + +OrchardZSA Fee Considerations +----------------------------- + +We choose to maintain the native ZEC Asset as the primary token for the Zcash blockchain, similar to how ETH is needed for ERC20 transactions to the benefit of the Ethereum ecosystem. + +An alternative proposal for the OrchardZSA fee mechanism that was not adopted was to adopt a new type of fee, denominated in the custom Asset being issued or transferred. +In the context of transparent transactions, such a fee allows miners to “tap into” the ZSA value of the transactions, rather than the ZEC value of transactions. +However when transactions are shielded, any design that lifts value from the transaction would also leak information about it. + Reference implementation ======================== @@ -378,6 +471,9 @@ References .. [#protocol-spenddesc] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 4.4: Spend Descriptions `_ .. [#protocol-outputdesc] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 4.5: Output Descriptions `_ .. [#protocol-actiondesc] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 4.6: Action Descriptions `_ +.. [#protocol-txnencoding] `Zcash Protocol Specification, Version 2022.3.8. Section 7.1: Transaction Encoding and Consensus `_ .. [#zip-0226] `ZIP 226: Transfer and Burn of Zcash Shielded Assets `_ .. [#zip-0227] `ZIP 227: Issuance of Zcash Shielded Assets `_ .. [#zip-0244] `ZIP 244: Transaction Identifier Non-Malleability `_ +.. [#zip-0317] `ZIP 317: Proportional Transfer Fee Mechanism `_ +.. [#zip-0317-fee-calc] `ZIP 317: Proportional Transfer Fee Mechanism, Fee calculation `_