ZIPs 226, 227 and 230: regenerate HTML.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira-Emma Hopwood 2024-02-07 18:43:35 +00:00
parent 406b7e86d9
commit 21cf12456a
5 changed files with 2375 additions and 13 deletions

View File

@ -107,10 +107,10 @@ Index of ZIPs
<tr> <td>222</td> <td class="left"><a href="zip-0222.rst">Transparent Zcash Extensions</a></td> <td>Draft</td>
<tr> <td>224</td> <td class="left"><a href="zip-0224.rst">Orchard Shielded Protocol</a></td> <td>Final</td>
<tr> <td>225</td> <td class="left"><a href="zip-0225.rst">Version 5 Transaction Format</a></td> <td>Final</td>
<tr> <td><span class="reserved">226</span></td> <td class="left"><a class="reserved" href="zip-0226.rst">Transfer and Burn of Zcash Shielded Assets</a></td> <td>Reserved</td>
<tr> <td><span class="reserved">227</span></td> <td class="left"><a class="reserved" href="zip-0227.rst">Issuance of Zcash Shielded Assets</a></td> <td>Reserved</td>
<tr> <td>226</td> <td class="left"><a href="zip-0226.rst">Transfer and Burn of Zcash Shielded Assets</a></td> <td>Draft</td>
<tr> <td>227</td> <td class="left"><a href="zip-0227.rst">Issuance of Zcash Shielded Assets</a></td> <td>Draft</td>
<tr> <td><span class="reserved">228</span></td> <td class="left"><a class="reserved" href="zip-0228.rst">Asset Swaps for Zcash Shielded Assets</a></td> <td>Reserved</td>
<tr> <td><span class="reserved">230</span></td> <td class="left"><a class="reserved" href="zip-0230.rst">Version 6 Transaction Format</a></td> <td>Reserved</td>
<tr> <td>230</td> <td class="left"><a href="zip-0230.rst">Version 6 Transaction Format</a></td> <td>Draft</td>
<tr> <td><span class="reserved">231</span></td> <td class="left"><a class="reserved" href="zip-0231.rst">Decouple Memos from Transaction Outputs</a></td> <td>Reserved</td>
<tr> <td>239</td> <td class="left"><a href="zip-0239.rst">Relay of Version 5 Transactions</a></td> <td>Final</td>
<tr> <td>243</td> <td class="left"><a href="zip-0243.rst">Transaction Signature Validation for Sapling</a></td> <td>Final</td>

View File

@ -22,7 +22,7 @@
<p>Participation in the Zcash project is subject to a <a href="https://github.com/zcash/zcash/blob/master/code_of_conduct.md">Code of Conduct</a>.</p>
<p>The Zcash protocol is documented in its <a href="protocol/protocol.pdf">Protocol Specification</a>.</p>
<p>To start contributing, first read <a href="zip-0000">ZIP 0</a> which documents the ZIP process. Then clone <a href="https://github.com/zcash/zips">this repo</a> from GitHub, and start adding your draft ZIP, formatted either as reStructuredText or as Markdown.</p>
<p>For example, if using reStructuredText, use a filename matching <code>draft-*.rst</code>. Use <code>make</code> to check that you are using correct <a href="https://docutils.sourceforge.io/rst.html">reStructuredText</a> or <a href="https://pandoc.org/MANUAL.html#pandocs-markdown">Markdown</a> syntax, and double-check the generated <code>draft-*.html</code> file before filing a Pull Request.</p>
<p>For example, if using reStructuredText, use a filename matching <code>draft-*.rst</code>. Use <code>make</code> to check that you are using correct <a href="https://docutils.sourceforge.io/rst.html">reStructuredText</a> or <a href="https://pandoc.org/MANUAL.html#pandocs-markdown">Markdown</a> syntax, and double-check the generated <code>draft-*.html</code> file before filing a Pull Request. See <a href="protocol/README">here</a> for the project dependencies.</p>
</section>
<section id="nu5-zips"><h2><span class="section-heading">NU5 ZIPs</span><span class="section-anchor"> <a rel="bookmark" href="#nu5-zips"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This is the list of ZIPs relevant to the NU5 Upgrade, which <a href="https://z.cash/upgrade/nu5/">activated on 31st May 2022</a>:</p>
@ -81,10 +81,10 @@
<tr> <td>222</td> <td class="left"><a href="zip-0222">Transparent Zcash Extensions</a></td> <td>Draft</td>
<tr> <td>224</td> <td class="left"><a href="zip-0224">Orchard Shielded Protocol</a></td> <td>Final</td>
<tr> <td>225</td> <td class="left"><a href="zip-0225">Version 5 Transaction Format</a></td> <td>Final</td>
<tr> <td><span class="reserved">226</span></td> <td class="left"><a class="reserved" href="zip-0226">Transfer and Burn of Zcash Shielded Assets</a></td> <td>Reserved</td>
<tr> <td><span class="reserved">227</span></td> <td class="left"><a class="reserved" href="zip-0227">Issuance of Zcash Shielded Assets</a></td> <td>Reserved</td>
<tr> <td>226</td> <td class="left"><a href="zip-0226">Transfer and Burn of Zcash Shielded Assets</a></td> <td>Draft</td>
<tr> <td>227</td> <td class="left"><a href="zip-0227">Issuance of Zcash Shielded Assets</a></td> <td>Draft</td>
<tr> <td><span class="reserved">228</span></td> <td class="left"><a class="reserved" href="zip-0228">Asset Swaps for Zcash Shielded Assets</a></td> <td>Reserved</td>
<tr> <td><span class="reserved">230</span></td> <td class="left"><a class="reserved" href="zip-0230">Version 6 Transaction Format</a></td> <td>Reserved</td>
<tr> <td>230</td> <td class="left"><a href="zip-0230">Version 6 Transaction Format</a></td> <td>Draft</td>
<tr> <td><span class="reserved">231</span></td> <td class="left"><a class="reserved" href="zip-0231">Decouple Memos from Transaction Outputs</a></td> <td>Reserved</td>
<tr> <td>239</td> <td class="left"><a href="zip-0239">Relay of Version 5 Transactions</a></td> <td>Final</td>
<tr> <td>243</td> <td class="left"><a href="zip-0243">Transaction Signature Validation for Sapling</a></td> <td>Final</td>

View File

