Skip to content

Commit 381f666

Browse files
authored
Merge pull request #1056 from zcash/sighash-updates
Add sighash versioning specification to ZIPs 246 and 230
2 parents 2ab27b4 + 89607d7 commit 381f666

File tree

2 files changed

+95
-17
lines changed

2 files changed

+95
-17
lines changed

zips/zip-0230.rst

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ Transaction Format
115115
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
116116
| varies |``tx_out`` |``tx_out`` |Transparent outputs, encoded as in Bitcoin. |
117117
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
118+
| varies |``vSighashInfo`` |``TransparentSighashInfo[tx_in_count]`` |Sighash info for each transparent input. |
119+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
118120
| **Sapling Transaction Fields** |
119121
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
120122
| varies |``nSpendsSapling`` |``compactSize`` |Number of Sapling Spend descriptions in ``vSpendsSapling``. |
@@ -134,11 +136,11 @@ Transaction Format
134136
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
135137
| 192 × ``nSpendsSapling`` |``vSpendProofsSapling`` |``byte[192 * nSpendsSapling]`` |Encodings of the zk-SNARK proofs for each Sapling Spend. |
136138
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
137-
| 64 × ``nSpendsSapling`` |``vSpendAuthSigsSapling`` |``byte[64 * nSpendsSapling]`` |Authorizing signatures for each Sapling Spend. |
139+
| varies |``vSpendAuthSigsSapling`` |``SaplingSignature[nSpendsSapling]`` |Authorizing signatures for each Sapling Spend. |
138140
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
139141
| 192 × ``nOutputsSapling`` |``vOutputProofsSapling`` |``byte[192 * nOutputsSapling]`` |Encodings of the zk-SNARK proofs for each Sapling Output. |
140142
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
141-
| 64 |``bindingSigSapling`` |``byte[64]`` |A Sapling binding signature on the SIGHASH transaction hash. |
143+
| varies |``bindingSigSapling`` |``SaplingSignature`` |A Sapling binding signature on the SIGHASH transaction hash. |
142144
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
143145
| **Orchard Transaction Fields** |
144146
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
@@ -149,7 +151,7 @@ Transaction Format
149151
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
150152
| 8 |``valueBalanceOrchard`` |``int64`` |The net value of Orchard spends minus outputs. |
151153
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
152-
| 64 |``bindingSigOrchard`` |``byte[64]`` |An OrchardZSA binding signature on the SIGHASH transaction hash. |
154+
| varies |``bindingSigOrchard`` |``OrchardSignature`` |An OrchardZSA binding signature on the SIGHASH transaction hash. |
153155
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
154156
| **ZSA Issuance Bundle Fields** |
155157
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
@@ -161,12 +163,9 @@ Transaction Format
161163
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
162164
| varies |``issuer`` |``byte[issuerLength]`` |The issuer identifier as defined in [#zip-0227-issuer-identifier]_. |
163165
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
164-
| varies |``issueAuthSigLength`` |``compactSize`` |The length of the issuance authorization signature, including the |
165-
| | | |initial byte indicating a BIP 340 signature. |
166-
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
167-
| varies |``issueAuthSig`` |``byte[issueAuthSigLength]`` |The signature of the transaction SIGHASH, signed by the issuer, |
168-
| | | |preceded by a :math:`\mathtt{0x00}` byte indicating a BIP 340 |
169-
| | | |signature. It is validated as specified in [#zip-0227-issuance-sig]_.|
166+
| varies |``issueAuthSig`` |``IssueAuthSignature`` |The signature of the transaction SIGHASH, signed by the issuer, |
167+
| | | |validated as in Issuance Authorization Signature Scheme |
168+
| | | |[#zip-0227-issuance-auth-sig]_. |
170169
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
171170
| **Memo Bundle Fields** |
172171
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
@@ -289,7 +288,7 @@ The OrchardZSA Action Group Description is encoded in a transaction as an instan
289288
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
290289
| ``sizeProofsOrchard`` |``proofsOrchard`` |``byte[sizeProofsOrchard]`` |The aggregated zk-SNARK proof for all Actions in the Action Group. |
291290
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
292-
| 64 × ``nActionsOrchard`` |``vSpendAuthSigsOrchard`` |``byte[64 * nActionsOrchard]`` |Authorizing signatures for each Action of the Action Group in a |
291+
| varies |``vSpendAuthSigsOrchard`` |``OrchardSignature[nActionsOrchard]`` |Authorizing signatures for each Action of the Action Group in a |
293292
| | | |transaction. |
294293
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
295294

@@ -364,6 +363,67 @@ An OrchardZSA Asset Burn description is encoded in a transaction as an instance
364363

365364
The encodings of each of these elements are defined in ZIP 226 [#zip-0226]_.
366365

366+
Transparent Sighash Information (``TransparentSighashInfo``)
367+
---------------------------------------------------
368+
369+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
370+
| Bytes | Name | Data Type | Description |
371+
+=============================+==============================+================================================+=====================================================================+
372+
| varies |``sizeSighashInfo`` |``compactSize`` |The size in bytes of `sighashInfo`. |
373+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
374+
| ``sizeSighashInfo`` |``sighashInfo`` |``byte[sizeSighashInfo]`` |The sighash version and associated information |
375+
| | | |[#zip-0246-sighash-info]_. |
376+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
377+
378+
Sapling Signature (``SaplingSignature``)
379+
----------------------------------------
380+
381+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
382+
| Bytes | Name | Data Type | Description |
383+
+=============================+==============================+================================================+=====================================================================+
384+
| varies |``sizeSighashInfo`` |``compactSize`` |The size in bytes of `sighashInfo`. |
385+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
386+
| ``sizeSighashInfo`` |``sighashInfo`` |``byte[sizeSighashInfo]`` |The sighash version and associated information |
387+
| | | |[#zip-0246-sighash-info]_. |
388+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
389+
| 64 |``signature`` |``byte[64]`` |An encoding of a RedJubjub signature, which may be either a |
390+
| | | |``spendAuthSig`` or ``bindingSig`` depending on context. |
391+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
392+
393+
Orchard Signature (``OrchardSignature``)
394+
----------------------------------------
395+
396+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
397+
| Bytes | Name | Data Type | Description |
398+
+=============================+==============================+================================================+=====================================================================+
399+
| varies |``sizeSighashInfo`` |``compactSize`` |The size in bytes of `sighashInfo`. |
400+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
401+
| ``sizeSighashInfo`` |``sighashInfo`` |``byte[sizeSighashInfo]`` |The sighash version and associated information |
402+
| | | |[#zip-0246-sighash-info]_. |
403+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
404+
| 64 |``signature`` |``byte[64]`` |An encoding of a RedPallas signature, which may be either a |
405+
| | | |``spendAuthSig`` or ``bindingSig`` depending on context. |
406+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
407+
408+
Issuance Authorization Signature (``IssueAuthSignature``)
409+
---------------------------------------------------------
410+
411+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
412+
| Bytes | Name | Data Type | Description |
413+
+=============================+==============================+================================================+=====================================================================+
414+
| varies |``sizeSighashInfo`` |``compactSize`` |The size in bytes of `sighashInfo`. |
415+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
416+
| ``sizeSighashInfo`` |``sighashInfo`` |``byte[sizeSighashInfo]`` |The sighash version and associated information |
417+
| | | |[#zip-0246-sighash-info]_. |
418+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
419+
| varies |``sizeSignature`` |``compactSize`` |The size in bytes of `signature`. |
420+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
421+
| varies |``signature`` |``byte[sizeSignature]`` |The signature of the transaction SIGHASH, signed by the issuer, |
422+
| | | |preceded by a ``0x00`` byte indicating a BIP 340 signature. It is |
423+
| | | |validated as specified in [#zip-0227-issuance-auth-sig]_. |
424+
+-----------------------------+------------------------------+------------------------------------------------+---------------------------------------------------------------------+
425+
426+
367427
Issuance Action Description (``IssueAction``)
368428
---------------------------------------------
369429

@@ -441,8 +501,8 @@ References
441501
.. [#zip-0225] `ZIP 225: Version 5 Transaction Format <zip-0225.html>`_
442502
.. [#zip-0226] `ZIP 226: Transfer and Burn of Zcash Shielded Assets <zip-0226.html>`_
443503
.. [#zip-0227] `ZIP 227: Issuance of Zcash Shielded Assets <zip-0227.html>`_
444-
.. [#zip-0227-issuer-identifier] `ZIP 227: Issuance of Zcash Shielded Assets — Issuer Identifier <zip-0227.html#issuer-identifier>`_
445-
.. [#zip-0227-issuance-sig] `ZIP 227: Issuance of Zcash Shielded Assets — Issuance Authorization Signature Scheme <zip-0227.html#issuance-authorization-signature-scheme>`_
504+
.. [#zip-0227-issuance-auth-sig] `ZIP 227: Issuance of Zcash Shielded Assets — Issuance Authorization Signature Scheme <zip-0227#issuance-authorization-signature-scheme>`_
446505
.. [#zip-0228] `ZIP 228: Asset Swaps for Zcash Shielded Assets <zip-0228.html>`_
447506
.. [#zip-0244] `ZIP 244: Transaction Identifier Non-Malleability <zip-0244.html>`_
507+
.. [#zip-0246-sighash-info] `ZIP 246: Digests for the Version 6 Transaction Format <zip-0246#zip-0246-sighash-info>`_
448508
.. [#zip-0254] `ZIP 254: Deployment of the NU7 Network Upgrade <zip-0254.rst>`_

0 commit comments

Comments
 (0)