Skip to content

Commit

Permalink
Adding the orchard_zsa_burn_digest to the TxId digest. (#53)
Browse files Browse the repository at this point in the history
This adds a field to the TxId digest to include the burn fields of
the transaction to the SIGHASH.
  • Loading branch information
vivek-arte authored Apr 16, 2024
1 parent 5e33e47 commit 472ebe7
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
26 changes: 23 additions & 3 deletions zip-0226.html
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,10 @@ <h4>The
<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>
T.4d: orchard_zsa_burn_digest (32-byte hash output) [ADDED FOR ZSA]
T.4e: flagsOrchard (1 byte)
T.4f: valueBalanceOrchard (64-bit signed little-endian)
T.4g: 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)
Expand All @@ -494,6 +495,25 @@ <h4>The
<p>The personalization field of this hash is defined identically to ZIP 244:</p>
<pre>"ZTxIdOrcActNHash"</pre>
</section>
<section id="t-4d-orchard-zsa-burn-digest"><h5><span class="section-heading">T.4d: orchard_zsa_burn_digest</span><span class="section-anchor"> <a rel="bookmark" href="#t-4d-orchard-zsa-burn-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 data from the burn fields of the transaction. For each tuple in the
<span class="math">\(\mathsf{assetBurn}\)</span>
set, the following elements are included in the hash:</p>
<pre>T.4d.i : assetBase (field encoding bytes)
T.4d.ii: valueBurn (field encoding bytes)</pre>
<p>The personalization field of this hash is set to:</p>
<pre>"ZTxIdOrcBurnHash"</pre>
<p>In case the transaction does not perform the burning of any Assets (i.e. the
<span class="math">\(\mathsf{assetBurn}\)</span>
set is empty), the ''orchard_zsa_burn_digest'' is:</p>
<pre>BLAKE2b-256("ZTxIdOrcBurnHash", [])</pre>
<section id="t-4d-i-assetbase"><h6><span class="section-heading">T.4d.i: assetBase</span><span class="section-anchor"> <a rel="bookmark" href="#t-4d-i-assetbase"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h6>
<p>The Asset Base being burnt encoded as the 32-byte representation of a point on the Pallas curve.</p>
</section>
<section id="t-4d-ii-valueburn"><h6><span class="section-heading">T.4d.ii: valueBurn</span><span class="section-anchor"> <a rel="bookmark" href="#t-4d-ii-valueburn"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h6>
<p>Value of the Asset Base being burnt encoded as little-endian 8-byte representation of 64-bit unsigned integer (e.g. u64 in Rust) raw value.</p>
</section>
</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>
Expand Down
37 changes: 34 additions & 3 deletions zip-0226.rst
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,10 @@ When Orchard Actions are present in the transaction, this digest is a BLAKE2b-25
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)
T.4d: orchard_zsa_burn_digest (32-byte hash output) [ADDED FOR ZSA]
T.4e: flagsOrchard (1 byte)
T.4f: valueBalanceOrchard (64-bit signed little-endian)
T.4g: anchorOrchard (32 bytes)

T.4a: orchard_actions_compact_digest
''''''''''''''''''''''''''''''''''''
Expand Down Expand Up @@ -397,6 +398,36 @@ The personalization field of this hash is defined identically to ZIP 244::

"ZTxIdOrcActNHash"


T.4d: orchard_zsa_burn_digest
'''''''''''''''''''''''''''''

A BLAKE2b-256 hash of the data from the burn fields of the transaction. For each tuple in
the :math:`\mathsf{assetBurn}` set, the following elements are included in the hash::

T.4d.i : assetBase (field encoding bytes)
T.4d.ii: valueBurn (field encoding bytes)

The personalization field of this hash is set to::

"ZTxIdOrcBurnHash"

In case the transaction does not perform the burning of any Assets (i.e. the
:math:`\mathsf{assetBurn}` set is empty), the ''orchard_zsa_burn_digest'' is::

BLAKE2b-256("ZTxIdOrcBurnHash", [])

T.4d.i: assetBase
.................
The Asset Base being burnt encoded as the 32-byte representation of a point on the
Pallas curve.

T.4d.ii: valueBurn
..................
Value of the Asset Base being burnt encoded as little-endian 8-byte representation
of 64-bit unsigned integer (e.g. u64 in Rust) raw value.


T.5: issuance_digest
````````````````````
The details of the computation of this value are in ZIP 227 [#zip-0227-txiddigest]_.
Expand Down

0 comments on commit 472ebe7

Please sign in to comment.