@ -3,6 +3,7 @@
<head>
<title>ZIP 226: Transfer and Burn of Zcash Shielded Assets</title>
<meta charset="utf-8" />
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js?config=TeX-AMS-MML_HTMLorMML"></script>
<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"></head>
<body>
<section>
@ -15,10 +16,784 @@ Owners: Pablo Kogan &lt;pablo@qed-it.com&gt;
Credits: Daniel Benarroch
Aurelien Nicolas
Deirdre Connolly
Status: Reserved
Teor
Status: Draft
Category: Consensus
Created: 2022-05-01
License: MIT
Discussions-To: &lt;<a href="https://github.com/zcash/zips/issues/618">https://github.com/zcash/zips/issues/618</a>&gt;
Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/649">https://github.com/zcash/zips/pull/649</a>&gt;</pre>
Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/680">https://github.com/zcash/zips/pull/680</a>&gt;</pre>
<section id="terminology"><h2><span class="section-heading">Terminology</span><span class="section-anchor"> <a rel="bookmark" href="#terminology"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The key word "MUST" in this document is to be interpreted as described in BCP 14 <a id="footnote-reference-1" class="footnote_reference" href="#bcp14">1</a> when, and only when, it appears in all capitals.</p>
<p>The term "network upgrade" in this document is to be interpreted as described in ZIP 200 <a id="footnote-reference-2" class="footnote_reference" href="#zip-0200">2</a>.</p>
<p>The terms "Orchard" and "Action" in this document are to be interpreted as described in ZIP 224 <a id="footnote-reference-3" class="footnote_reference" href="#zip-0224">4</a>.</p>
<p>The terms "Asset", "Custom Asset" and "Wrapped Asset" in this document are to be interpreted as described in ZIP 227 <a id="footnote-reference-4" class="footnote_reference" href="#zip-0227">5</a>.</p>
<p>We define the following additional terms:</p>
<ul>
<li>Split Input: an Action input used to ensure that the output note of that Action is of a validly issued
<span class="math">\(\mathsf{AssetBase}\)</span>
(see <a id="footnote-reference-5" class="footnote_reference" href="#zip-0227-assetidentifier">6</a>) when there is no corresponding real input note, in situations where the number of outputs are larger than the number of inputs. See formal definition in <a href="#split-notes">Split Notes</a>.</li>
<li>Split Action: an Action that contains a Split Input.</li>
</ul>
</section>
<section id="abstract"><h2><span class="section-heading">Abstract</span><span class="section-anchor"> <a rel="bookmark" href="#abstract"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This ZIP (ZIP 226) proposes the Zcash Shielded Assets (ZSA) protocol, in conjunction with ZIP 227 <a id="footnote-reference-6" class="footnote_reference" href="#zip-0227">5</a>. The ZSA protocol is an extension of the Orchard protocol that enables the issuance, transfer and burn of custom Assets on the Zcash chain. The issuance of such Assets is defined in ZIP 227 <a id="footnote-reference-7" class="footnote_reference" href="#zip-0227">5</a>, while the transfer and burn of such Assets is defined in this ZIP (ZIP 226). While the proposed ZSA protocol is a modification to the Orchard protocol, it has been designed with adaptation to possible future shielded protocols in mind.</p>
</section>
<section id="motivation"><h2><span class="section-heading">Motivation</span><span class="section-anchor"> <a rel="bookmark" href="#motivation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>None of the currently deployed Zcash transfer protocols support Custom Assets. Enabling multi-asset support on the Zcash chain will open the door for a host of applications, and enhance the ecosystem with application developers and Asset custody institutions for issuance and bridging purposes. This ZIP builds on the issuance mechanism introduced in ZIP 227 <a id="footnote-reference-8" class="footnote_reference" href="#zip-0227">5</a>.</p>
</section>
<section id="overview"><h2><span class="section-heading">Overview</span><span class="section-anchor"> <a rel="bookmark" href="#overview"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>In order to be able to represent different Assets, we need to define a data field that uniquely represents the Asset in question, which we call the Asset Identifier
<span class="math">\(\mathsf{AssetId}\!\)</span>
. This Asset Identifier maps to an Asset Base
<span class="math">\(\mathsf{AssetBase}\)</span>
that is stored in Orchard-based ZSA notes. These terms are formally defined in ZIP 227 <a id="footnote-reference-9" class="footnote_reference" href="#zip-0227">5</a>.</p>
<p>The Asset Identifier (via means of the Asset Digest and Asset Base) will be used to enforce that the balance of an Action Description <a id="footnote-reference-10" class="footnote_reference" href="#protocol-actions">15</a> <a id="footnote-reference-11" class="footnote_reference" href="#protocol-actionencodingandconsensus">28</a> is preserved across Assets (see the Orchard Binding Signature <a id="footnote-reference-12" class="footnote_reference" href="#protocol-orchardbalance">18</a>), and by extension the balance of an Orchard transaction. That is, the sum of all the
<span class="math">\(\mathsf{value^{net}}\)</span>
from each Action Description, computed as
<span class="math">\(\mathsf{value^{old}} - \mathsf{value^{new}}\!\)</span>
, must be balanced <strong>only with respect to the same Asset Identifier</strong>. This is especially important since we will allow different Action Descriptions to transfer notes of different Asset Identifiers, where the overall balance is checked without revealing which (or how many distinct) Assets are being transferred.</p>
<p>As was initially proposed by Jack Grigg and Daira-Emma Hopwood <a id="footnote-reference-13" class="footnote_reference" href="#initial-zsa-issue">29</a> <a id="footnote-reference-14" class="footnote_reference" href="#generalized-value-commitments">30</a>, we propose to make this happen by changing the value base point,
<span class="math">\(\mathcal{V}^{\mathsf{Orchard}}\!\)</span>
, in the Homomorphic Pedersen Commitment that derives the value commitment,
<span class="math">\(\mathsf{cv^{net}}\!\)</span>
, of the <em>net value</em> in an Orchard Action.</p>
<p>Because in a single transaction all value commitments are balanced, there must be as many different value base points as there are Asset Identifiers for a given shielded protocol used in a transaction. We propose to make the Asset Base an auxiliary input to the proof for each Action statement <a id="footnote-reference-15" class="footnote_reference" href="#protocol-actionstatement">20</a>, represented already as a point on the Pallas curve. The circuit then should check that the same Asset Base is used in the old note commitment and the new note commitment <a id="footnote-reference-16" class="footnote_reference" href="#protocol-concretesinsemillacommit">25</a>, <strong>and</strong> as the base point in the value commitment <a id="footnote-reference-17" class="footnote_reference" href="#protocol-concretehomomorphiccommit">24</a>. This ensures (1) that the input and output notes are of the same Asset Base, and (2) that only Actions with the same Asset Base will balance out in the Orchard binding signature.</p>
<p>In order to ensure the security of the transfers, and as we will explain below, we are redefining input dummy notes <a id="footnote-reference-18" class="footnote_reference" href="#protocol-orcharddummynotes">17</a> for Custom Assets, as we need to enforce that the
<span class="math">\(\mathsf{AssetBase}\)</span>
of the output note of that Split Action is the output of a valid
<span class="math">\(\mathsf{ZSAValueBase}\)</span>
computation defined in ZIP 227 <a id="footnote-reference-19" class="footnote_reference" href="#zip-0227">5</a>.</p>
<p>We include the ability to pause the ZSA functionality, via a
<span class="math">\(\mathsf{enableZSA}\)</span>
boolean flag. When this flag is set to false, it is not possible to perform transactions involving Custom Assets (the Action statement as modified for ZSAs will not be satisfied).</p>
<p>Finally, in this ZIP we also describe the <em>burn</em> mechanism, which is a direct extension of the transfer mechanism. The burn process uses a similar mechanism to what is used in Orchard to unshield ZEC, by using the
<span class="math">\(\mathsf{valueBalance}\)</span>
of the Asset in question. Burning Assets is useful for many purposes, including bridging of Wrapped Assets and removing supply of Assets.</p>
</section>
<section id="specification"><h2><span class="section-heading">Specification</span><span class="section-anchor"> <a rel="bookmark" href="#specification"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>Most of the protocol is kept the same as the Orchard protocol released with NU5, except for the following.</p>
<section id="asset-identifiers"><h3><span class="section-heading">Asset Identifiers</span><span class="section-anchor"> <a rel="bookmark" href="#asset-identifiers"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>For every new Asset, there must be a new and unique Asset Identifier. Every Asset is defined by an <em>Asset description</em>,
<span class="math">\(\mathsf{asset\_desc}\!\)</span>
, which is a global byte string (scoped across all future versions of Zcash). From this Asset description and the issuance validating key of the issuer, the specific Asset Identifier,
<span class="math">\(\mathsf{AssetId}\!\)</span>
, the Asset Digest, and the Asset Base (
<span class="math">\(\mathsf{AssetBase}\!\)</span>
) are derived as defined in ZIP 227 <a id="footnote-reference-20" class="footnote_reference" href="#zip-0227">5</a>.</p>
<p>This Asset Base will be the base point of the value commitment for the specific Custom Asset. Note that the Asset Base of the ZEC Asset will be kept as the original value base point,
<span class="math">\(\mathcal{V}^{\mathsf{Orchard}}\!\)</span>
.</p>
<section id="rationale-for-asset-identifiers"><h4><span class="section-heading">Rationale for Asset Identifiers</span><span class="section-anchor"> <a rel="bookmark" href="#rationale-for-asset-identifiers"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>In future network and protocol upgrades, the same Asset description string can be carried on, potentially mapping into a different shielded pool. In that case, nodes should know how to transform the Asset Identifier, the Asset Digest, and the Asset Base from one shielded pool to another, while ensuring there are no balance violations <a id="footnote-reference-21" class="footnote_reference" href="#zip-0209">3</a>.</p>
</section>
</section>
<section id="note-structure-commitment"><h3><span class="section-heading">Note Structure &amp; Commitment</span><span class="section-anchor"> <a rel="bookmark" href="#note-structure-commitment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>Let
<span class="math">\(\mathsf{Note^{OrchardZSA}}\)</span>
be the type of a ZSA note, i.e.
<span class="math">\(\mathsf{Note^{OrchardZSA}} := \mathsf{Note^{Orchard}} \times \mathbb{P}^*\!\)</span>
.</p>
<p>An Orchard ZSA note differs from an Orchard note <a id="footnote-reference-22" class="footnote_reference" href="#protocol-notes">14</a> by additionally including the Asset Base,
<span class="math">\(\mathsf{AssetBase}\!\)</span>
. So a ZSA note is a tuple
<span class="math">\((\mathsf{g_d}, \mathsf{pk_d}, \mathsf{v}, \text{ρ}, \text{ψ}, \mathsf{AssetBase})\!\)</span>
, where</p>
<ul>
<li>
<span class="math">\(\mathsf{AssetBase} : \mathbb{P}^*\)</span>
is the unique element of the Pallas group <a id="footnote-reference-23" class="footnote_reference" href="#protocol-pallasandvesta">26</a> that identifies each Asset in the Orchard protocol, defined as the Asset Base in ZIP 227 <a id="footnote-reference-24" class="footnote_reference" href="#zip-0227">5</a>, a valid group element that is not the identity and is not
<span class="math">\(\bot\!\)</span>
. The byte representation of the Asset Base is defined as
<span class="math">\(\mathsf{asset\_base} : \mathbb{B}^{[\ell_{\mathbb{P}}]} := \mathsf{repr}_{\mathbb{P}}(\mathsf{AssetBase})\!\)</span>
.</li>
</ul>
<p>Note that the above assumes a canonical encoding, which is true for the Pallas group, but may not hold for future shielded protocols.</p>
<p>We define the note commitment scheme
<span class="math">\(\mathsf{NoteCommit^{OrchardZSA}_{rcm}}\)</span>
as follows:</p>
<div class="math">\(\mathsf{NoteCommit}^{\mathsf{OrchardZSA}} : \mathsf{NoteCommit}^{\mathsf{Orchard}}.\!\mathsf{Trapdoor} \times \mathbb{B}^{[\ell_{\mathbb{P}}]} \times \mathbb{B}^{[\ell_{\mathbb{P}}]} \times \{0 .. 2^{\ell_{\mathsf{value}}} - 1\} \times \mathbb{F}_{q_{\mathbb{P}}} \times \mathbb{F}_{q_{\mathbb{P}}} \times \mathbb{P}^* \to \mathsf{NoteCommit}^{\mathsf{Orchard}}.\!\mathsf{Output}\)</div>
<p>where
<span class="math">\(\mathbb{P}, \ell_{\mathbb{P}}, q_{\mathbb{P}}\)</span>
are as defined for the Pallas curve <a id="footnote-reference-25" class="footnote_reference" href="#protocol-pallasandvesta">26</a>, and where
<span class="math">\(\mathsf{NoteCommit^{Orchard}}.\!\mathsf{Trapdoor}\)</span>
and
<span class="math">\(\mathsf{Orchard}.\!\mathsf{Output}\)</span>
are as defined in the Zcash protocol specification <a id="footnote-reference-26" class="footnote_reference" href="#protocol-abstractcommit">16</a>. This note commitment scheme is instantiated using the Sinsemilla Commitment <a id="footnote-reference-27" class="footnote_reference" href="#protocol-concretesinsemillacommit">25</a> as follows:</p>
<div class="math">\(\begin{align}
\mathsf{NoteCommit^{OrchardZSA}_{rcm}}(\mathsf{g_d}\star, \mathsf{pk_d}\star, \mathsf{v}, \text{ρ}, \text{ψ}, \mathsf{AssetBase})
:= \begin{cases}
\mathsf{NoteCommit^{Orchard}_{rcm}}(\mathsf{g_d}\star, \mathsf{pk_d}\star, \mathsf{v}, \text{ρ}, \text{ψ}), &amp;\text{if } \mathsf{AssetBase} = \mathcal{V}^{\mathsf{Orchard}} \\
\mathsf{cm_{ZSA}} &amp;\text{otherwise}
\end{cases}
\end{align}\)</div>
<p>where:</p>
<div class="math">\(\begin{align}
\mathsf{cm_{ZSA}} :=&amp;\;\;\mathsf{SinsemillaHashToPoint}(\texttt{"z.cash:ZSA-NoteCommit-M"}, \\
&amp;\;\;\;\;\;\mathsf{g_{d}\star} \,||\, \mathsf{pk_{d}\star} \,||\, \mathsf{I2LEBSP_{64}(v)} \,||\, \mathsf{I2LEBSP}_{\ell^{\mathsf{Orchard}}_{\mathsf{base}}}(\text{ρ}) \,||\, \mathsf{I2LEBSP}_{\ell^{\mathsf{Orchard}}_{\mathsf{base}}}(\text{ψ}) \,||\, \mathsf{asset\_base}) \\
&amp;\;\;+\;\;[\mathsf{rcm}]\,\mathsf{GroupHash}^{\mathbb{P}}(\texttt{"z.cash:Orchard-NoteCommit-r"}, \texttt{""})
\end{align}\)</div>
<p>Note that
<span class="math">\(\mathsf{repr}_{\mathbb{P}}\)</span>
and
<span class="math">\(\mathsf{GroupHash}^{\mathbb{P}}\)</span>
are as defined for the Pallas curve <a id="footnote-reference-28" class="footnote_reference" href="#protocol-pallasandvesta">26</a>,
<span class="math">\(\ell^{\mathsf{Orchard}}_{\mathsf{base}}\)</span>
is as defined in §5.3 <a id="footnote-reference-29" class="footnote_reference" href="#protocol-constants">22</a>, and
<span class="math">\(\mathsf{I2LEBSP}\)</span>
is as defined in §5.1 <a id="footnote-reference-30" class="footnote_reference" href="#protocol-endian">21</a> of the Zcash protocol specification.</p>
<p>The nullifier is generated in the same manner as in the Orchard protocol <a id="footnote-reference-31" class="footnote_reference" href="#protocol-commitmentsandnullifiers">19</a>.</p>
<p>The ZSA note plaintext also includes the Asset Base in addition to the components in the Orchard note plaintext <a id="footnote-reference-32" class="footnote_reference" href="#protocol-notept">27</a>. It consists of</p>
<div class="math">\((\mathsf{leadByte} : \mathbb{B}^{\mathbb{Y}}, \mathsf{d} : \mathbb{B}^{[\ell_{\mathsf{d}}]}, \mathsf{v} : \{0 .. 2^{\ell_{\mathsf{value}}} - 1\}, \mathsf{rseed} : \mathbb{B}^{\mathbb{Y}[32]}, \mathsf{asset\_base} : \mathbb{B}^{[\ell_{\mathbb{P}}]}, \mathsf{memo} : \mathbb{B}^{\mathbb{Y}[512]})\)</div>
<section id="rationale-for-note-commitment"><h4><span class="section-heading">Rationale for Note Commitment</span><span class="section-anchor"> <a rel="bookmark" href="#rationale-for-note-commitment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>In the ZSA protocol, the instance of the note commitment scheme,
<span class="math">\(\mathsf{NoteCommit^{OrchardZSA}_{rcm}}\!\)</span>
, differs from the Orchard note commitment
<span class="math">\(\mathsf{NoteCommit^{Orchard}_{rcm}}\)</span>
in that for Custom Assets, the Asset Base will be added as an input to the commitment computation. In the case where the Asset is the ZEC Asset, the commitment is computed identically to the Orchard note commitment, without making use of the ZEC Asset Base as an input. As we will see, the nested structure of the Sinsemilla-based commitment <a id="footnote-reference-33" class="footnote_reference" href="#protocol-concretesinsemillacommit">25</a> allows us to add the Asset Base as a final recursive step.</p>
<p>The note commitment output is still indistinguishable from the original Orchard ZEC note commitments, by definition of the Sinsemilla hash function <a id="footnote-reference-34" class="footnote_reference" href="#protocol-concretesinsemillahash">23</a>. ZSA note commitments will therefore be added to the same Orchard Note Commitment Tree. In essence, we have:</p>
<div class="math">\(\mathsf{NoteCommit^{OrchardZSA}_{rcm}}(\mathsf{repr}_{\mathbb{P}}(\mathsf{g_d}), \mathsf{repr}_{\mathbb{P}}(\mathsf{pk_d}), \mathsf{v}, \text{ρ}, \text{ψ}, \mathsf{AssetBase}) \in \mathsf{NoteCommit^{Orchard}}.\!\mathsf{Output}\)</div>
<p>This definition can be viewed as a generalization of the Orchard note commitment, and will allow maintaining a single commitment instance for the note commitment, which will be used both for pre-ZSA Orchard and ZSA notes.</p>
</section>
</section>
<section id="value-commitment"><h3><span class="section-heading">Value Commitment</span><span class="section-anchor"> <a rel="bookmark" href="#value-commitment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>In the case of the Orchard-based ZSA protocol, the value of different Asset Identifiers in a given transaction will be committed using a <strong>different value base point</strong>. The value commitment becomes:</p>
<div class="math">\(\mathsf{cv^{net}} := \mathsf{ValueCommit^{OrchardZSA}_{rcv}}(\mathsf{AssetBase_{AssetId}}, \mathsf{v^{net}_{AssetId}}) = [\mathsf{v^{net}_{AssetId}}]\,\mathsf{AssetBase_{AssetId}} + [\mathsf{rcv}]\,\mathcal{R}^{\mathsf{Orchard}}\)</div>
<p>where
<span class="math">\(\mathsf{v^{net}_{AssetId}} = \mathsf{v^{old}_{AssetId}} - \mathsf{v^{new}_{AssetId}}\)</span>
such that
<span class="math">\(\mathsf{v^{old}_{AssetId}}\)</span>
and
<span class="math">\(\mathsf{v^{new}_{AssetId}}\)</span>
are the values of the old and new notes of Asset Identifier
<span class="math">\(\mathsf{AssetId}\)</span>
respectively,</p>
<p id="asset-base">
<span class="math">\(\mathsf{AssetBase_{AssetId}}\)</span>
is defined in ZIP 227 <a id="footnote-reference-35" class="footnote_reference" href="#zip-0227">5</a>, and</p>
<p>
<span class="math">\(\mathcal{R}^{\mathsf{Orchard}} := \mathsf{GroupHash^{\mathbb{P}}}(\texttt{"z.cash:Orchard-cv"}, \texttt{"r"})\!\)</span>
, as in the Orchard protocol.</p>
<p>For ZEC, we define
<span class="math">\(\mathsf{AssetBase}_{\mathsf{AssetId}} := \mathcal{V}^{\mathsf{Orchard}}\)</span>
so that the value commitment for ZEC notes is computed identically to the Orchard protocol deployed in NU5 <a id="footnote-reference-36" class="footnote_reference" href="#zip-0224">4</a>. As such
<span class="math">\(\mathsf{ValueCommit^{Orchard}_{rcv}}(\mathsf{v})\)</span>
as defined in <a id="footnote-reference-37" class="footnote_reference" href="#zip-0224">4</a> is used as
<span class="math">\(\mathsf{ValueCommit^{OrchardZSA}_{rcv}}(\mathcal{V}^{\mathsf{Orchard}}, \mathsf{v})\)</span>
here.</p>
<section id="rationale-for-value-commitment"><h4><span class="section-heading">Rationale for Value Commitment</span><span class="section-anchor"> <a rel="bookmark" href="#rationale-for-value-commitment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>The Orchard Protocol uses a Homomorphic Pedersen Commitment <a id="footnote-reference-38" class="footnote_reference" href="#protocol-concretehomomorphiccommit">24</a> to perform the value commitment, with fixed base points
<span class="math">\(\mathcal{V}^{\mathsf{Orchard}}\)</span>
and
<span class="math">\(\mathcal{R}^{\mathsf{Orchard}}\)</span>
as the values represent the amount of ZEC being transferred.</p>
<p>The use of different value base points for different Assets enables the final balance of the transaction to be securely computed, such that each Asset Identifier is balanced independently, which is required as different Assets are not meant to be mutually fungible.</p>
</section>
</section>
<section id="burn-mechanism"><h3><span class="section-heading">Burn Mechanism</span><span class="section-anchor"> <a rel="bookmark" href="#burn-mechanism"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The burn mechanism is a transparent extension to the transfer protocol that enables a specific amount of any Asset Identifier to be "destroyed". The burn mechanism does NOT send Assets to a non-spendable address, it simply reduces the total number of units of a given Custom Asset in circulation at the consensus level. It is enforced at the consensus level, by using an extension of the value balance mechanism used for ZEC Assets. Burning makes it globally provable that a given amount of an Asset has been destroyed.</p>
<p>The sender includes a
<span class="math">\(\mathsf{v_{AssetId}}\)</span>
variable for every Asset Identifier that is being burnt, which represents the amount of that Asset being burnt. As described in the <a href="#orchard-zsa-transaction-structure">Orchard-ZSA Transaction Structure</a>, this is separate from the regular
<span class="math">\(\mathsf{valueBalance^{Orchard}}\)</span>
that is the default transparent value for the ZEC Asset, and represents either the transaction fee, or the amount of ZEC changing pools (e.g. to Sapling or Transparent).</p>
<p>For every Custom Asset that is burnt, we add to the
<span class="math">\(\mathsf{assetBurn}\)</span>
set the tuple
<span class="math">\((\mathsf{AssetBase_{AssetId}}, \mathsf{v_{AssetId}})\)</span>
such that the validator of the transaction can compute the value commitment with the corresponding value base point of that Asset. This ensures that the values are all balanced out with respect to the Asset Identifiers in the transfer.</p>
<div class="math">\(\mathsf{assetBurn} := \{ (\mathsf{AssetBase}_{\mathsf{AssetId}} : \mathbb{P}^*, \mathsf{v_{AssetId}} : \{1 .. 2^{\ell_{\mathsf{value}}} - 1\}) \,|\, \mathsf{AssetId} \in \mathsf{AssetIdsToBurn} \}\)</div>
<p>We denote by
<span class="math">\(L\)</span>
the cardinality of the
<span class="math">\(\mathsf{assetBurn}\)</span>
set.</p>
<section id="additional-consensus-rules"><h4><span class="section-heading">Additional Consensus Rules</span><span class="section-anchor"> <a rel="bookmark" href="#additional-consensus-rules"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<ol type="1">
<li>We require that for every
<span class="math">\((\mathsf{AssetBase_{AssetId}}, \mathsf{v_{AssetId}}) \in \mathsf{assetBurn}, \mathsf{AssetBase_{AssetId}} \neq \mathcal{V}^{\mathsf{Orchard}}\!\)</span>
. That is, ZEC or TAZ is not allowed to be burnt by this mechanism.</li>
<li>We require that for every
<span class="math">\((\mathsf{AssetBase_{AssetId}}, \mathsf{v_{AssetId}}) \in \mathsf{assetBurn}, \mathsf{v_{AssetId}} \neq 0\!\)</span>
.</li>
<li>We require that there be no duplication of Custom Assets in the
<span class="math">\(\mathsf{assetBurn}\)</span>
set. That is, every
<span class="math">\(\mathsf{AssetBase_{AssetId}}\)</span>
has at most one entry in
<span class="math">\(\mathsf{assetBurn}\!\)</span>
.</li>
</ol>
<p><strong>Note:</strong> Even if this mechanism allows having transparent ↔ shielded Asset transfers in theory, the transparent protocol will not be changed with this ZIP to adapt to a multiple Asset structure. This means that unless future consensus rules changes do allow it, unshielding will not be possible for Custom Assets.</p>
</section>
</section>
<section id="value-balance-verification"><h3><span class="section-heading">Value Balance Verification</span><span class="section-anchor"> <a rel="bookmark" href="#value-balance-verification"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>In order to verify the balance of the different Assets, the verifier MUST perform a similar process as for the Orchard protocol <a id="footnote-reference-39" class="footnote_reference" href="#protocol-orchardbalance">18</a>, with the addition of the burn information.</p>
<p>For a total of
<span class="math">\(n\)</span>
Actions in a transfer, the prover MUST still sign the SIGHASH transaction hash using the binding signature key
<span class="math">\(\mathsf{bsk} = \sum_{i=1}^{n} \mathsf{rcv}_i\!\)</span>
.</p>
<p>The verifier MUST compute the value balance verification equation:</p>
<div class="math">\(\mathsf{bvk} = (\sum_{i=1}^{n} \mathsf{cv}^{\mathsf{net}}_i) - \mathsf{ValueCommit_0^{OrchardZSA}(\mathcal{V}^{\mathsf{Orchard}}, v^{balanceOrchard})} - \sum_{(\mathsf{AssetBase}, \mathsf{v}) \in \mathsf{assetBurn}} \mathsf{ValueCommit_0^{OrchardZSA}}(\mathsf{AssetBase}, \mathsf{v})\)</div>
<p>After computing
<span class="math">\(\mathsf{bvk}\!\)</span>
, the verifier MUST use it to verify the binding signature on the SIGHASH transaction hash.</p>
<section id="rationale-for-value-balance-verification"><h4><span class="section-heading">Rationale for Value Balance Verification</span><span class="section-anchor"> <a rel="bookmark" href="#rationale-for-value-balance-verification"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>We assume
<span class="math">\(n\)</span>
Actions in a transfer. Out of these
<span class="math">\(n\)</span>
Actions, we further distinguish (for the sake of clarity) between Actions related to ZEC and Actions related to Custom Assets. We denote by
<span class="math">\(S_{\mathsf{ZEC}} \subseteq \{1 .. n\}\)</span>
the set of indices of Actions that are related to ZEC, and by
<span class="math">\(S_{\mathsf{CA}} = \{1 .. n\} \setminus S_{\mathsf{ZEC}}\)</span>
the set of indices of Actions that are related to Custom Assets.</p>
<p>The right hand side of the value balance verification equation can be expanded to:</p>
<div class="math">\(((\sum_{i \in S_{\mathsf{ZEC}}} \mathsf{cv}^{\mathsf{net}}_i) + (\sum_{j \in S_{\mathsf{CA}}} \mathsf{cv}^{\mathsf{net}}_j)) - ([\mathsf{v^{balanceOrchard}}]\,\mathcal{V}^{\mathsf{Orchard}} + [0]\,\mathcal{R}^{\mathsf{Orchard}}) - (\sum_{(\mathsf{AssetBase}, \mathsf{v}) \in \mathsf{assetBurn}} [\mathsf{v}]\,\mathsf{AssetBase} + [0]\,\mathcal{R}^{\mathsf{Orchard}})\)</div>
<p>This equation contains the balance check of the Orchard protocol <a id="footnote-reference-40" class="footnote_reference" href="#protocol-orchardbalance">18</a>. With ZSA, transfer Actions for Custom Assets must also be balanced across Asset Bases. All Custom Assets are contained within the shielded pool, and cannot be unshielded via a regular transfer. Custom Assets can be burnt, the mechanism for which reveals the amount and identifier of the Asset being burnt, within the
<span class="math">\(\mathsf{assetBurn}\)</span>
set. As such, for a correctly constructed transaction, we will get
<span class="math">\(\sum_{j \in S_{\mathsf{CA}}} \mathsf{cv}^{\mathsf{net}}_j - \sum_{(\mathsf{AssetBase}, \mathsf{v}) \in \mathsf{assetBurn}} [\mathsf{v}]\,\mathsf{AssetBase} = \sum_{j \in S_{\mathsf{CA}}} [\mathsf{rcv}^{\mathsf{net}}_j]\,\mathcal{R}^{\mathsf{Orchard}}\!\)</span>
.</p>
<p>When the Asset is not being burnt, the net balance of the input and output values is zero, and there will be no addition to the
<span class="math">\(\mathsf{assetBurn}\)</span>
vector. Therefore, the relationship between
<span class="math">\(\mathsf{bvk}\)</span>
and
<span class="math">\(\mathsf{bsk}\)</span>
will hold if and only if, per Custom Asset, the sum of the net values of the relevant Actions equals the corresponding
<span class="math">\(\mathsf{v}_k\)</span>
value (or equals
<span class="math">\(0\)</span>
if that Asset is not in the
<span class="math">\(\mathsf{assetBurn}\)</span>
set), and for ZEC, the sum of the net values of the relevant Actions equals the
<span class="math">\(\mathsf{v^{balanceOrchard}}\)</span>
value.</p>
<p>As in the Orchard protocol, the binding signature verification key,
<span class="math">\(\mathsf{bvk}\!\)</span>
, will only be valid (and hence verify the signature correctly), as long as the committed values sum to zero. In contrast, in this protocol, the committed values must sum to zero <strong>per Asset Base</strong>, as the Pedersen commitments add up homomorphically only with respect to the same value base point.</p>
</section>
</section>
<section id="split-notes"><h3><span class="section-heading">Split Notes</span><span class="section-anchor"> <a rel="bookmark" href="#split-notes"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>A Split Input is a copy of a previously issued input note (that is, a note that has previously been included in the Merkle tree), with the following changes:</p>
<ul>
<li>A
<span class="math">\(\mathsf{split\_flag}\)</span>
boolean is set to 1.</li>
<li>The value of the note is replaced with the value 0 during the computation of the value commitment.</li>
</ul>
<p>Input notes are sometimes split in two (or more) output notes, as in most cases, not all the value in a single note is sent to a single output.</p>
<p>When the number of input notes of a particular Asset Base is smaller than the required number of output notes for the same Asset Base, the sender creates Split Inputs of the same Asset Base as padding for the input-less Actions. Note that we do not care about whether the previously issued note copied to create a Split Input is owned by the sender, or whether it was nullified before.</p>
<p>Wallets and other clients have to choose from the following to ensure the Asset Base is preserved for the output note of a Split Action:</p>
<ol type="1">
<li>The Split Input note could be another note containing the same Asset Base that is being spent by this transaction (but not by this Split Input).</li>
<li>The Split Input note could be a different unspent note containing the same Asset Base (note that the note will not actually be spent).</li>
<li>The Split Input note could be an already spent note containing the same Asset Base (note that by zeroing the value in the circuit, we prevent double spending).</li>
</ol>
<p>For Split Notes, the nullifier is generated as follows:</p>
<div class="math">\(\mathsf{nf_{old}} = \mathsf{Extract}_{\mathbb{P}} ([(\mathsf{PRF^{nfOrchard}_{nk}} (\text{ρ}^{\mathsf{old}}) + \text{ψ}') \bmod q_{\mathbb{P}}]\,\mathcal{K}^\mathsf{Orchard} + \mathsf{cm^{old}} + \mathcal{L}^\mathsf{Orchard})\)</div>
<p>where
<span class="math">\(\text{ψ}'\)</span>
is sampled uniformly at random on
<span class="math">\(\mathbb{F}_{q_{\mathbb{P}}}\!\)</span>
,
<span class="math">\(\mathcal{K}^{\mathsf{Orchard}}\)</span>
is the Orchard Nullifier Base as defined in <a id="footnote-reference-41" class="footnote_reference" href="#protocol-commitmentsandnullifiers">19</a>, and
<span class="math">\(\mathcal{L}^{\mathsf{Orchard}} := \mathsf{GroupHash^{\mathbb{P}}}(\texttt{"z.cash:Orchard"}, \texttt{"L"})\!\)</span>
.</p>
<section id="rationale-for-split-notes"><h4><span class="section-heading">Rationale for Split Notes</span><span class="section-anchor"> <a rel="bookmark" href="#rationale-for-split-notes"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>In the Orchard protocol, since each Action represents an input and an output, the transaction that wants to send one input to multiple outputs must have multiple inputs. The Orchard protocol gives <em>dummy spend notes</em> <a id="footnote-reference-42" class="footnote_reference" href="#protocol-orcharddummynotes">17</a> to the Actions that have not been assigned input notes.</p>
<p>The Orchard technique requires modification for the ZSA protocol with multiple Asset Identifiers, as the output note of the split Actions <em>cannot</em> contain <em>just any</em> Asset Base. We must enforce it to be an actual output of a GroupHash computation (in fact, we want it to be of the same Asset Base as the original input note, but the binding signature takes care that the proper balancing is performed). Without this enforcement the prover could input a multiple (or linear combination) of an existing Asset Base, and thereby attack the network by overflowing the ZEC value balance and hence counterfeiting ZEC funds.</p>
<p>Therefore, for Custom Assets we enforce that <em>every</em> input note to an ZSA Action must be proven to exist in the set of note commitments in the note commitment tree. We then enforce this real note to be “unspendable” in the sense that its value will be zeroed in split Actions and the nullifier will be randomized, making the note not spendable in the specific Action. Then, the proof itself ensures that the output note is of the same Asset Base as the input note. In the circuit, the split note functionality will be activated by a boolean private input to the proof (aka the
<span class="math">\(\mathsf{split\_flag}\)</span>
boolean). This ensures that the value base points of all output notes of a transfer are actual outputs of a GroupHash, as they originate in the Issuance protocol which is publicly verified.</p>
<p>Note that the Orchard dummy note functionality remains in use for ZEC notes, and the Split Input technique is used in order to support Custom Assets.</p>
</section>
</section>
<section id="circuit-statement"><h3><span class="section-heading">Circuit Statement</span><span class="section-anchor"> <a rel="bookmark" href="#circuit-statement"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>Every <em>ZSA Action statement</em> is closely similar to the Orchard Action statement <a id="footnote-reference-43" class="footnote_reference" href="#protocol-actionstatement">20</a>, except for a few additions that ensure the security of the Asset Identifier system. We detail these changes below.</p>
<p>All modifications in the Circuit are detailed in <a id="footnote-reference-44" class="footnote_reference" href="#circuit-modifications">31</a>.</p>
<section id="asset-base-equality"><h4><span class="section-heading">Asset Base Equality</span><span class="section-anchor"> <a rel="bookmark" href="#asset-base-equality"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>The following constraints must be added to ensure that the input and output note are of the same
<span class="math">\(\mathsf{AssetBase}\!\)</span>
:</p>
<ul>
<li>The Asset Base,
<span class="math">\(\mathsf{AssetBase_{AssetId}}\!\)</span>
, for the note is witnessed once, as an auxiliary input.</li>
<li>In the Old note commitment integrity constraint in the Orchard Action statement <a id="footnote-reference-45" class="footnote_reference" href="#protocol-actionstatement">20</a>,
<span class="math">\(\mathsf{NoteCommit^{Orchard}_{rcm^{old}}}(\mathsf{repr}_{\mathbb{P}}(\mathsf{g_d^{old}}), \mathsf{repr}_{\mathbb{P}}(\mathsf{pk_d^{old}}), \mathsf{v^{old}}, \text{ρ}^{\mathsf{old}}, \text{ψ}^{\mathsf{old}})\)</span>
is replaced with
<span class="math">\(\mathsf{NoteCommit^{OrchardZSA}_{rcm^{old}}}(\mathsf{repr}_{\mathbb{P}}(\mathsf{g_d^{old}}), \mathsf{repr}_{\mathbb{P}}(\mathsf{pk_d^{old}}), \mathsf{v^{old}}, \text{ρ}^{\mathsf{old}}, \text{ψ}^{\mathsf{old}}, \mathsf{AssetBase_{AssetId}})\!\)</span>
.</li>
<li>In the New note commitment integrity constraint in the Orchard Action statement <a id="footnote-reference-46" class="footnote_reference" href="#protocol-actionstatement">20</a>,
<span class="math">\(\mathsf{NoteCommit^{Orchard}_{rcm^{new}}}(\mathsf{repr}_{\mathbb{P}}(\mathsf{g_d^{new}}), \mathsf{repr}_{\mathbb{P}}(\mathsf{pk_d^{new}}), \mathsf{v^{new}}, \text{ρ}^{\mathsf{new}}, \text{ψ}^{\mathsf{new}})\)</span>
is replaced with
<span class="math">\(\mathsf{NoteCommit^{OrchardZSA}_{rcm^{new}}}(\mathsf{repr}_{\mathbb{P}}(\mathsf{g_d^{new}}), \mathsf{repr}_{\mathbb{P}}(\mathsf{pk_d^{new}}), \mathsf{v^{new}}, \text{ρ}^{\mathsf{new}}, \text{ψ}^{\mathsf{new}}, \mathsf{AssetBase_{AssetId}})\!\)</span>
.</li>
</ul>
<p>To make the evaluation of the note commitment easier, we add a boolean
<span class="math">\(\mathsf{is\_native\_asset}\)</span>
as an auxiliary witness. We also add some constraints to verify that this variable is activated (i.e.
<span class="math">\(\mathsf{is\_native\_asset} = 1\!\)</span>
) if the Asset Base is equal to
<span class="math">\(\mathcal{V}^{\mathsf{Orchard}}\)</span>
and this variable is not activated (i.e.
<span class="math">\(\mathsf{is\_native\_asset} = 0\!\)</span>
) if the Asset Base is not equal to
<span class="math">\(\mathcal{V}^{\mathsf{Orchard}}\!\)</span>
.</p>
</section>
<section id="the-mathsf-enablezsa-flag">
<h4>The
<span class="math">\(\mathsf{enableZSA}\)</span>
Flag</h4>
<p>The following constraints must be added to disable transactions involving Custom Assets when the
<span class="math">\(\mathsf{enableZSA}\)</span>
flag is set to false:</p>
<ul>
<li>if
<span class="math">\(\mathsf{enableZSA}\)</span>
is not activated (i.e.
<span class="math">\(\mathsf{enableZSA} = 0\!\)</span>
), then constrain
<span class="math">\(\mathsf{is\_native\_asset} = 1\!\)</span>
, since the
<span class="math">\(\mathsf{AsssetBase}\)</span>
must be equal to the native asset.</li>
</ul>
</section>
<section id="value-commitment-correctness"><h4><span class="section-heading">Value Commitment Correctness</span><span class="section-anchor"> <a rel="bookmark" href="#value-commitment-correctness"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>The following constraints must be added to ensure that the value commitment is computed using the witnessed Asset Base:</p>
<ul>
<li>The fixed-base multiplication constraint between the value and the value base point of the value commitment,
<span class="math">\(\mathsf{cv}\!\)</span>
, is replaced with a variable-base multiplication between the two.</li>
<li>The witness to the value base point (as defined in the <a href="#asset-base">asset base</a> equation) is the auxiliary input
<span class="math">\(\mathsf{AssetBase_{AssetId}}\!\)</span>
.</li>
</ul>
</section>
<section id="asset-identifier-consistency-for-split-actions"><h4><span class="section-heading">Asset Identifier Consistency for Split Actions</span><span class="section-anchor"> <a rel="bookmark" href="#asset-identifier-consistency-for-split-actions"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>Senders must not be able to change the Asset Base for the output note in a Split Action. We do this via the following constraints:</p>
<ul>
<li>
<dl>
<dt>The Value Commitment Integrity should be changed:</dt>
<dd>
<ul>
<li>Replace the input note value by a generic value,
<span class="math">\(\mathsf{v}'\!\)</span>
, as
<span class="math">\(\mathsf{cv^{net}} = \mathsf{ValueCommit_rcv^{OrchardZSA}}(\mathsf{AssetBase_{AssetId}}, \mathsf{v}' - \mathsf{v^{new}})\)</span>
</li>
</ul>
</dd>
</dl>
</li>
<li>
<dl>
<dt>Add a boolean
<span class="math">\(\mathsf{split\_flag}\)</span>
variable as an auxiliary witness. This variable is to be activated
<span class="math">\(\mathsf{split\_flag} = 1\)</span>
if the Action in question has a Split Input and
<span class="math">\(\mathsf{split\_flag} = 0\)</span>
if the Action is actually spending an input note:</dt>
<dd>
<ul>
<li>If
<span class="math">\(\mathsf{split\_flag} = 1\)</span>
then constrain
<span class="math">\(\mathsf{v}' = 0\)</span>
otherwise constrain
<span class="math">\(\mathsf{v}' = \mathsf{v^{old}}\)</span>
from the auxiliary input.</li>
<li>If
<span class="math">\(\mathsf{split\_flag} = 1\)</span>
then constrain
<span class="math">\(\mathsf{is\_native\_asset} = 0\)</span>
because split notes are only available for Custom Assets.</li>
</ul>
</dd>
</dl>
</li>
<li>
<dl>
<dt>The Merkle Path Validity should check the existence of the note commitment as usual (and not like with dummy notes):</dt>
<dd>
<ul>
<li>Check for all notes except dummy notes that
<span class="math">\((\mathsf{path}, \mathsf{pos})\)</span>
is a valid Merkle path of depth
<span class="math">\(\mathsf{MerkleDepth^{Orchard}}\!\)</span>
, from
<span class="math">\(\mathsf{cm^{old}}\)</span>
to the anchor
<span class="math">\(\mathsf{rt^{Orchard}}\!\)</span>
.</li>
<li>The new constraint is
<span class="math">\(\underbrace{(\mathsf{v^{old}} = 0 \land \mathsf{is\_native\_asset} = 1)}_\text{It is a dummy note} \lor \underbrace{(\mathsf{Valid\,Merkle\,Path})}_\text{The Merkle Path is valid}\!\)</span>
.</li>
</ul>
</dd>
</dl>
</li>
<li>The Nullifier Integrity will be changed to prevent the identification of notes as defined in the <a href="#split-notes">Split Notes</a> section.</li>
</ul>
</section>
<section id="backwards-compatibility-with-zec-notes"><h4><span class="section-heading">Backwards Compatibility with ZEC Notes</span><span class="section-anchor"> <a rel="bookmark" href="#backwards-compatibility-with-zec-notes"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>The input note in the old note commitment integrity check must either include an Asset Base (ZSA note) or not (pre-ZSA Orchard note). If the note is a pre-ZSA Orchard note, the note commitment is computed in the original Orchard fashion <a id="footnote-reference-47" class="footnote_reference" href="#protocol-abstractcommit">16</a>. If the note is a ZSA note, the note commitment is computed as defined in the <a href="#note-structure-commitment">Note Structure &amp; Commitment</a> section.</p>
</section>
</section>
</section>
<section id="orchard-zsa-transaction-structure"><h2><span class="section-heading">Orchard-ZSA Transaction Structure</span><span class="section-anchor"> <a rel="bookmark" href="#orchard-zsa-transaction-structure"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The transaction format for v6 transactions is described in ZIP 230 <a id="footnote-reference-48" class="footnote_reference" href="#zip-0230">10</a>.</p>
</section>
<section id="txid-digest"><h2><span class="section-heading">TxId Digest</span><span class="section-anchor"> <a rel="bookmark" href="#txid-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The transaction digest algorithm defined in ZIP 244 <a id="footnote-reference-49" class="footnote_reference" href="#zip-0244">11</a> is modified by the ZSA protocol to add a new branch for issuance information, along with modifications within the <code>orchard_digest</code> to account for the inclusion of the Asset Base. The details of these changes are described in this section, and highlighted using the <code>[UPDATED FOR ZSA]</code> or <code>[ADDED FOR ZSA]</code> text label. We omit the details of the sections that do not change for the ZSA protocol.</p>
<section id="txid-digest-1"><h3><span class="section-heading">txid_digest</span><span class="section-anchor"> <a rel="bookmark" href="#txid-digest-1"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>A BLAKE2b-256 hash of the following values</p>
<pre>T.1: header_digest (32-byte hash output)
T.2: transparent_digest (32-byte hash output)
T.3: sapling_digest (32-byte hash output)
T.4: orchard_digest (32-byte hash output) [UPDATED FOR ZSA]
T.5: issuance_digest (32-byte hash output) [ADDED FOR ZSA]</pre>
<p>The personalization field remains the same as in ZIP 244 <a id="footnote-reference-50" class="footnote_reference" href="#zip-0244">11</a>.</p>
<section id="t-4-orchard-digest"><h4><span class="section-heading">T.4: orchard_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-4-orchard-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>When Orchard Actions are present in the transaction, this digest is a BLAKE2b-256 hash of the following values</p>
<pre>T.4a: orchard_actions_compact_digest (32-byte hash output) [UPDATED FOR ZSA]
T.4b: orchard_actions_memos_digest (32-byte hash output) [UPDATED FOR ZSA]
T.4c: orchard_actions_noncompact_digest (32-byte hash output) [UPDATED FOR ZSA]
T.4d: flagsOrchard (1 byte)
T.4e: valueBalanceOrchard (64-bit signed little-endian)
T.4f: anchorOrchard (32 bytes)</pre>
<section id="t-4a-orchard-actions-compact-digest"><h5><span class="section-heading">T.4a: orchard_actions_compact_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-4a-orchard-actions-compact-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h5>
<p>A BLAKE2b-256 hash of the subset of Orchard Action information intended to be included in an updated version of the ZIP-307 <a id="footnote-reference-51" class="footnote_reference" href="#zip-0307">12</a> <code>CompactBlock</code> format for all Orchard Actions belonging to the transaction. For each Action, the following elements are included in the hash:</p>
<pre>T.4a.i : nullifier (field encoding bytes)
T.4a.ii : cmx (field encoding bytes)
T.4a.iii: ephemeralKey (field encoding bytes)
T.4a.iv : encCiphertext[..84] (First 84 bytes of field encoding) [UPDATED FOR ZSA]</pre>
<p>The personalization field of this hash is the same as in ZIP 244:</p>
<pre>"ZTxIdOrcActCHash"</pre>
</section>
<section id="t-4b-orchard-actions-memos-digest"><h5><span class="section-heading">T.4b: orchard_actions_memos_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-4b-orchard-actions-memos-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h5>
<p>A BLAKE2b-256 hash of the subset of Orchard shielded memo field data for all Orchard Actions belonging to the transaction. For each Action, the following elements are included in the hash:</p>
<pre>T.4b.i: encCiphertext[84..596] (contents of the encrypted memo field) [UPDATED FOR ZSA]</pre>
<p>The personalization field of this hash remains identical to ZIP 244:</p>
<pre>"ZTxIdOrcActMHash"</pre>
</section>
<section id="t-4c-orchard-actions-noncompact-digest"><h5><span class="section-heading">T.4c: orchard_actions_noncompact_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-4c-orchard-actions-noncompact-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h5>
<p>A BLAKE2b-256 hash of the remaining subset of Orchard Action information <strong>not</strong> intended for inclusion in an updated version of the the ZIP 307 <a id="footnote-reference-52" class="footnote_reference" href="#zip-0307">12</a> <code>CompactBlock</code> format, for all Orchard Actions belonging to the transaction. For each Action, the following elements are included in the hash:</p>
<pre>T.4d.i : cv (field encoding bytes)
T.4d.ii : rk (field encoding bytes)
T.4d.iii: encCiphertext[596..] (post-memo suffix of field encoding) [UPDATED FOR ZSA]
T.4d.iv : outCiphertext (field encoding bytes)</pre>
<p>The personalization field of this hash is defined identically to ZIP 244:</p>
<pre>"ZTxIdOrcActNHash"</pre>
</section>
</section>
<section id="t-5-issuance-digest"><h4><span class="section-heading">T.5: issuance_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-5-issuance-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>The details of the computation of this value are in ZIP 227 <a id="footnote-reference-53" class="footnote_reference" href="#zip-0227-txiddigest">7</a>.</p>
</section>
</section>
</section>
<section id="signature-digest-and-authorizing-data-commitment"><h2><span class="section-heading">Signature Digest and Authorizing Data Commitment</span><span class="section-anchor"> <a rel="bookmark" href="#signature-digest-and-authorizing-data-commitment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The details of the changes to these algorithms are in ZIP 227 <a id="footnote-reference-54" class="footnote_reference" href="#zip-0227-sigdigest">8</a> <a id="footnote-reference-55" class="footnote_reference" href="#zip-0227-authcommitment">9</a>.</p>
</section>
<section id="security-and-privacy-considerations"><h2><span class="section-heading">Security and Privacy Considerations</span><span class="section-anchor"> <a rel="bookmark" href="#security-and-privacy-considerations"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<ul>
<li>After the protocol upgrade, the Orchard shielded pool will be shared by the Orchard protocol and the Orchard-ZSA protocol.</li>
<li>Deploying the Orchard-ZSA protocol does not necessitate disabling the Orchard protocol. Both can co-exist and be addressed via different transaction versions (V5 for Orchard and V6 for Orchard-ZSA). Due to this, Orchard note commitments can be distinguished from Orchard-ZSA note commitments. This holds whether or not the two protocols are active simultaneously.</li>
<li>Orchard-ZSA note commitments for the native asset (ZEC) are indistinguishable from Orchard-ZSA note commitments for non-native Assets.</li>
<li>When including new Assets we would like to maintain the amount and identifiers of Assets private, which is achieved with the design.</li>
<li>We prevent a potential malleability attack on the Asset Identifier by ensuring the output notes receive an Asset Base that exists on the global state.</li>
</ul>
</section>
<section id="other-considerations"><h2><span class="section-heading">Other Considerations</span><span class="section-anchor"> <a rel="bookmark" href="#other-considerations"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<section id="transaction-fees"><h3><span class="section-heading">Transaction Fees</span><span class="section-anchor"> <a rel="bookmark" href="#transaction-fees"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The fee mechanism for the upgrades proposed in this ZIP will follow the mechanism described in ZIP 317 for the ZSA protocol upgrade <a id="footnote-reference-56" class="footnote_reference" href="#zip-0317b">13</a>.</p>
</section>
<section id="backward-compatibility"><h3><span class="section-heading">Backward Compatibility</span><span class="section-anchor"> <a rel="bookmark" href="#backward-compatibility"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>In order to have backward compatibility with the ZEC notes, we have designed the circuit to support both ZEC and ZSA notes. As we specify above, there are three main reasons we can do this:</p>
<ul>
<li>Note commitments for ZEC notes will remain the same, while note commitments for Custom Assets will be computed taking into account the
<span class="math">\(\mathsf{AssetBase}\)</span>
value as well.</li>
<li>The existing Orchard shielded pool will continue to be used for the new ZSA notes post the upgrade.</li>
<li>The value commitment is abstracted to allow for the value base-point as a variable private input to the proof.</li>
<li>The ZEC-based Actions will still include dummy input notes, whereas the ZSA-based Actions will include split input notes and will not include dummy input notes.</li>
</ul>
</section>
<section id="deployment"><h3><span class="section-heading">Deployment</span><span class="section-anchor"> <a rel="bookmark" href="#deployment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The Zcash Shielded Assets protocol will be deployed in a subsequent Network Upgrade.</p>
</section>
</section>
<section id="test-vectors"><h2><span class="section-heading">Test Vectors</span><span class="section-anchor"> <a rel="bookmark" href="#test-vectors"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<ul>
<li><a href="https://github.com/QED-it/zcash-test-vectors">https://github.com/QED-it/zcash-test-vectors</a></li>
</ul>
</section>
<section id="reference-implementation"><h2><span class="section-heading">Reference Implementation</span><span class="section-anchor"> <a rel="bookmark" href="#reference-implementation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<ul>
<li><a href="https://github.com/QED-it/zcash">https://github.com/QED-it/zcash</a> (in <cite>zcashd</cite>)</li>
<li><a href="https://github.com/QED-it/orchard">https://github.com/QED-it/orchard</a> (in <cite>orchard</cite>)</li>
<li><a href="https://github.com/QED-it/librustzcash">https://github.com/QED-it/librustzcash</a> (in <cite>librustzcash</cite>)</li>
<li><a href="https://github.com/QED-it/halo2">https://github.com/QED-it/halo2</a> (in <cite>halo2</cite>)</li>
</ul>
</section>
<section id="references"><h2><span class="section-heading">References</span><span class="section-anchor"> <a rel="bookmark" href="#references"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<table id="bcp14" class="footnote">
<tbody>
<tr>
<th>1</th>
<td><a href="https://www.rfc-editor.org/info/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"</a></td>
</tr>
</tbody>
</table>
<table id="zip-0200" class="footnote">
<tbody>
<tr>
<th>2</th>
<td><a href="zip-0200.html">ZIP 200: Network Upgrade Mechanism</a></td>
</tr>
</tbody>
</table>
<table id="zip-0209" class="footnote">
<tbody>
<tr>
<th>3</th>
<td><a href="zip-0209.html">ZIP 209: Prohibit Negative Shielded Chain Value Pool Balances</a></td>
</tr>
</tbody>
</table>
<table id="zip-0224" class="footnote">
<tbody>
<tr>
<th>4</th>
<td><a href="zip-0224.html">ZIP 224: Orchard</a></td>
</tr>
</tbody>
</table>
<table id="zip-0227" class="footnote">
<tbody>
<tr>
<th>5</th>
<td><a href="zip-0227.html">ZIP 227: Issuance of Zcash Shielded Assets</a></td>
</tr>
</tbody>
</table>
<table id="zip-0227-assetidentifier" class="footnote">
<tbody>
<tr>
<th>6</th>
<td><a href="zip-0227.html#specification-asset-identifier">ZIP 227: Issuance of Zcash Shielded Assets: Specification: Asset Identifier</a></td>
</tr>
</tbody>
</table>
<table id="zip-0227-txiddigest" class="footnote">
<tbody>
<tr>
<th>7</th>
<td><a href="zip-0227.html#txid-digest-issuance">ZIP 227: Issuance of Zcash Shielded Assets: TxId Digest - Issuance</a></td>
</tr>
</tbody>
</table>
<table id="zip-0227-sigdigest" class="footnote">
<tbody>
<tr>
<th>8</th>
<td><a href="zip-0227.html#signature-digest">ZIP 227: Issuance of Zcash Shielded Assets: Signature Digest</a></td>
</tr>
</tbody>
</table>
<table id="zip-0227-authcommitment" class="footnote">
<tbody>
<tr>
<th>9</th>
<td><a href="zip-0227.html#authorizing-data-commitment">ZIP 227: Issuance of Zcash Shielded Assets: Authorizing Data Commitment</a></td>
</tr>
</tbody>
</table>
<table id="zip-0230" class="footnote">
<tbody>
<tr>
<th>10</th>
<td><a href="https://github.com/QED-it/zips/pull/36">ZIP 230: Version 6 Transaction Format</a></td>
</tr>
</tbody>
</table>
<table id="zip-0244" class="footnote">
<tbody>
<tr>
<th>11</th>
<td><a href="zip-0244.html">ZIP 244: Transaction Identifier Non-Malleability</a></td>
</tr>
</tbody>
</table>
<table id="zip-0307" class="footnote">
<tbody>
<tr>
<th>12</th>
<td><a href="zip-0307">ZIP 307: Light Client Protocol for Payment Detection</a></td>
</tr>
</tbody>
</table>
<table id="zip-0317b" class="footnote">
<tbody>
<tr>
<th>13</th>
<td><a href="https://github.com/zcash/zips/pull/667">ZIP 317: Proportional Transfer Fee Mechanism - Pull Request #667 for ZSA Protocol ZIPs</a></td>
</tr>
</tbody>
</table>
<table id="protocol-notes" class="footnote">
<tbody>
<tr>
<th>14</th>
<td><a href="protocol/protocol.pdf#notes">Zcash Protocol Specification, Version 2023.4.0. Section 3.2: Notes</a></td>
</tr>
</tbody>
</table>
<table id="protocol-actions" class="footnote">
<tbody>
<tr>
<th>15</th>
<td><a href="protocol/protocol.pdf#actions">Zcash Protocol Specification, Version 2023.4.0. Section 3.7: Action Transfers and their Descriptions</a></td>
</tr>
</tbody>
</table>
<table id="protocol-abstractcommit" class="footnote">
<tbody>
<tr>
<th>16</th>
<td><a href="protocol/protocol.pdf#abstractcommit">Zcash Protocol Specification, Version 2023.4.0. Section 4.1.8: Commitment</a></td>
</tr>
</tbody>
</table>
<table id="protocol-orcharddummynotes" class="footnote">
<tbody>
<tr>
<th>17</th>
<td><a href="protocol/protocol.pdf#orcharddummynotes">Zcash Protocol Specification, Version 2023.4.0. Section 4.8.3: Dummy Notes (Orchard)</a></td>
</tr>
</tbody>
</table>
<table id="protocol-orchardbalance" class="footnote">
<tbody>
<tr>
<th>18</th>
<td><a href="protocol/protocol.pdf#orchardbalance">Zcash Protocol Specification, Version 2023.4.0. Section 4.14: Balance and Binding Signature (Orchard)</a></td>
</tr>
</tbody>
</table>
<table id="protocol-commitmentsandnullifiers" class="footnote">
<tbody>
<tr>
<th>19</th>
<td><a href="protocol/protocol.pdf#commitmentsandnullifiers">Zcash Protocol Specification, Version 2023.4.0. Section 4.16: Note Commitments and Nullifiers</a></td>
</tr>
</tbody>
</table>
<table id="protocol-actionstatement" class="footnote">
<tbody>
<tr>
<th>20</th>
<td><a href="protocol/protocol.pdf#actionstatement">Zcash Protocol Specification, Version 2023.4.0. Section 4.17.4: Action Statement (Orchard)</a></td>
</tr>
</tbody>
</table>
<table id="protocol-endian" class="footnote">
<tbody>
<tr>
<th>21</th>
<td><a href="protocol/protocol.pdf#endian">Zcash Protocol Specification, Version 2023.4.0. Section 5.1: Integers, Bit Sequences, and Endianness</a></td>
</tr>
</tbody>
</table>
<table id="protocol-constants" class="footnote">
<tbody>
<tr>
<th>22</th>
<td><a href="protocol/protocol.pdf#constants">Zcash Protocol Specification, Version 2023.4.0. Section 5.3: Constants</a></td>
</tr>
</tbody>
</table>
<table id="protocol-concretesinsemillahash" class="footnote">
<tbody>
<tr>
<th>23</th>
<td><a href="protocol/protocol.pdf#concretesinsemillahash">Zcash Protocol Specification, Version 2023.4.0. Section 5.4.1.9: Sinsemilla hash function</a></td>
</tr>
</tbody>
</table>
<table id="protocol-concretehomomorphiccommit" class="footnote">
<tbody>
<tr>
<th>24</th>
<td><a href="protocol/protocol.pdf#concretehomomorphiccommit">Zcash Protocol Specification, Version 2023.4.0. Section 5.4.8.3: Homomorphic Pedersen commitments (Sapling and Orchard)</a></td>
</tr>
</tbody>
</table>
<table id="protocol-concretesinsemillacommit" class="footnote">
<tbody>
<tr>
<th>25</th>
<td><a href="protocol/protocol.pdf#concretesinsemillacommit">Zcash Protocol Specification, Version 2023.4.0. Section 5.4.8.4: Sinsemilla commitments</a></td>
</tr>
</tbody>
</table>
<table id="protocol-pallasandvesta" class="footnote">
<tbody>
<tr>
<th>26</th>
<td><a href="protocol/protocol.pdf#pallasandvesta">Zcash Protocol Specification, Version 2023.4.0. Section 5.4.9.6: Pallas and Vesta</a></td>
</tr>
</tbody>
</table>
<table id="protocol-notept" class="footnote">
<tbody>
<tr>
<th>27</th>
<td><a href="protocol/protocol.pdf#notept">Zcash Protocol Specification, Version 2023.4.0. Section 5.5: Encodings of Note Plaintexts and Memo Fields</a></td>
</tr>
</tbody>
</table>
<table id="protocol-actionencodingandconsensus" class="footnote">
<tbody>
<tr>
<th>28</th>
<td><a href="protocol/protocol.pdf#actionencodingandconsensus">Zcash Protocol Specification, Version 2023.4.0. Section 7.5: Action Description Encoding and Consensus</a></td>
</tr>
</tbody>
</table>
<table id="initial-zsa-issue" class="footnote">
<tbody>
<tr>
<th>29</th>
<td><a href="https://github.com/str4d/zips/blob/zip-udas/drafts/zip-user-defined-assets.rst">User-Defined Assets and Wrapped Assets</a></td>
</tr>
</tbody>
</table>
<table id="generalized-value-commitments" class="footnote">
<tbody>
<tr>
<th>30</th>
<td><a href="https://github.com/zcash/zcash/issues/2277#issuecomment-321106819">Comment on Generalized Value Commitments</a></td>
</tr>
</tbody>
</table>
<table id="circuit-modifications" class="footnote">
<tbody>
<tr>
<th>31</th>
<td><a href="https://docs.google.com/document/d/1DzXBqZl_l3aIs_gcelw3OuZz2OVMnYk6Xe_1lBsTji8/edit?usp=sharing">Modifications to the Orchard circuit for the ZSA Protocol</a></td>
</tr>
</tbody>
</table>
</section>
</section>
</body>
</html>

View File

@ -3,6 +3,7 @@
<head>
<title>ZIP 227: Issuance of Zcash Shielded Assets</title>
<meta charset="utf-8" />
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js?config=TeX-AMS-MML_HTMLorMML"></script>
<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"></head>
<body>
<section>
@ -15,10 +16,973 @@ Owners: Pablo Kogan &lt;pablo@qed-it.com&gt;
Credits: Daniel Benarroch
Aurelien Nicolas
Deirdre Connolly
Status: Reserved
Teor
Status: Draft
Category: Consensus
Created: 2022-05-01
License: MIT
Discussions-To: &lt;<a href="https://github.com/zcash/zips/issues/618">https://github.com/zcash/zips/issues/618</a>&gt;
Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/649">https://github.com/zcash/zips/pull/649</a>&gt;</pre>
Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/680">https://github.com/zcash/zips/pull/680</a>&gt;</pre>
<section id="terminology"><h2><span class="section-heading">Terminology</span><span class="section-anchor"> <a rel="bookmark" href="#terminology"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The key words "MUST", "MUST NOT", "SHOULD", "RECOMMENDED", and "MAY" in this document are to be interpreted as described in BCP 14 <a id="footnote-reference-1" class="footnote_reference" href="#bcp14">1</a> when, and only when, they appear in all capitals.</p>
<p>The term "network upgrade" in this document is to be interpreted as described in ZIP 200 <a id="footnote-reference-2" class="footnote_reference" href="#zip-0200">7</a>.</p>
<p>The terms "Orchard" and "Action" in this document are to be interpreted as described in ZIP 224 <a id="footnote-reference-3" class="footnote_reference" href="#zip-0224">8</a>.</p>
<p>We define the following additional terms:</p>
<ul>
<li>Asset: A type of note that can be transferred on the Zcash blockchain. Each Asset is identified by an Asset Identifier <a href="#specification-asset-identifier">Specification: Asset Identifier</a>.
<ul>
<li>ZEC is the default (and currently the only defined) Asset for the Zcash mainnet.</li>
<li>TAZ is the default (and currently the only defined) Asset for the Zcash testnet.</li>
<li>We use the term "Custom Asset" to refer to any Asset other than ZEC and TAZ.</li>
</ul>
</li>
<li>Native Asset: a Custom Asset with issuance defined on the Zcash blockchain.</li>
<li>Wrapped Asset: a Custom Asset with native issuance defined outside the Zcash blockchain.</li>
<li>Issuance Action: an instance of a single issuance of a Zcash Shielded Asset. It defines the issuance of a single Asset Identifier.</li>
<li>Issuance Bundle: the bundle in the transaction that contains all the issuance actions of that transaction.</li>
</ul>
</section>
<section id="abstract"><h2><span class="section-heading">Abstract</span><span class="section-anchor"> <a rel="bookmark" href="#abstract"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This ZIP (ZIP 227) proposes the Zcash Shielded Assets (ZSA) protocol, in conjunction with ZIP 226 <a id="footnote-reference-4" class="footnote_reference" href="#zip-0226">9</a>. This protocol is an extension of the Orchard protocol that enables the creation, transfer and burn of Custom Assets on the Zcash chain. The creation of such Assets is defined in this ZIP (ZIP 227), while the transfer and burn of such Assets is defined in ZIP 226 <a id="footnote-reference-5" class="footnote_reference" href="#zip-0226">9</a>. This ZIP must only be implemented in conjunction with ZIP 226 <a id="footnote-reference-6" class="footnote_reference" href="#zip-0226">9</a>. The proposed issuance mechanism is only valid for the Orchard-ZSA transfer protocol, because it produces notes that can only be transferred under ZSA.</p>
</section>
<section id="motivation"><h2><span class="section-heading">Motivation</span><span class="section-anchor"> <a rel="bookmark" href="#motivation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This ZIP introduces the issuance mechanism for Custom Assets on the Zcash chain. While originally part of a single ZSA ZIP, the issuance mechanism turned out to be substantial enough to stand on its own and justify the creation of this supporting ZIP for ZIP 226 <a id="footnote-reference-7" class="footnote_reference" href="#zip-0226">9</a>.</p>
<p>This ZIP only enables <em>transparent</em> issuance. As a first step, transparency will allow for proper testing of the applications that will be most used in the Zcash ecosystem, and will enable the supply of Assets to be tracked.</p>
<p>The issuance mechanism described in this ZIP is broad enough for issuers to either create Assets on Zcash (i.e. Assets that originate on the Zcash blockchain), as well as for institutions to create bridges from other chains and import Wrapped Assets. This enables what we hope will be a useful set of applications.</p>
</section>
<section id="use-cases"><h2><span class="section-heading">Use Cases</span><span class="section-anchor"> <a rel="bookmark" href="#use-cases"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The design presented in this ZIP enables issuance of shielded Assets in various modes:</p>
<ul>
<li>The issuer may or may not know the receivers of the issued Asset in advance.</li>
<li>The Asset can be of non-fungible type, where each Asset type can be made part of a single “series”.</li>
<li>The supply of the Asset can be limited in advance or not.</li>
<li>The Asset can be a wrapped version of an Asset issued by another chain (as long as there is a bridge that supports transfer of that Asset between chains).</li>
</ul>
<p>See the <a href="#concrete-applications">Concrete Applications</a> section for more details.</p>
</section>
<section id="requirements"><h2><span class="section-heading">Requirements</span><span class="section-anchor"> <a rel="bookmark" href="#requirements"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<ul>
<li>Any user of the Zcash blockchain can issue Custom Assets on chain.</li>
<li>The issuance mechanism should enable public tracking of the supply of the Assets on the Zcash blockchain.</li>
<li>Issuing or changing the attributes of a specific Asset should require cryptographic authorization.</li>
<li>The Asset identification should be unique (among all shielded pools) and different issuer public keys should not be able to generate the same Asset Identifier.</li>
<li>An issuer should be able to issue different Assets in the same transaction. In other words, in a single "issuance bundle", the issuer should be able publish many "issuance actions", potentially creating multiple Custom Assets.</li>
<li>Every "issuance action" should contain a
<span class="math">\(\mathsf{finalize}\)</span>
boolean that defines whether the specific Custom Asset can have further tokens issued or not.</li>
</ul>
</section>
<section id="specification-issuance-keys-and-issuance-authorization-signature-scheme"><h2><span class="section-heading">Specification: Issuance Keys and Issuance Authorization Signature Scheme</span><span class="section-anchor"> <a rel="bookmark" href="#specification-issuance-keys-and-issuance-authorization-signature-scheme"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The Orchard-ZSA Protocol adds the following keys to the key components <a id="footnote-reference-8" class="footnote_reference" href="#protocol-addressesandkeys">18</a> <a id="footnote-reference-9" class="footnote_reference" href="#protocol-orchardkeycomponents">19</a>:</p>
<ol type="1">
<li>The issuance authorizing key, denoted as
<span class="math">\(\mathsf{isk}\!\)</span>
, is the key used to authorize the issuance of Asset Identifiers by a given issuer, and is only used by that issuer.</li>
<li>The issuance validating key, denoted as
<span class="math">\(\mathsf{ik}\!\)</span>
, is the key that is used to validate issuance transactions. This key is used to validate the issuance of Asset Identifiers by a given issuer, and is used by all blockchain users (specifically the owners of notes for that Asset, and consensus validators) to associate the Asset in question with the issuer.</li>
</ol>
<p>The relations between these keys are shown in the following diagram:</p>
<figure class="align-center" align="center">
<img width="450" src="zip-0227-key-components-zsa.png" alt="" />
<figcaption>Diagram of Issuance Key Components for the Orchard-ZSA Protocol</figcaption>
</figure>
<section id="issuance-authorization-signature-scheme"><h3><span class="section-heading">Issuance Authorization Signature Scheme</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-authorization-signature-scheme"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>We instantiate the issuance authorization signature scheme
<span class="math">\(\mathsf{IssueAuthSig}\)</span>
as a BIP-340 Schnorr signature over the secp256k1 curve. The signing and validation algorithms, signature encoding, and public key encoding MUST follow BIP 340 <a id="footnote-reference-10" class="footnote_reference" href="#bip-0340">16</a>.</p>
<p>Batch verification MAY be used. Precomputation MAY be used if and only if it produces equivalent results; for example, for a given verification key
<span class="math">\(pk\)</span>
and
<span class="math">\(\mathit{lift\_x}(\mathit{int}(pk))\)</span>
MAY be precomputed.</p>
<p>We define the constants as per the secp256k1 standard parameters, as described in BIP 340.</p>
<p>The associated types of the
<span class="math">\(\mathsf{IssueAuthSig}\)</span>
signature scheme are as follows:</p>
<ul>
<li>
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{Message} = \mathbb{B}^{\mathbb{Y}^{[\mathbb{N}]}}\)</span>
</li>
<li>
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{Signature} = \mathbb{B}^{\mathbb{Y}^{[64]}} \cup \{\bot\}\)</span>
</li>
<li>
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{Public} = \mathbb{B}^{\mathbb{Y}^{[32]}} \cup \{\bot\}\)</span>
</li>
<li>
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{Private} = \mathbb{B}^{\mathbb{Y}^{[32]}}\)</span>
</li>
</ul>
<p>where
<span class="math">\(\mathbb{B}^{\mathbb{Y}^{[k]}}\)</span>
denotes the set of sequences of
<span class="math">\(k\)</span>
bytes, and
<span class="math">\(\mathbb{B}^{\mathbb{Y}^{[\mathbb{N}]}}\)</span>
denotes the type of byte sequences of arbitrary length, as defined in the Zcash protocol specification <a id="footnote-reference-11" class="footnote_reference" href="#protocol-notation">17</a>.</p>
<p>The issuance authorizing key generation algorithm and the issuance validating key derivation algorithm are defined in the <a href="#issuance-key-derivation">Issuance Key Derivation</a> section, while the corresponding signing and validation algorithms are defined in the <a href="#issuance-authorization-signing-and-validation">Issuance Authorization Signing and Validation</a> section.</p>
</section>
<section id="issuance-key-derivation"><h3><span class="section-heading">Issuance Key Derivation</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-key-derivation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<section id="issuance-authorizing-key-generation-for-hierarchical-deterministic-wallets"><h4><span class="section-heading">Issuance authorizing key generation for hierarchical deterministic wallets</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-authorizing-key-generation-for-hierarchical-deterministic-wallets"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>The issuance authorizing key is generated using the Orchard master key derivation procedure defined in ZIP 32 <a id="footnote-reference-12" class="footnote_reference" href="#zip-0032-orchard-master">3</a>. We reuse the functions defined there in what follows in this section.</p>
<p>Let
<span class="math">\(S\)</span>
be a seed byte sequence of a chosen length, which MUST be at least 32 and at most 252 bytes. We define the master extended issuance key
<span class="math">\(m_{\mathsf{Issuance}} := \mathsf{MasterKeyGen}(\texttt{"ZIP32ZSAIssue_V1"}, S)\!\)</span>
.</p>
<p>As in ZIP 32 for Orchard <a id="footnote-reference-13" class="footnote_reference" href="#zip-0032-orchard-child-key-derivation">4</a>, we only use hardened child key derivation for the issuance authorizing key. We reuse the
<span class="math">\(\mathsf{CDKsk}\)</span>
function for Orchard child key derivation from ZIP 32.</p>
<p>We use the notation of ZIP 32 <a id="footnote-reference-14" class="footnote_reference" href="#zip-0032-orchard-key-path">6</a> for shielded HD paths, and define the issuance authorizing key path as
<span class="math">\(m_{\mathsf{Issuance}} / \mathit{purpose}' / \mathit{coin\_type}' / \mathit{account}'\!\)</span>
. We fix the path levels as follows:</p>
<ul>
<li>
<span class="math">\(\mathit{purpose}\)</span>
: a constant set to
<span class="math">\(227\)</span>
(i.e.
<span class="math">\(\mathtt{0xe3}\!\)</span>
).
<span class="math">\(\mathit{purpose}'\)</span>
is thus
<span class="math">\(227'\)</span>
(or
<span class="math">\(\mathtt{0x800000e3}\!\)</span>
) following the BIP 43 recommendation.</li>
<li>
<span class="math">\(\mathit{coin\_type}\)</span>
: Defined as in ZIP 32 <a id="footnote-reference-15" class="footnote_reference" href="#zip-0032-key-path-levels">5</a>.</li>
<li>
<span class="math">\(\mathit{account}\)</span>
: fixed to index
<span class="math">\(0\!\)</span>
.</li>
</ul>
<p>From the generated
<span class="math">\((\mathsf{sk}, \mathsf{c})\!\)</span>
, we set the issuance authorizing key to be
<span class="math">\(\mathsf{isk} := \mathsf{sk}\!\)</span>
.</p>
</section>
<section id="derivation-of-issuance-validating-key"><h4><span class="section-heading">Derivation of issuance validating key</span><span class="section-anchor"> <a rel="bookmark" href="#derivation-of-issuance-validating-key"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>Define
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{DerivePublic}\; : \; (\mathsf{isk}\; : \; \mathsf{IssueAuthSig}.\!\mathsf{Private}) \to \mathsf{IssueAuthSig}.\!\mathsf{Public}\)</span>
as:</p>
<ul>
<li>
<span class="math">\(\mathsf{ik} := \textit{PubKey}(\mathsf{isk})\)</span>
</li>
<li>Return
<span class="math">\(\bot\)</span>
if the
<span class="math">\(\textit{PubKey}\)</span>
algorithm invocation fails, otherwise return
<span class="math">\(\mathsf{ik}\!\)</span>
.</li>
</ul>
<p>where the
<span class="math">\(\textit{PubKey}\)</span>
algorithm is defined in BIP 340 <a id="footnote-reference-16" class="footnote_reference" href="#bip-0340">16</a>. Note that the byte representation of
<span class="math">\(\mathsf{ik}\)</span>
is in big-endian order as defined in BIP 340.</p>
<p>It is possible for the
<span class="math">\(\textit{PubKey}\)</span>
algorithm to fail with very low probability, which means that
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{DerivePublic}\)</span>
could return
<span class="math">\(\bot\)</span>
with very low probability. If this happens, discard the keys and repeat with a different
<span class="math">\(\mathsf{isk}\!\)</span>
.</p>
<p>This allows the issuer to use the same wallet it usually uses to transfer Assets, while keeping a disconnect from the other keys. Specifically, this method is aligned with the requirements and motivation of ZIP 32 <a id="footnote-reference-17" class="footnote_reference" href="#zip-0032">2</a>. It provides further anonymity and the ability to delegate issuance of an Asset (or in the future, generate a multi-signature protocol) while the rest of the keys remain in the wallet safe.</p>
</section>
</section>
<section id="issuance-authorization-signing-and-validation"><h3><span class="section-heading">Issuance Authorization Signing and Validation</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-authorization-signing-and-validation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>Define
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{Sign}\; : \; (\mathsf{isk}\; : \; \mathsf{IssueAuthSig}.\!\mathsf{Private}) \times (M\; : \; \mathsf{IssueAuthSig}.\!\mathsf{Message}) \to \mathsf{IssueAuthSig}.\!\mathsf{Signature}\)</span>
as:</p>
<ul>
<li>Let the auxiliary data
<span class="math">\(a = [\mathtt{0x00}]^{32}\!\)</span>
.</li>
<li>Let
<span class="math">\(\text{σ} = \mathsf{Sign}(\mathsf{isk}, M)\!\)</span>
.</li>
<li>Return
<span class="math">\(\bot\)</span>
if the
<span class="math">\(\mathsf{Sign}\)</span>
algorithm fails in the previous step, otherwise return
<span class="math">\(\text{σ}\!\)</span>
.</li>
</ul>
<p>where the
<span class="math">\(\mathsf{Sign}\)</span>
algorithm is defined in BIP 340 and
<span class="math">\(a\)</span>
denotes the auxiliary data used in BIP 340 <a id="footnote-reference-18" class="footnote_reference" href="#bip-0340">16</a>. Note that
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{Sign}\)</span>
could return
<span class="math">\(\bot\)</span>
with very low probability.</p>
<p>Define
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{Validate}\; : \; (\mathsf{ik}\; : \; \mathsf{IssueAuthSig}.\!\mathsf{Public}) \times (M\; : \; \mathsf{IssueAuthSig}.\!\mathsf{Message}) \times (\text{σ}\; : \; \mathsf{IssueAuthSig}.\!\mathsf{Signature}) \to \mathbb{B}\)</span>
as:</p>
<ul>
<li>Return
<span class="math">\(0\)</span>
if
<span class="math">\(\text{σ} = \bot\!\)</span>
.</li>
<li>Return
<span class="math">\(1\)</span>
if
<span class="math">\(\mathsf{Verify}(\mathsf{ik}, M, \text{σ})\)</span>
succeeds, otherwise
<span class="math">\(0\!\)</span>
.</li>
</ul>
<p>where the
<span class="math">\(\mathsf{Verify}\)</span>
algorithm is defined in BIP 340 <a id="footnote-reference-19" class="footnote_reference" href="#bip-0340">16</a>.</p>
</section>
</section>
<section id="specification-asset-identifier"><h2><span class="section-heading">Specification: Asset Identifier</span><span class="section-anchor"> <a rel="bookmark" href="#specification-asset-identifier"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>For every new Asset, there must be a new and unique Asset Identifier, denoted
<span class="math">\(\mathsf{AssetId}\!\)</span>
. We define this to be a globally unique pair
<span class="math">\(\mathsf{AssetId} := (\mathsf{ik}, \mathsf{asset\_desc})\!\)</span>
, where
<span class="math">\(\mathsf{ik}\)</span>
is the issuance key and
<span class="math">\(\mathsf{asset\_desc}\)</span>
is a byte string.</p>
<p>A given Asset Identifier is used across all Zcash protocols that support ZSAs -- that is, the Orchard-ZSA protocol and potentially future Zcash shielded protocols. For this Asset Identifier, we derive an Asset Digest,
<span class="math">\(\mathsf{AssetDigest}\!\)</span>
, which is simply is a
<span class="math">\(\textsf{BLAKE2b-512}\)</span>
hash of the Asset Identifier. From the Asset Digest, we derive a specific Asset Base within each shielded protocol using the applicable hash-to-curve algorithm. This Asset Base is included in shielded notes.</p>
<p>Let</p>
<ul>
<li>
<span class="math">\(\mathsf{asset\_desc}\)</span>
be the asset description, which includes any information pertaining to the issuance, and is a byte sequence of up to 512 bytes which SHOULD be a well-formed UTF-8 code unit sequence according to Unicode 15.0.0 or later.</li>
<li>
<span class="math">\(\mathsf{ik}\)</span>
be the issuance validating key of the issuer, a public key used to verify the signature on the issuance transaction's SIGHASH.</li>
</ul>
<p>Define
<span class="math">\(\mathsf{AssetDigest_{AssetId}} := \textsf{BLAKE2b-512}(\texttt{"ZSA-Asset-Digest"},\; \mathsf{EncodeAssetId}(\mathsf{AssetId}))\!\)</span>
, where</p>
<ul>
<li>
<span class="math">\(\mathsf{EncodeAssetId}(\mathsf{AssetId}) = \mathsf{EncodeAssetId}((\mathsf{ik}, \mathsf{asset\_desc})) := \mathtt{0x00} || \mathsf{ik} || \mathsf{asset\_desc}\!\!\)</span>
.</li>
<li>Note that the initial
<span class="math">\(\mathtt{0x00}\)</span>
byte is a version byte.</li>
</ul>
<p>Define
<span class="math">\(\mathsf{AssetBase_{AssetId}} := \mathsf{ZSAValueBase}(\mathsf{AssetDigest_{AssetId}})\)</span>
</p>
<p>In the case of the Orchard-ZSA protocol, we define
<span class="math">\(\mathsf{ZSAValueBase}(\mathsf{AssetDigest_{AssetId}}) := \mathsf{GroupHash}^\mathbb{P}(\texttt{"z.cash:OrchardZSA"}, \mathsf{AssetDigest_{AssetId}})\)</span>
where
<span class="math">\(\mathsf{GroupHash}^\mathbb{P}\)</span>
is defined as in <a id="footnote-reference-20" class="footnote_reference" href="#protocol-concretegrouphashpallasandvesta">20</a>.</p>
<p>The relations between the Asset Identifier, Asset Digest, and Asset Base are shown in the following diagram:</p>
<figure class="align-center" align="center">
<img width="600" src="zip-0227-asset-identifier-relation.png" alt="" />
<figcaption>Diagram relating the Asset Identifier, Asset Digest, and Asset Base in the ZSA Protocol</figcaption>
</figure>
<p><strong>Note:</strong> To keep notations light and concise, we may omit
<span class="math">\(\mathsf{AssetId}\)</span>
(resp.
<span class="math">\(\mathsf{Protocol}\!\)</span>
) in the subscript (resp. superscript) when the Asset Identifier (resp. Protocol) is clear from the context.</p>
<p>Wallets MUST NOT display just the
<span class="math">\(\mathsf{asset\_desc}\)</span>
string to their users as the name of the Asset. Some possible alternatives include:</p>
<ul>
<li>Wallets could allow clients to provide an additional configuration file that stores a one-to-one mapping of names to Asset Identifiers via a petname system. This allows clients to rename the Assets in a way they find useful. Default versions of this file with well-known Assets listed can be made available online as a starting point for clients.</li>
<li>The Asset Digest could be used as a more compact bytestring to uniquely determine an Asset, and wallets could support clients scanning QR codes to load Asset information into their wallets.</li>
</ul>
</section>
<section id="specification-global-issuance-state"><h2><span class="section-heading">Specification: Global Issuance State</span><span class="section-anchor"> <a rel="bookmark" href="#specification-global-issuance-state"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>Issuance requires the following additions to the global state defined at block boundaries:</p>
<ul>
<li>
<span class="math">\(\mathsf{previously\_finalized}\!\)</span>
, a set of
<span class="math">\(\mathsf{AssetId}\)</span>
that have been finalized (i.e.: the
<span class="math">\(\mathsf{finalize}\)</span>
flag has been set to
<span class="math">\(1\)</span>
in some issuance transaction preceding the block boundary).</li>
</ul>
</section>
<section id="specification-issuance-action-issuance-bundle-and-issuance-protocol"><h2><span class="section-heading">Specification: Issuance Action, Issuance Bundle and Issuance Protocol</span><span class="section-anchor"> <a rel="bookmark" href="#specification-issuance-action-issuance-bundle-and-issuance-protocol"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<section id="issuance-action-description"><h3><span class="section-heading">Issuance Action Description</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-action-description"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>An issuance action, <code>IssueAction</code>, is the instance of issuing a specific Custom Asset, and contains the following fields:</p>
<ul>
<li><code>assetDescSize</code>: the size of the Asset description, a number between
<span class="math">\(0\)</span>
and
<span class="math">\(512\!\)</span>
, stored in two bytes.</li>
<li><code>asset_desc</code>: the Asset description, a byte string of up to 512 bytes as defined in the <a href="#specification-asset-identifier">Specification: Asset Identifier</a> section.</li>
<li><code>vNotes</code>: an array of <code>Note</code> containing the unencrypted output notes of the recipients of the Asset.</li>
<li><code>flagsIssuance</code>: a byte that stores the
<span class="math">\(\mathsf{finalize}\)</span>
boolean that defines whether the issuance of that specific Custom Asset is finalized or not.</li>
</ul>
<p>An asset's
<span class="math">\(\mathsf{AssetDigest}\)</span>
is added to the
<span class="math">\(\mathsf{previously\_finalized}\)</span>
set after a block that contains any issuance transaction for that asset with
<span class="math">\(\mathsf{finalize} = 1\!\)</span>
. It then cannot be removed from this set. For Assets with
<span class="math">\(\mathsf{AssetDigest} \in \mathsf{previously\_finalized}\!\)</span>
, no further tokens can be issued, so as seen below, the validators will reject the transaction. For Assets with
<span class="math">\(\mathsf{AssetDigest} \not\in \mathsf{previously\_finalized}\!\)</span>
, new issuance actions can be issued in future transactions. These must use the same Asset description,
<span class="math">\(\mathsf{asset\_desc}\!\)</span>
, and can either maintain
<span class="math">\(\mathsf{finalize} = 0\)</span>
or change it to
<span class="math">\(\mathsf{finalize} = 1\!\)</span>
, denoting that this Custom Asset cannot be issued after the containing block.</p>
<table>
<thead>
<tr>
<th>Bytes</th>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>assetDescSize</code></td>
<td><code>byte</code></td>
<td>The length of the <code>asset_desc</code> string in bytes.</td>
</tr>
<tr>
<td><code>assetDescSize</code></td>
<td><code>asset_desc</code></td>
<td><code>byte[assetDescSize]</code></td>
<td>A byte sequence of length <code>assetDescSize</code> bytes which SHOULD be a well-formed UTF-8 code unit sequence according to Unicode 15.0.0 or later.</td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>nNotes</code></td>
<td><code>compactSize</code></td>
<td>The number of notes in the issuance action.</td>
</tr>
<tr>
<td><code>noteSize * nNotes</code></td>
<td><code>vNotes</code></td>
<td><code>Note[nNotes]</code></td>
<td>A sequence of note descriptions within the issuance action, where <code>noteSize</code> is the size, in bytes, of a Note.</td>
</tr>
<tr>
<td><code>1</code></td>
<td><code>flagsIssuance</code></td>
<td><code>byte</code></td>
<td>
<dl>
<dt>An 8-bit value representing a set of flags. Ordered from LSB to MSB:</dt>
<dd>
<ul>
<li>
<span class="math">\(\mathsf{finalize}\)</span>
</li>
<li>The remaining bits are set to
<span class="math">\(0\!\)</span>
.</li>
</ul>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<p>We note that the output note commitment of the recipient's notes are not included in the actual transaction, but when added to the global state of the chain, they will be added to the note commitment tree as a shielded note. This prevents future usage of the note from being linked to the issuance transaction, as the nullifier key is not known to the validators and chain observers.</p>
</section>
<section id="issuance-bundle"><h3><span class="section-heading">Issuance Bundle</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-bundle"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>An issuance bundle, <code>IssueBundle</code>, is the aggregate of all the issuance-related information. Specifically, contains all the issuance actions and the issuer signature on the transaction SIGHASH that validates the issuance itself. It contains the following fields:</p>
<ul>
<li>
<span class="math">\(\mathsf{ik}\)</span>
: the issuance validating key, that allows the validators to verify that the
<span class="math">\(\mathsf{AssetId}\)</span>
is properly associated with the issuer.</li>
<li><code>vIssueActions</code>: an array of issuance actions, of type <code>IssueAction</code>.</li>
<li>
<span class="math">\(\mathsf{issueAuthSig}\)</span>
: the signature of the transaction SIGHASH, signed by the issuance authorizing key,
<span class="math">\(\mathsf{isk}\!\)</span>
, that validates the issuance.</li>
</ul>
<p>The issuance bundle is then added within the transaction format as a new bundle. That is, issuance requires the addition of the following information to the transaction format <a id="footnote-reference-21" class="footnote_reference" href="#protocol-txnencoding">22</a>.</p>
<table>
<thead>
<tr>
<th>Bytes</th>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>varies</code></td>
<td><code>nIssueActions</code></td>
<td><code>compactSize</code></td>
<td>The number of issuance actions in the bundle.</td>
</tr>
<tr>
<td><code>IssueActionSize * nIssueActions</code></td>
<td><code>vIssueActions</code></td>
<td><code>IssueAction[nIssueActions]</code></td>
<td>A sequence of issuance action descriptions, where IssueActionSize is the size, in bytes, of an IssueAction description.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>ik</code></td>
<td><code>byte[32]</code></td>
<td>The issuance validating key of the issuer, used to validate the signature.</td>
</tr>
<tr>
<td><code>64</code></td>
<td><code>issueAuthSig</code></td>
<td><code>byte[64]</code></td>
<td>The signature of the transaction SIGHASH, signed by the issuer, validated as in <a href="#issuance-authorization-signature-scheme">Issuance Authorization Signature Scheme</a>.</td>
</tr>
</tbody>
</table>
</section>
<section id="issuance-protocol"><h3><span class="section-heading">Issuance Protocol</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-protocol"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The issuer program performs the following operations:</p>
<p>For all actions <code>IssueAction</code>:</p>
<ul>
<li>encode
<span class="math">\(\mathsf{asset\_desc}\)</span>
as a UTF-8 byte string of size up to 512.</li>
<li>compute
<span class="math">\(\mathsf{AssetDigest}\)</span>
from the issuance validating key
<span class="math">\(\mathsf{ik}\)</span>
and
<span class="math">\(\mathsf{asset\_desc}\)</span>
as decribed in the <a href="#specification-asset-identifier">Specification: Asset Identifier</a> section.</li>
<li>compute
<span class="math">\(\mathsf{AssetBase}\)</span>
from
<span class="math">\(\mathsf{AssetDigest}\)</span>
as decribed in the <a href="#specification-asset-identifier">Specification: Asset Identifier</a> section.</li>
<li>set the
<span class="math">\(\mathsf{finalize}\)</span>
boolean as desired (if more issuance actions are to be created for this
<span class="math">\(\mathsf{AssetBase}\!\)</span>
, set
<span class="math">\(\mathsf{finalize} = 0\!\)</span>
, otherwise set
<span class="math">\(\mathsf{finalize} = 1\!\)</span>
).</li>
<li>for each recipient
<span class="math">\(i\)</span>
:
<ul>
<li>generate a ZSA output note that includes the Asset Base. For an Orchard-ZSA note this is
<span class="math">\(\mathsf{note}_i = (\mathsf{d}_i, \mathsf{pk}_{\mathsf{d}_i}, \mathsf{v}_i, \text{ρ}_i, \mathsf{rseed}_i, \mathsf{AssetBase}, \mathsf{rcm}_i)\!\)</span>
.</li>
</ul>
</li>
<li>encode the <code>IssueAction</code> into the vector <code>vIssueActions</code> of the bundle.</li>
</ul>
<p>For the <code>IssueBundle</code>:</p>
<ul>
<li>encode the <code>vIssueActions</code> vector.</li>
<li>encode the
<span class="math">\(\mathsf{ik}\)</span>
as 32 byte-string.</li>
<li>sign the SIGHASH transaction hash with the issuance authorizing key,
<span class="math">\(\mathsf{isk}\!\)</span>
, using the
<span class="math">\(\mathsf{IssueAuthSig}\)</span>
signature scheme. The signature is then added to the issuance bundle.</li>
</ul>
<p><strong>Note:</strong> that the commitment is not included in the <code>IssuanceAction</code> itself. As explained below, it is computed later by the validators and added to the note commitment tree.</p>
</section>
</section>
<section id="specification-consensus-rule-changes"><h2><span class="section-heading">Specification: Consensus Rule Changes</span><span class="section-anchor"> <a rel="bookmark" href="#specification-consensus-rule-changes"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>For the <code>IssueBundle</code>:</p>
<ul>
<li>Validate the issuance authorization signature,
<span class="math">\(\mathsf{issueAuthSig}\!\)</span>
, on the SIGHASH transaction hash,
<span class="math">\(\mathsf{SigHash}\!\)</span>
, by invoking
<span class="math">\(\mathsf{IssueAuthSig}.\!\mathsf{Validate}(\mathsf{ik}, \mathsf{SigHash}, \mathsf{issueAuthSig})\!\)</span>
.</li>
</ul>
<p>For each <code>IssueAction</code> in <code>IssueBundle</code>:</p>
<ul>
<li>check that
<span class="math">\(0 &lt; \mathtt{assetDescSize} \leq 512\!\)</span>
.</li>
<li>check that
<span class="math">\(\mathsf{asset\_desc}\)</span>
is a string of length
<span class="math">\(\mathtt{assetDescSize}\)</span>
bytes.</li>
<li>retrieve
<span class="math">\(\mathsf{AssetBase}\)</span>
from the first note in the sequence and check that
<span class="math">\(\mathsf{AssetBase}\)</span>
is derived from the issuance validating key
<span class="math">\(\mathsf{ik}\)</span>
and
<span class="math">\(\mathsf{asset\_desc}\)</span>
as described in the <a href="#specification-asset-identifier">Specification: Asset Identifier</a> section.</li>
<li>check that the
<span class="math">\(\mathsf{AssetDigest}\)</span>
does not exist in the
<span class="math">\(\mathsf{previously\_finalized}\)</span>
set in the global state.</li>
<li>check that every note in the <code>IssueAction</code> contains the same
<span class="math">\(\mathsf{AssetBase}\)</span>
and is properly constructed as
<span class="math">\(\mathsf{note} = (\mathsf{g_d}, \mathsf{pk_d}, \mathsf{v}, \text{ρ}, \mathsf{rseed}, \mathsf{AssetBase})\!\)</span>
.</li>
</ul>
<p>If all of the above checks pass, do the following:</p>
<ul>
<li>For each note, compute the note commitment as
<span class="math">\(\mathsf{cm} = \mathsf{NoteCommit^{OrchardZSA}_{rcm}}(\mathsf{repr}_{\mathbb{P}}(\mathsf{g_d}), \mathsf{repr}_{\mathbb{P}}(\mathsf{pk_d}), \mathsf{v}, \text{ρ}, \text{ψ}, \mathsf{AssetBase})\)</span>
as defined in the Note Structure and Commitment section of ZIP 226 <a id="footnote-reference-22" class="footnote_reference" href="#zip-0226-notestructure">10</a> and</li>
<li>Add
<span class="math">\(\mathsf{cm}\)</span>
to the Merkle tree of note commitments.</li>
<li>If
<span class="math">\(\mathsf{finalize} = 1\!\)</span>
, add
<span class="math">\(\mathsf{AssetDigest}\)</span>
to the
<span class="math">\(\mathsf{previously\_finalized}\)</span>
set immediately after the block in which this transaction occurs.</li>
<li>(Replay Protection) If issue bundle is present, the fees MUST be greater than zero.</li>
</ul>
</section>
<section id="rationale"><h2><span class="section-heading">Rationale</span><span class="section-anchor"> <a rel="bookmark" href="#rationale"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The following is a list of rationale for different decisions made in the proposal:</p>
<ul>
<li>The issuance key structure is independent of the original key tree, but derived in an analogous manner (via ZIP 32). This is in order to keep the issuance details and the Asset Identifiers consistent across multiple shielded pools.</li>
<li>The design decision is not to have a chosen name to describe the Custom Asset, but to delegate it to an off-chain mapping, as this would imply a land-grab “war”.</li>
<li>The
<span class="math">\(\mathsf{asset\_desc}\)</span>
is a general byte string in order to allow for a wide range of information type to be included that may be associated with the Assets. Some are:
<ul>
<li>links for storage such as for NFTs.</li>
<li>metadata for Assets, encoded in any format.</li>
<li>bridging information for Wrapped Assets (chain of origin, issuer name, etc)</li>
<li>information to be committed by the issuer, though not enforceable by the protocol.</li>
</ul>
</li>
<li>We require a check whether the
<span class="math">\(\mathsf{finalize}\)</span>
flag only has been set in a previous block rather than a previous transaction in the same block. In other words, we only update the
<span class="math">\(\mathsf{previously\_finalized}`\)</span>
set at the block boundary. This is in keeping with the current property which allows for a miner to reorder transactions in a block without changing the meaning, which we aim to preserve.</li>
<li>We require non-zero fees in the presence of an issue bundle, in order to preclude the possibility of a transaction containing only an issue bundle. If a transaction includes only an issue bundle, the SIGHASH transaction hash would be computed solely based on the issue bundle. A duplicate bundle would have the same SIGHASH transaction hash, potentially allowing for a replay attack.</li>
</ul>
<section id="concrete-applications"><h3><span class="section-heading">Concrete Applications</span><span class="section-anchor"> <a rel="bookmark" href="#concrete-applications"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p><strong>Asset Features</strong></p>
<ul>
<li>By using the
<span class="math">\(\mathsf{finalize}\)</span>
boolean and the burning mechanism defined in <a id="footnote-reference-23" class="footnote_reference" href="#zip-0226">9</a>, issuers can control the supply production of any Asset associated to their issuer keys. For example,
<ul>
<li>by setting
<span class="math">\(\mathsf{finalize} = 1\)</span>
from the first issuance action for that Asset Identifier, the issuer is in essence creating a one-time issuance transaction. This is useful when the max supply is capped from the beginning and the distribution is known in advance. All tokens are issued at once and distributed as needed.</li>
</ul>
</li>
<li>Issuers can also stop the existing supply production of any Asset associated to their issuer keys. This could be done by
<ul>
<li>issuing a last set of tokens of that specific
<span class="math">\(\mathsf{AssetId}\!\)</span>
, for which
<span class="math">\(\mathsf{finalize} = 1\!\)</span>
, or by</li>
<li>issuing a transaction with a single note in the issuance action pertaining to that
<span class="math">\(\mathsf{AssetId}\!\)</span>
, where the note will contain a
<span class="math">\(\mathsf{value} = 0\!\)</span>
. This can be used for application-specific purposes (NFT collections) or for security purposes to revoke the Asset issuance (see Security and Privacy Considerations).</li>
<li>Note in the above cases, that the setting of the
<span class="math">\(\mathsf{finalize}\)</span>
flag will take effect at the block boundary, that is, after all the transactions in the block.</li>
</ul>
</li>
<li>The issuance and burn mechanisms can be used in conjunction to determine the supply of Assets on the Zcash ecosystem. This allows for the bridging of Assets defined on other chains.</li>
<li>Furthermore, NFT issuance is enabled by issuing in a single bundle several issuance actions, where each
<span class="math">\(\mathsf{AssetId}\)</span>
corresponds to
<span class="math">\(\mathsf{value} = 1\)</span>
at the fundamental unit level. Issuers and users should make sure that
<span class="math">\(\mathsf{finalize} = 1\)</span>
for each of the actions in this scenario.</li>
</ul>
</section>
</section>
<section id="txid-digest-issuance"><h2><span class="section-heading">TxId Digest - Issuance</span><span class="section-anchor"> <a rel="bookmark" href="#txid-digest-issuance"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This section details the construction of the subtree of hashes in the transaction digest that corresponds to issuance transaction data. Details of the overall changes to the transaction digest due to the Orchard-ZSA protocol can be found in ZIP 226 <a id="footnote-reference-24" class="footnote_reference" href="#zip-0226-txiddigest">11</a>. As in ZIP 244 <a id="footnote-reference-25" class="footnote_reference" href="#zip-0244">12</a>, the digests are all personalized BLAKE2b-256 hashes, and in cases where no elements are available for hashing, a personalized hash of the empty byte array is used.</p>
<p>A new issuance transaction digest algorithm is defined that constructs the subtree of the transaction digest tree of hashes for the issuance portion of a transaction. Each branch of the subtree will correspond to a specific subset of issuance transaction data. The overall structure of the hash is as follows; each name referenced here will be described in detail below:</p>
<pre>issuance_digest
├── issue_actions_digest
│   ├── issue_notes_digest
│   ├── assetDescription
│   └── flagsIssuance
└── issuanceValidatingKey</pre>
<p>In the specification below, nodes of the tree are presented in depth-first order.</p>
<section id="t-5-issuance-digest"><h3><span class="section-heading">T.5: issuance_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-5-issuance-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>A BLAKE2b-256 hash of the following values</p>
<pre>T.5a: issue_actions_digest (32-byte hash output)
T.5b: issuanceValidatingKey (32 bytes)</pre>
<p>The personalization field of this hash is set to:</p>
<pre>"ZTxIdSAIssueHash"</pre>
<p>In case the transaction has no issuance components, ''issue_actions_digest'' is:</p>
<pre>BLAKE2b-256("ZTxIdSAIssueHash", [])</pre>
<section id="t-5a-issue-actions-digest"><h4><span class="section-heading">T.5a: issue_actions_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-issue-actions-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>A BLAKE2b-256 hash of Issue Action information for all Issuance Actions belonging to the transaction. For each Action, the following elements are included in the hash:</p>
<pre>T.5a.i : notes_digest (32-byte hash output)
T.5a.ii : assetDescription (field encoding bytes)
T.5a.iii: flagsIssuance (1 byte)</pre>
<p>The personalization field of this hash is set to:</p>
<pre>"ZTxIdIssuActHash"</pre>
<section id="t-5a-i-issue-notes-digest"><h5><span class="section-heading">T.5a.i: issue_notes_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-i-issue-notes-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h5>
<p>A BLAKE2b-256 hash of Note information for all Notes belonging to the Issuance Action. For each Note, the following elements are included in the hash:</p>
<pre>T.5a.i.1: recipient (field encoding bytes)
T.5a.i.2: value (field encoding bytes)
T.5a.i.3: assetBase (field encoding bytes)
T.5a.i.4: rho (field encoding bytes)
T.5a.i.5: rseed (field encoding bytes)</pre>
<p>The personalization field of this hash is set to:</p>
<pre>"ZTxIdIAcNoteHash"</pre>
<section id="t-5a-i-1-recipient"><h6><span class="section-heading">T.5a.i.1: recipient</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-i-1-recipient"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h6>
<p>This is the raw encoding of an Orchard shielded payment address as defined in the protocol specification <a id="footnote-reference-26" class="footnote_reference" href="#protocol-orchardpaymentaddrencoding">21</a>.</p>
</section>
<section id="t-5a-i-2-value"><h6><span class="section-heading">T.5a.i.2: value</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-i-2-value"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h6>
<p>Note value encoded as little-endian 8-byte representation of 64-bit unsigned integer (e.g. u64 in Rust) raw value.</p>
</section>
<section id="t-5a-i-3-assetbase"><h6><span class="section-heading">T.5a.i.3: assetBase</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-i-3-assetbase"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h6>
<p>Asset Base encoded as the 32-byte representation of a point on the Pallas curve.</p>
</section>
<section id="t-5a-i-4-rho"><h6><span class="section-heading">T.5a.i.4: rho</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-i-4-rho"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h6>
<p>Nullifier encoded as 32-byte representation of a point on the Pallas curve.</p>
</section>
<section id="t-5a-i-5-rseed"><h6><span class="section-heading">T.5a.i.5: rseed</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-i-5-rseed"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h6>
<p>The ZIP 212 32-byte seed randomness for a note.</p>
</section>
</section>
<section id="t-5a-ii-assetdescription"><h5><span class="section-heading">T.5a.ii: assetDescription</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-ii-assetdescription"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h5>
<p>The Asset description byte string.</p>
</section>
<section id="t-5a-iii-flagsissuance"><h5><span class="section-heading">T.5a.iii: flagsIssuance</span><span class="section-anchor"> <a rel="bookmark" href="#t-5a-iii-flagsissuance"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h5>
<p>An 8-bit value representing a set of flags. Ordered from LSB to MSB:</p>
<ul>
<li>
<span class="math">\(\mathsf{finalize}\)</span>
</li>
<li>The remaining bits are set to <cite>0!</cite>.</li>
</ul>
</section>
</section>
<section id="t-5b-issuancevalidatingkey"><h4><span class="section-heading">T.5b: issuanceValidatingKey</span><span class="section-anchor"> <a rel="bookmark" href="#t-5b-issuancevalidatingkey"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>A byte encoding of issuance validating key for the bundle as defined in the <a href="#issuance-key-derivation">Issuance Key Derivation</a> section.</p>
</section>
</section>
</section>
<section id="signature-digest"><h2><span class="section-heading">Signature Digest</span><span class="section-anchor"> <a rel="bookmark" href="#signature-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The per-input transaction digest algorithm to generate the signature digest in ZIP 244 <a id="footnote-reference-27" class="footnote_reference" href="#zip-0244-sigdigest">13</a> is modified so that a signature digest is produced for each transparent input, each Sapling input, each Orchard action, and additionally for each Issuance Action. For Issuance Actions, this algorithm has the exact same output as the transaction digest algorithm, thus the txid may be signed directly.</p>
<p>The overall structure of the hash is as follows. We highlight the changes for the Orchard-ZSA protocol via the <code>[ADDED FOR ZSA]</code> text label, and we omit the descriptions of the sections that do not change for the Orchard-ZSA protocol:</p>
<pre>signature_digest
├── header_digest
├── transparent_sig_digest
├── sapling_digest
├── orchard_digest
└── issuance_digest [ADDED FOR ZSA]</pre>
<section id="signature-digest-1"><h3><span class="section-heading">signature_digest</span><span class="section-anchor"> <a rel="bookmark" href="#signature-digest-1"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>A BLAKE2b-256 hash of the following values</p>
<pre>S.1: header_digest (32-byte hash output)
S.2: transparent_sig_digest (32-byte hash output)
S.3: sapling_digest (32-byte hash output)
S.4: orchard_digest (32-byte hash output)
S.5: issuance_digest (32-byte hash output) [ADDED FOR ZSA]</pre>
<p>The personalization field remains the same as in ZIP 244 <a id="footnote-reference-28" class="footnote_reference" href="#zip-0244">12</a>.</p>
<section id="s-5-issuance-digest"><h4><span class="section-heading">S.5: issuance_digest</span><span class="section-anchor"> <a rel="bookmark" href="#s-5-issuance-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>Identical to that specified for the transaction identifier.</p>
</section>
</section>
</section>
<section id="authorizing-data-commitment"><h2><span class="section-heading">Authorizing Data Commitment</span><span class="section-anchor"> <a rel="bookmark" href="#authorizing-data-commitment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The transaction digest algorithm defined in ZIP 244 <a id="footnote-reference-29" class="footnote_reference" href="#zip-0244-authcommitment">14</a> which commits to the authorizing data of a transaction is modified by the Orchard-ZSA protocol to have the following structure. We highlight the changes for the Orchard-ZSA protocol via the <code>[ADDED FOR ZSA]</code> text label, and we omit the descriptions of the sections that do not change for the Orchard-ZSA protocol:</p>
<pre>auth_digest
├── transparent_scripts_digest
├── sapling_auth_digest
├── orchard_auth_digest
└── issuance_auth_digest [ADDED FOR ZSA]</pre>
<p>The pair (Transaction Identifier, Auth Commitment) constitutes a commitment to all the data of a serialized transaction that may be included in a block.</p>
<section id="auth-digest"><h3><span class="section-heading">auth_digest</span><span class="section-anchor"> <a rel="bookmark" href="#auth-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>A BLAKE2b-256 hash of the following values</p>
<pre>A.1: transparent_scripts_digest (32-byte hash output)
A.2: sapling_auth_digest (32-byte hash output)
A.3: orchard_auth_digest (32-byte hash output)
A.4: issuance_auth_digest (32-byte hash output) [ADDED FOR ZSA]</pre>
<p>The personalization field of this hash remains the same as in ZIP 244.</p>
<section id="a-4-issuance-auth-digest"><h4><span class="section-heading">A.4: issuance_auth_digest</span><span class="section-anchor"> <a rel="bookmark" href="#a-4-issuance-auth-digest"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>In the case that Issuance Actions are present, this is a BLAKE2b-256 hash of the field encoding of the <code>issueAuthSig</code> field of the transaction:</p>
<pre>A.4a: issueAuthSig (field encoding bytes)</pre>
<p>The personalization field of this hash is set to:</p>
<pre>"ZTxAuthZSAOrHash"</pre>
<p>In the case that the transaction has no Orchard Actions, <code>issuance_auth_digest</code> is</p>
<pre>BLAKE2b-256("ZTxAuthZSAOrHash", [])</pre>
</section>
</section>
</section>
<section id="security-and-privacy-considerations"><h2><span class="section-heading">Security and Privacy Considerations</span><span class="section-anchor"> <a rel="bookmark" href="#security-and-privacy-considerations"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<section id="displaying-asset-identifier-information-to-users"><h3><span class="section-heading">Displaying Asset Identifier information to users</span><span class="section-anchor"> <a rel="bookmark" href="#displaying-asset-identifier-information-to-users"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>Wallets need to communicate the names of the Assets in a non-confusing way to users, since the byte representation of the Asset Identifier would be hard to read for an end user. Possible solutions are provided in the <a href="#specification-asset-identifier">Specification: Asset Identifier</a> section.</p>
</section>
<section id="issuance-key-compromise"><h3><span class="section-heading">Issuance Key Compromise</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-key-compromise"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The design of this protocol does not currently allow for rotation of the issuance validating key that would allow for replacing the key of a specific Asset. In case of compromise, the following actions are recommended:</p>
<ul>
<li>If an issuance validating key is compromised, the
<span class="math">\(\mathsf{finalize}\)</span>
boolean for all the Assets issued with that key should be set to
<span class="math">\(1\)</span>
and the issuer should change to a new issuance authorizing key, and issue new Assets, each with a new
<span class="math">\(\mathsf{AssetId}\!\)</span>
.</li>
</ul>
</section>
<section id="bridging-assets"><h3><span class="section-heading">Bridging Assets</span><span class="section-anchor"> <a rel="bookmark" href="#bridging-assets"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>For bridging purposes, the secure method of off-boarding Assets is to burn an Asset with the burning mechanism in ZIP 226 <a id="footnote-reference-30" class="footnote_reference" href="#zip-0226">9</a>. Users should be aware of issuers that demand the Assets be sent to a specific address on the Zcash chain to be redeemed elsewhere, as this may not reflect the real reserve value of the specific Wrapped Asset.</p>
</section>
</section>
<section id="other-considerations"><h2><span class="section-heading">Other Considerations</span><span class="section-anchor"> <a rel="bookmark" href="#other-considerations"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<section id="implementing-zcash-nodes"><h3><span class="section-heading">Implementing Zcash Nodes</span><span class="section-anchor"> <a rel="bookmark" href="#implementing-zcash-nodes"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>Although not enforced in the global state, it is RECOMMENDED that Zcash full validators keep track of the total supply of Assets as a mutable mapping
<span class="math">\(\mathsf{issuanceSupplyInfoMap}\)</span>
from
<span class="math">\(\mathsf{AssetId}\)</span>
to
<span class="math">\((\mathsf{totalSupply}, \mathsf{finalize})\)</span>
in order to properly keep track of the total supply for different Asset Identifiers. This is useful for wallets and other applications that need to keep track of the total supply of Assets.</p>
</section>
<section id="fee-structures"><h3><span class="section-heading">Fee Structures</span><span class="section-anchor"> <a rel="bookmark" href="#fee-structures"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The fee mechanism described in this ZIP will follow the mechanism described in ZIP 317 <a id="footnote-reference-31" class="footnote_reference" href="#zip-0317b">15</a>.</p>
</section>
</section>
<section id="test-vectors"><h2><span class="section-heading">Test Vectors</span><span class="section-anchor"> <a rel="bookmark" href="#test-vectors"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<ul>
<li>LINK TBD</li>
</ul>
</section>
<section id="reference-implementation"><h2><span class="section-heading">Reference Implementation</span><span class="section-anchor"> <a rel="bookmark" href="#reference-implementation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<ul>
<li>LINK TBD</li>
<li>LINK TBD</li>
</ul>
</section>
<section id="deployment"><h2><span class="section-heading">Deployment</span><span class="section-anchor"> <a rel="bookmark" href="#deployment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This ZIP is proposed to activate with Network Upgrade 6.</p>
</section>
<section id="references"><h2><span class="section-heading">References</span><span class="section-anchor"> <a rel="bookmark" href="#references"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<table id="bcp14" class="footnote">
<tbody>
<tr>
<th>1</th>
<td><a href="https://www.rfc-editor.org/info/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"</a></td>
</tr>
</tbody>
</table>
<table id="zip-0032" class="footnote">
<tbody>
<tr>
<th>2</th>
<td><a href="zip-0032.html">ZIP 32: Shielded Hierarchical Deterministic Wallets</a></td>
</tr>
</tbody>
</table>
<table id="zip-0032-orchard-master" class="footnote">
<tbody>
<tr>
<th>3</th>
<td><a href="zip-0032.html#orchard-master-key-generation">ZIP 32: Shielded Hierarchical Deterministic Wallets - Orchard master key generation</a></td>
</tr>
</tbody>
</table>
<table id="zip-0032-orchard-child-key-derivation" class="footnote">
<tbody>
<tr>
<th>4</th>
<td><a href="zip-0032.html#orchard-child-key-derivation">ZIP 32: Shielded Hierarchical Deterministic Wallets - Orchard child key derivation</a></td>
</tr>
</tbody>
</table>
<table id="zip-0032-key-path-levels" class="footnote">
<tbody>
<tr>
<th>5</th>
<td><a href="zip-0032.html#key-path-levels">ZIP 32: Shielded Hierarchical Deterministic Wallets - Key path levels</a></td>
</tr>
</tbody>
</table>
<table id="zip-0032-orchard-key-path" class="footnote">
<tbody>
<tr>
<th>6</th>
<td><a href="zip-0032.html#orchard-key-path">ZIP 32: Shielded Hierarchical Deterministic Wallets - Orchard key path</a></td>
</tr>
</tbody>
</table>
<table id="zip-0200" class="footnote">
<tbody>
<tr>
<th>7</th>
<td><a href="zip-0200.html">ZIP 200: Network Upgrade Mechanism</a></td>
</tr>
</tbody>
</table>
<table id="zip-0224" class="footnote">
<tbody>
<tr>
<th>8</th>
<td><a href="zip-0224.html">ZIP 224: Orchard</a></td>
</tr>
</tbody>
</table>
<table id="zip-0226" class="footnote">
<tbody>
<tr>
<th>9</th>
<td><a href="zip-0226.html">ZIP 226: Transfer and Burn of Zcash Shielded Assets</a></td>
</tr>
</tbody>
</table>
<table id="zip-0226-notestructure" class="footnote">
<tbody>
<tr>
<th>10</th>
<td><a href="zip-0226.html#note-structure-commitment">ZIP 226: Transfer and Burn of Zcash Shielded Assets - Note Structure &amp; Commitment</a></td>
</tr>
</tbody>
</table>
<table id="zip-0226-txiddigest" class="footnote">
<tbody>
<tr>
<th>11</th>
<td><a href="zip-0226.html#txid-digest">ZIP 226: Transfer and Burn of Zcash Shielded Assets - TxId Digest</a></td>
</tr>
</tbody>
</table>
<table id="zip-0244" class="footnote">
<tbody>
<tr>
<th>12</th>
<td><a href="zip-0244.html">ZIP 244: Transaction Identifier Non-Malleability</a></td>
</tr>
</tbody>
</table>
<table id="zip-0244-sigdigest" class="footnote">
<tbody>
<tr>
<th>13</th>
<td><a href="zip-0244.html#signature-digest">ZIP 244: Transaction Identifier Non-Malleability: Signature Digest</a></td>
</tr>
</tbody>
</table>
<table id="zip-0244-authcommitment" class="footnote">
<tbody>
<tr>
<th>14</th>
<td><a href="zip-0244.html#authorizing-data-commitment">ZIP 244: Transaction Identifier Non-Malleability: Authorizing Data Commitment</a></td>
</tr>
</tbody>
</table>
<table id="zip-0317b" class="footnote">
<tbody>
<tr>
<th>15</th>
<td><a href="https://github.com/zcash/zips/pull/667">ZIP 317: Proportional Transfer Fee Mechanism</a></td>
</tr>
</tbody>
</table>
<table id="bip-0340" class="footnote">
<tbody>
<tr>
<th>16</th>
<td><a href="https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki">BIP 340: Schnorr Signatures for secp256k1</a></td>
</tr>
</tbody>
</table>
<table id="protocol-notation" class="footnote">
<tbody>
<tr>
<th>17</th>
<td><a href="protocol/protocol.pdf#notation">Zcash Protocol Specification, Version 2023.4.0. Section 2: Notation</a></td>
</tr>
</tbody>
</table>
<table id="protocol-addressesandkeys" class="footnote">
<tbody>
<tr>
<th>18</th>
<td><a href="protocol/protocol.pdf#addressesandkeys">Zcash Protocol Specification, Version 2023.4.0. Section 3.1: Payment Addresses and Keys</a></td>
</tr>
</tbody>
</table>
<table id="protocol-orchardkeycomponents" class="footnote">
<tbody>
<tr>
<th>19</th>
<td><a href="protocol/protocol.pdf#orchardkeycomponents">Zcash Protocol Specification, Version 2023.4.0. Section 4.2.3: Orchard Key Components</a></td>
</tr>
</tbody>
</table>
<table id="protocol-concretegrouphashpallasandvesta" class="footnote">
<tbody>
<tr>
<th>20</th>
<td><a href="protocol/protocol.pdf#concretegrouphashpallasandvesta">Zcash Protocol Specification, Version 2023.4.0. Section 5.4.9.8: Group Hash into Pallas and Vesta</a></td>
</tr>
</tbody>
</table>
<table id="protocol-orchardpaymentaddrencoding" class="footnote">
<tbody>
<tr>
<th>21</th>
<td><a href="protocol/protocol.pdf#orchardpaymentaddrencoding">Zcash Protocol Specification, Version 2023.4.0. Section 5.6.4.2: Orchard Raw Payment Addresses</a></td>
</tr>
</tbody>
</table>
<table id="protocol-txnencoding" class="footnote">
<tbody>
<tr>
<th>22</th>
<td><a href="protocol/protocol.pdf#txnencoding">Zcash Protocol Specification, Version 2023.4.0. Section 7.1: Transaction Encoding and Consensus (Transaction Version 5)</a></td>
</tr>
</tbody>
</table>
</section>
</section>
</body>
</html>

View File

@ -3,21 +3,644 @@
<head>
<title>ZIP 230: Version 6 Transaction Format</title>
<meta charset="utf-8" />
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js?config=TeX-AMS-MML_HTMLorMML"></script>
<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"></head>
<body>
<section>
<pre>ZIP: 230
Title: Version 6 Transaction Format
Owners: Daira Emma Hopwood &lt;daira@electriccoin.co&gt;
Owners: Daira-Emma Hopwood &lt;daira@electriccoin.co&gt;
Jack Grigg &lt;jack@electriccoin.co&gt;
Sean Bowe &lt;sean@electriccoin.co&gt;
Kris Nuttycombe &lt;kris@electriccoin.co&gt;
Pablo Kogan &lt;pablo@qed-it.com&gt;
Vivek Arte &lt;vivek@qed-it.com&gt;
Original-Authors: Greg Pfeil
Deirdre Connolly
Credits: Ying Tong Lai
Status: Reserved
Status: Draft
Category: Consensus
Created: 2023-04-18
License: MIT
Discussions-To: &lt;<a href="https://github.com/zcash/zips/issues/686">https://github.com/zcash/zips/issues/686</a>&gt;</pre>
<section id="terminology"><h2><span class="section-heading">Terminology</span><span class="section-anchor"> <a rel="bookmark" href="#terminology"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The key words "MUST", "SHOULD", and "MAY" in this document are to be interpreted as described in BCP 14 <a id="footnote-reference-1" class="footnote_reference" href="#bcp14">1</a> when, and only when, they appear in all capitals.</p>
<p>The character § is used when referring to sections of the Zcash Protocol Specification <a id="footnote-reference-2" class="footnote_reference" href="#protocol">2</a>.</p>
</section>
<section id="abstract"><h2><span class="section-heading">Abstract</span><span class="section-anchor"> <a rel="bookmark" href="#abstract"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>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.</p>
<p>This ZIP also depends upon and defines modifications to the computation of the values <strong>TxId Digest</strong>, <strong>Signature Digest</strong>, and <strong>Authorizing Data Commitment</strong> defined by ZIP 244 <a id="footnote-reference-3" class="footnote_reference" href="#zip-0244">8</a>.</p>
</section>
<section id="motivation"><h2><span class="section-heading">Motivation</span><span class="section-anchor"> <a rel="bookmark" href="#motivation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>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.</p>
</section>
<section id="requirements"><h2><span class="section-heading">Requirements</span><span class="section-anchor"> <a rel="bookmark" href="#requirements"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The new format must fully support the Orchard-ZSA protocol.</p>
<p>The new format should lend itself to future extension or pruning to add or remove value pools.</p>
<p>The computation of the non-malleable transaction identifier hash must include all newly incorporated elements except those that attest to transaction validity.</p>
<p>The computation of the commitment to authorizing data for a transaction must include all newly incorporated elements that attest to transaction validity.</p>
</section>
<section id="non-requirements"><h2><span class="section-heading">Non-requirements</span><span class="section-anchor"> <a rel="bookmark" href="#non-requirements"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>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.</p>
</section>
<section id="specification"><h2><span class="section-heading">Specification</span><span class="section-anchor"> <a rel="bookmark" href="#specification"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>All fields in this specification are encoded as little-endian.</p>
<p>The Zcash transaction format for transaction version 6 is as follows:</p>
<section id="transaction-format"><h3><span class="section-heading">Transaction Format</span><span class="section-anchor"> <a rel="bookmark" href="#transaction-format"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<table>
<thead>
<tr>
<th>Bytes</th>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4"><strong>Common Transaction Fields</strong></td>
</tr>
<tr>
<td><code>4</code></td>
<td><code>header</code></td>
<td><code>uint32</code></td>
<td>
<dl>
<dt>Contains:</dt>
<dd>
<ul>
<li><code>fOverwintered</code> flag (bit 31, always set)</li>
<li><code>version</code> (bits 30 .. 0) transaction version.</li>
</ul>
</dd>
</dl>
</td>
</tr>
<tr>
<td><code>4</code></td>
<td><code>nVersionGroupId</code></td>
<td><code>uint32</code></td>
<td>Version group ID (nonzero).</td>
</tr>
<tr>
<td><code>4</code></td>
<td><code>nConsensusBranchId</code></td>
<td><code>uint32</code></td>
<td>Consensus branch ID (nonzero).</td>
</tr>
<tr>
<td><code>4</code></td>
<td><code>lock_time</code></td>
<td><code>uint32</code></td>
<td>Unix-epoch UTC time or block height, encoded as in Bitcoin.</td>
</tr>
<tr>
<td><code>4</code></td>
<td><code>nExpiryHeight</code></td>
<td><code>uint32</code></td>
<td>A block height in the range {1 .. 499999999} after which the transaction will expire, or 0 to disable expiry. [ZIP-203]</td>
</tr>
<tr>
<td><code>8</code></td>
<td><code>fee</code></td>
<td><code>int64</code></td>
<td>The fee to be paid by this transaction, in zatoshis.</td>
</tr>
<tr>
<td colspan="4"><strong>Transparent Transaction Fields</strong></td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>tx_in_count</code></td>
<td><code>compactSize</code></td>
<td>Number of transparent inputs in <code>tx_in</code>.</td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>tx_in</code></td>
<td><code>tx_in</code></td>
<td>Transparent inputs, encoded as in Bitcoin.</td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>tx_out_count</code></td>
<td><code>compactSize</code></td>
<td>Number of transparent outputs in <code>tx_out</code>.</td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>tx_out</code></td>
<td><code>tx_out</code></td>
<td>Transparent outputs, encoded as in Bitcoin.</td>
</tr>
<tr>
<td colspan="4"><strong>Sapling Transaction Fields</strong></td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>nSpendsSapling</code></td>
<td><code>compactSize</code></td>
<td>Number of Sapling Spend descriptions in <code>vSpendsSapling</code>.</td>
</tr>
<tr>
<td><code>96 * nSpendsSapling</code></td>
<td><code>vSpendsSapling</code></td>
<td><code>SpendDescriptionV6[nSpendsSapling]</code></td>
<td>A sequence of Sapling Spend descriptions, encoded per protocol §7.3 Spend Description Encoding and Consensus.</td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>nOutputsSapling</code></td>
<td><code>compactSize</code></td>
<td>Number of Sapling Output Decriptions in <code>vOutputsSapling</code>.</td>
</tr>
<tr>
<td><code>756 * nOutputsSapling</code></td>
<td><code>vOutputsSapling</code></td>
<td><code>OutputDescriptionV6[nOutputsSapling]</code></td>
<td>A sequence of Sapling Output descriptions, encoded per protocol §7.4 Output Description Encoding and Consensus.</td>
</tr>
<tr>
<td><code>8</code></td>
<td><code>valueBalanceSapling</code></td>
<td><code>int64</code></td>
<td>The net value of Sapling Spends minus Outputs</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>anchorSapling</code></td>
<td><code>byte[32]</code></td>
<td>A root of the Sapling note commitment tree at some block height in the past.</td>
</tr>
<tr>
<td><code>192 * nSpendsSapling</code></td>
<td><code>vSpendProofsSapling</code></td>
<td><code>byte[192 * nSpendsSapling]</code></td>
<td>Encodings of the zk-SNARK proofs for each Sapling Spend.</td>
</tr>
<tr>
<td><code>64 * nSpendsSapling</code></td>
<td><code>vSpendAuthSigsSapling</code></td>
<td><code>byte[64 * nSpendsSapling]</code></td>
<td>Authorizing signatures for each Sapling Spend.</td>
</tr>
<tr>
<td><code>192 * nOutputsSapling</code></td>
<td><code>vOutputProofsSapling</code></td>
<td><code>byte[192 * nOutputsSapling]</code></td>
<td>Encodings of the zk-SNARK proofs for each Sapling Output.</td>
</tr>
<tr>
<td><code>64</code></td>
<td><code>bindingSigSapling</code></td>
<td><code>byte[64]</code></td>
<td>A Sapling binding signature on the SIGHASH transaction hash.</td>
</tr>
<tr>
<td colspan="4"><strong>Orchard-ZSA Transaction Fields</strong></td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>nActionsOrchard</code></td>
<td><code>compactSize</code></td>
<td>The number of Orchard-ZSA Action descriptions in <code>vActionsOrchard</code>.</td>
</tr>
<tr>
<td><code>852 * nActionsOrchard</code></td>
<td><code>vActionsOrchard</code></td>
<td><code>OrchardZsaAction[nActionsOrchard]</code></td>
<td>A sequence of Orchard-ZSA Action descriptions, encoded per the <cite>Orchard-ZSA Action Description Encoding</cite>.</td>
</tr>
<tr>
<td><code>1</code></td>
<td><code>flagsOrchard</code></td>
<td><code>byte</code></td>
<td>
<dl>
<dt>An 8-bit value representing a set of flags. Ordered from LSB to MSB:</dt>
<dd>
<ul>
<li><code>enableSpendsOrchard</code></li>
<li><code>enableOutputsOrchard</code></li>
<li><code>enableZSAs</code></li>
<li>The remaining bits are set to
<span class="math">\(0\!\)</span>
.</li>
</ul>
</dd>
</dl>
</td>
</tr>
<tr>
<td><code>8</code></td>
<td><code>valueBalanceOrchard</code></td>
<td><code>int64</code></td>
<td>The net value of Orchard spends minus outputs.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>anchorOrchard</code></td>
<td><code>byte[32]</code></td>
<td>A root of the Orchard note commitment tree at some block height in the past.</td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>sizeProofsOrchardZSA</code></td>
<td><code>compactSize</code></td>
<td>Length in bytes of <code>proofsOrchardZSA</code>. Value is <strong>(TO UPDATE)</strong>
<span class="math">\(2720 + 2272 \cdot \mathtt{nActionsOrchard}\!\)</span>
.</td>
</tr>
<tr>
<td><code>sizeProofsOrchardZSA</code></td>
<td><code>proofsOrchardZSA</code></td>
<td><code>byte[sizeProofsOrchardZSA]</code></td>
<td>Encoding of aggregated zk-SNARK proofs for Orchard-ZSA Actions.</td>
</tr>
<tr>
<td><code>64 * nActionsOrchard</code></td>
<td><code>vSpendAuthSigsOrchard</code></td>
<td><code>byte[64 * nActionsOrchard]</code></td>
<td>Authorizing signatures for each Orchard-ZSA Action.</td>
</tr>
<tr>
<td><code>64</code></td>
<td><code>bindingSigOrchard</code></td>
<td><code>byte[64]</code></td>
<td>An Orchard binding signature on the SIGHASH transaction hash.</td>
</tr>
<tr>
<td colspan="4"><strong>Orchard-ZSA Burn Fields</strong></td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>nAssetBurn</code></td>
<td><code>compactSize</code></td>
<td>The number of Assets burnt.</td>
</tr>
<tr>
<td><code>40 * nAssetBurn</code></td>
<td><code>vAssetBurn</code></td>
<td><code>AssetBurn[nAssetBurn]</code></td>
<td>A sequence of Asset Burn descriptions, encoded per <a href="#orchard-zsa-asset-burn-description">Orchard-ZSA Asset Burn Description</a>.</td>
</tr>
<tr>
<td colspan="4"><strong>Orchard-ZSA Issuance Fields</strong></td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>nIssueActions</code></td>
<td><code>compactSize</code></td>
<td>The number of issuance actions in the bundle.</td>
</tr>
<tr>
<td><code>IssueActionSize * nIssueActions</code></td>
<td><code>vIssueActions</code></td>
<td><code>IssueAction[nIssueActions]</code></td>
<td>A sequence of issuance action descriptions, where IssueActionSize is the size, in bytes, of an IssueAction description.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>ik</code></td>
<td><code>byte[32]</code></td>
<td>The issuance validating key of the issuer, used to validate the signature.</td>
</tr>
<tr>
<td><code>64</code></td>
<td><code>issueAuthSig</code></td>
<td><code>byte[64]</code></td>
<td>The signature of the transaction SIGHASH, signed by the issuer, validated as in Issuance Authorization Signature Scheme <a id="footnote-reference-4" class="footnote_reference" href="#zip-0227">7</a>.</td>
</tr>
</tbody>
</table>
<ul>
<li>The fields <code>valueBalanceSapling</code> and <code>bindingSigSapling</code> are present if and only if
<span class="math">\(\mathtt{nSpendsSapling} + \mathtt{nOutputsSapling} &gt; 0\!\)</span>
. If <code>valueBalanceSapling</code> is not present, then
<span class="math">\(\mathsf{v^{balanceSapling}}`\)</span>
is defined to be
<span class="math">\(0\!\)</span>
.</li>
<li>The field <code>anchorSapling</code> is present if and only if
<span class="math">\(\mathtt{nSpendsSapling} &gt; 0\!\)</span>
.</li>
<li>The fields <code>flagsOrchard</code>, <code>valueBalanceOrchard</code>, <code>anchorOrchard</code>, <code>sizeProofsOrchardZSA</code>, <code>proofsOrchardZSA</code>, and <code>bindingSigOrchard</code> are present if and only if
<span class="math">\(\mathtt{nActionsOrchard} &gt; 0\!\)</span>
. If <code>valueBalanceOrchard</code> is not present, then
<span class="math">\(\mathsf{v^{balanceOrchard}}\)</span>
is defined to be
<span class="math">\(0\!\)</span>
.</li>
<li>The elements of <code>vSpendProofsSapling</code> and <code>vSpendAuthSigsSapling</code> have a 1:1 correspondence to the elements of <code>vSpendsSapling</code> and MUST be ordered such that the proof or signature at a given index corresponds to the <code>SpendDescriptionV6</code> at the same index.</li>
<li>The elements of <code>vOutputProofsSapling</code> have a 1:1 correspondence to the elements of <code>vOutputsSapling</code> and MUST be ordered such that the proof at a given index corresponds to the <code>OutputDescriptionV6</code> at the same index.</li>
<li>The proofs aggregated in <code>proofsOrchardZSA</code>, and the elements of <code>vSpendAuthSigsOrchard</code>, each have a 1:1 correspondence to the elements of <code>vActionsOrchard</code> and MUST be ordered such that the proof or signature at a given index corresponds to the <code>OrchardZsaAction</code> at the same index.</li>
<li>For coinbase transactions, the <code>enableSpendsOrchard</code> and <code>enableZSAs</code> bits MUST be set to
<span class="math">\(0\!\)</span>
.</li>
</ul>
<p>The encodings of <code>tx_in</code>, and <code>tx_out</code> are as in a version 4 transaction (i.e. unchanged from Canopy). The encodings of <code>SpendDescriptionV6</code>, <code>OutputDescriptionV6</code> , <code>OrchardZsaAction</code>, <code>AssetBurn</code> and <code>IssueAction</code> are described below. The encoding of Sapling Spends and Outputs has changed relative to prior versions in order to better separate data that describe the effects of the transaction from the proofs of and commitments to those effects, and for symmetry with this separation in the Orchard-related parts of the transaction format.</p>
</section>
<section id="sapling-spend-description-spenddescriptionv6"><h3><span class="section-heading">Sapling Spend Description (<code>SpendDescriptionV6</code>)</span><span class="section-anchor"> <a rel="bookmark" href="#sapling-spend-description-spenddescriptionv6"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<table>
<thead>
<tr>
<th>Bytes</th>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>32</code></td>
<td><code>cv</code></td>
<td><code>byte[32]</code></td>
<td>A value commitment to the net value of the input note.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>nullifier</code></td>
<td><code>byte[32]</code></td>
<td>The nullifier of the input note.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>rk</code></td>
<td><code>byte[32]</code></td>
<td>The randomized validating key for the element of spendAuthSigsSapling corresponding to this Spend.</td>
</tr>
</tbody>
</table>
<p>The encodings of each of these elements are defined in §7.3 Spend Description Encoding and Consensus of the Zcash Protocol Specification <a id="footnote-reference-5" class="footnote_reference" href="#protocol-spenddesc">3</a>.</p>
</section>
<section id="sapling-output-description-outputdescriptionv6"><h3><span class="section-heading">Sapling Output Description (<code>OutputDescriptionV6</code>)</span><span class="section-anchor"> <a rel="bookmark" href="#sapling-output-description-outputdescriptionv6"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<table>
<thead>
<tr>
<th>Bytes</th>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>32</code></td>
<td><code>cv</code></td>
<td><code>byte[32]</code></td>
<td>A value commitment to the net value of the output note.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>cmu</code></td>
<td><code>byte[32]</code></td>
<td>The
<span class="math">\(u\!\)</span>
-coordinate of the note commitment for the output note.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>ephemeralKey</code></td>
<td><code>byte[32]</code></td>
<td>An encoding of an ephemeral Jubjub public key.</td>
</tr>
<tr>
<td><code>580</code></td>
<td><code>encCiphertext</code></td>
<td><code>byte[580]</code></td>
<td>The encrypted contents of the note plaintext.</td>
</tr>
<tr>
<td><code>80</code></td>
<td><code>outCiphertext</code></td>
<td><code>byte[80]</code></td>
<td>The encrypted contents of the byte string created by concatenation of the transmission key with the ephemeral secret key.</td>
</tr>
</tbody>
</table>
<p>The encodings of each of these elements are defined in §7.4 Output Description Encoding and Consensus of the Zcash Protocol Specification <a id="footnote-reference-6" class="footnote_reference" href="#protocol-outputdesc">4</a>.</p>
</section>
<section id="orchard-zsa-action-description-orchardzsaaction"><h3><span class="section-heading">Orchard-ZSA Action Description (<code>OrchardZsaAction</code>)</span><span class="section-anchor"> <a rel="bookmark" href="#orchard-zsa-action-description-orchardzsaaction"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<table>
<thead>
<tr>
<th>Bytes</th>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>32</code></td>
<td><code>cv</code></td>
<td><code>byte[32]</code></td>
<td>A value commitment to the net value of the input note minus the output note.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>nullifier</code></td>
<td><code>byte[32]</code></td>
<td>The nullifier of the input note.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>rk</code></td>
<td><code>byte[32]</code></td>
<td>The randomized validating key for the element of spendAuthSigsOrchard corresponding to this Action.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>cmx</code></td>
<td><code>byte[32]</code></td>
<td>The
<span class="math">\(x\!\)</span>
-coordinate of the note commitment for the output note.</td>
</tr>
<tr>
<td><code>32</code></td>
<td><code>ephemeralKey</code></td>
<td><code>byte[32]</code></td>
<td>An encoding of an ephemeral Pallas public key</td>
</tr>
<tr>
<td><code>612</code></td>
<td><code>encCiphertext</code></td>
<td><code>byte[580]</code></td>
<td>The encrypted contents of the note plaintext.</td>
</tr>
<tr>
<td><code>80</code></td>
<td><code>outCiphertext</code></td>
<td><code>byte[80]</code></td>
<td>The encrypted contents of the byte string created by concatenation of the transmission key with the ephemeral secret key.</td>
</tr>
</tbody>
</table>
<p>The encodings of each of these elements are defined in §7.5 Action Description Encoding and Consensus of the Zcash Protocol Specification <a id="footnote-reference-7" class="footnote_reference" href="#protocol-actiondesc">5</a>.</p>
</section>
<section id="orchard-zsa-asset-burn-description"><h3><span class="section-heading">Orchard-ZSA Asset Burn Description</span><span class="section-anchor"> <a rel="bookmark" href="#orchard-zsa-asset-burn-description"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>An Orchard-ZSA Asset Burn description is encoded in a transaction as an instance of an <code>AssetBurn</code> type:</p>
<table>
<thead>
<tr>
<th>Bytes</th>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>32</td>
<td><code>AssetBase</code></td>
<td><code>byte[32]</code></td>
<td>For the Orchard-based ZSA protocol, this is the encoding of the Asset Base
<span class="math">\(\mathsf{AssetBase^{Orchard}}\!\)</span>
.</td>
</tr>
<tr>
<td>8</td>
<td><code>valueBurn</code></td>
<td>
<span class="math">\(\{1 .. 2^{64} - 1\}\)</span>
</td>
<td>The amount being burnt.</td>
</tr>
</tbody>
</table>
<p>The encodings of each of these elements are defined in ZIP 226 <a id="footnote-reference-8" class="footnote_reference" href="#zip-0226">6</a>.</p>
</section>
<section id="issuance-action-description-issueaction"><h3><span class="section-heading">Issuance Action Description (<code>IssueAction</code>)</span><span class="section-anchor"> <a rel="bookmark" href="#issuance-action-description-issueaction"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>An issuance action, <code>IssueAction</code>, is the instance of issuing a specific Custom Asset, and contains the following fields:</p>
<table>
<thead>
<tr>
<th>Bytes</th>
<th>Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>assetDescSize</code></td>
<td><code>byte</code></td>
<td>The length of the asset description string in bytes.</td>
</tr>
<tr>
<td><code>assetDescSize</code></td>
<td><code>asset_desc</code></td>
<td><code>byte[assetDescSize]</code></td>
<td>A byte sequence of length <code>assetDescSize</code> bytes which SHOULD be a well-formed UTF-8 code unit sequence according to Unicode 15.0.0 or later.</td>
</tr>
<tr>
<td><code>varies</code></td>
<td><code>nNotes</code></td>
<td><code>compactSize</code></td>
<td>The number of notes in the issuance action.</td>
</tr>
<tr>
<td><code>noteSize * nNotes</code></td>
<td><code>vNotes</code></td>
<td><code>Note[nNotes]</code></td>
<td>A sequence of note descriptions within the issuance action, where <code>noteSize</code> is the size, in bytes, of a Note.</td>
</tr>
<tr>
<td><code>1</code></td>
<td><code>flagsIssuance</code></td>
<td><code>byte</code></td>
<td>
<dl>
<dt>An 8-bit value representing a set of flags. Ordered from LSB to MSB:</dt>
<dd>
<ul>
<li>
<span class="math">\(\mathsf{finalize}\)</span>
</li>
<li>The remaining bits are set to
<span class="math">\(0\!\)</span>
.</li>
</ul>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<p>The encodings of each of these elements are defined in ZIP 227 <a id="footnote-reference-9" class="footnote_reference" href="#zip-0227">7</a>.</p>
</section>
</section>
<section id="reference-implementation"><h2><span class="section-heading">Reference implementation</span><span class="section-anchor"> <a rel="bookmark" href="#reference-implementation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>TODO</p>
</section>
<section id="references"><h2><span class="section-heading">References</span><span class="section-anchor"> <a rel="bookmark" href="#references"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<table id="bcp14" class="footnote">
<tbody>
<tr>
<th>1</th>
<td><a href="https://www.rfc-editor.org/info/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"</a></td>
</tr>
</tbody>
</table>
<table id="protocol" class="footnote">
<tbody>
<tr>
<th>2</th>
<td><a href="protocol/protocol.pdf">Zcash Protocol Specification, Version 2023.4.0 or later [NU5 proposal]</a></td>
</tr>
</tbody>
</table>
<table id="protocol-spenddesc" class="footnote">
<tbody>
<tr>
<th>3</th>
<td><a href="protocol/protocol.pdf#spenddesc">Zcash Protocol Specification, Version 2023.4.0 [NU5 proposal]. Section 4.4: Spend Descriptions</a></td>
</tr>
</tbody>
</table>
<table id="protocol-outputdesc" class="footnote">
<tbody>
<tr>
<th>4</th>
<td><a href="protocol/protocol.pdf#outputdesc">Zcash Protocol Specification, Version 2023.4.0 [NU5 proposal]. Section 4.5: Output Descriptions</a></td>
</tr>
</tbody>
</table>
<table id="protocol-actiondesc" class="footnote">
<tbody>
<tr>
<th>5</th>
<td><a href="protocol/protocol.pdf#actiondesc">Zcash Protocol Specification, Version 2023.4.0 [NU5 proposal]. Section 4.6: Action Descriptions</a></td>
</tr>
</tbody>
</table>
<table id="zip-0226" class="footnote">
<tbody>
<tr>
<th>6</th>
<td><a href="https://qed-it.github.io/zips/zip-0226">ZIP 226: Transfer and Burn of Zcash Shielded Assets</a></td>
</tr>
</tbody>
</table>
<table id="zip-0227" class="footnote">
<tbody>
<tr>
<th>7</th>
<td><a href="https://qed-it.github.io/zips/zip-0227">ZIP 227: Issuance of Zcash Shielded Assets</a></td>
</tr>
</tbody>
</table>
<table id="zip-0244" class="footnote">
<tbody>
<tr>
<th>8</th>
<td><a href="zip-0244">ZIP 244: Transaction Identifier Non-Malleability</a></td>
</tr>
</tbody>
</table>
</section>
</section>
</body>
</html>