Merge pull request #516 from daira/zip-239

Add ZIP 239: Relay of Version 5 Transactions
This commit is contained in:
Daira Hopwood 2021-06-03 22:56:35 +01:00 committed by GitHub
commit 43b03a7a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 360 additions and 13 deletions

View File

@ -50,6 +50,7 @@ is planned to activate on Mainnet at the beginning of October 2021:
- `ZIP 221: FlyClient - Consensus-Layer Changes <zip-0221.rst>`__ (updated)
- `ZIP 224: Orchard Shielded Protocol <zip-0224.rst>`__
- `ZIP 225: Version 5 Transaction Format <zip-0225.rst>`__
- `ZIP 239: Relay of Version 5 Transactions <zip-0239.rst>`__
- `ZIP 244: Transaction Identifier Non-Malleability <zip-0244.rst>`__
- `ZIP 252: Deployment of the NU5 Network Upgrade <zip-0252.rst>`__
- `ZIP 316: Unified Addresses and Unified Viewing Keys <zip-0316.rst>`__
@ -101,6 +102,7 @@ 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>Proposed</td>
<tr> <td>225</td> <td class="left"><a href="zip-0225.rst">Version 5 Transaction Format</a></td> <td>Proposed</td>
<tr> <td>239</td> <td class="left"><a href="zip-0239.rst">Relay of Version 5 Transactions</a></td> <td>Proposed</td>
<tr> <td>243</td> <td class="left"><a href="zip-0243.rst">Transaction Signature Validation for Sapling</a></td> <td>Final</td>
<tr> <td>244</td> <td class="left"><a href="zip-0244.rst">Transaction Identifier Non-Malleability</a></td> <td>Proposed</td>
<tr> <td>245</td> <td class="left"><a href="zip-0245.rst">Transaction Identifier Digests & Signature Validation for Transparent Zcash Extensions</a></td> <td>Draft</td>

View File

@ -50,6 +50,7 @@ is planned to activate on Mainnet at the beginning of October 2021:
- `ZIP 221: FlyClient - Consensus-Layer Changes <zip-0221.rst>`__ (updated)
- `ZIP 224: Orchard Shielded Protocol <zip-0224.rst>`__
- `ZIP 225: Version 5 Transaction Format <zip-0225.rst>`__
- `ZIP 239: Relay of Version 5 Transactions <zip-0239.rst>`__
- `ZIP 244: Transaction Identifier Non-Malleability <zip-0244.rst>`__
- `ZIP 252: Deployment of the NU5 Network Upgrade <zip-0252.rst>`__
- `ZIP 316: Unified Addresses and Unified Viewing Keys <zip-0316.rst>`__

View File

@ -32,6 +32,7 @@
<li><a href="zip-0221">ZIP 221: FlyClient - Consensus-Layer Changes</a> (updated)</li>
<li><a href="zip-0224">ZIP 224: Orchard Shielded Protocol</a></li>
<li><a href="zip-0225">ZIP 225: Version 5 Transaction Format</a></li>
<li><a href="zip-0239">ZIP 239: Relay of Version 5 Transactions</a></li>
<li><a href="zip-0244">ZIP 244: Transaction Identifier Non-Malleability</a></li>
<li><a href="zip-0252">ZIP 252: Deployment of the NU5 Network Upgrade</a></li>
<li><a href="zip-0316">ZIP 316: Unified Addresses and Unified Viewing Keys</a></li>
@ -74,6 +75,7 @@
<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>Proposed</td>
<tr> <td>225</td> <td class="left"><a href="zip-0225">Version 5 Transaction Format</a></td> <td>Proposed</td>
<tr> <td>239</td> <td class="left"><a href="zip-0239">Relay of Version 5 Transactions</a></td> <td>Proposed</td>
<tr> <td>243</td> <td class="left"><a href="zip-0243">Transaction Signature Validation for Sapling</a></td> <td>Final</td>
<tr> <td>244</td> <td class="left"><a href="zip-0244">Transaction Identifier Non-Malleability</a></td> <td>Proposed</td>
<tr> <td>245</td> <td class="left"><a href="zip-0245">Transaction Identifier Digests & Signature Validation for Transparent Zcash Extensions</a></td> <td>Draft</td>

151
zip-0239.html Normal file
View File

@ -0,0 +1,151 @@
<!DOCTYPE html>
<html>
<head>
<title>ZIP 239: Relay of Version 5 Transactions</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"></head>
<body>
<section>
<pre>ZIP: 239
Title: Relay of Version 5 Transactions
Owners: Daira Hopwood &lt;daira@electriccoin.co&gt;
Jack Grigg &lt;jack@electriccoin.co&gt;
Status: Proposed
Category: Network
Created: 2021-05-29
License: MIT
Discussions-To: &lt;<a href="https://github.com/zcash/zips/issues/515">https://github.com/zcash/zips/issues/515</a>&gt;
Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/516">https://github.com/zcash/zips/pull/516</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" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>The key words "MUST", "MUST NOT", and "SHOULD" in this document are to be interpreted as described in RFC 2119. <a id="id1" class="footnote_reference" href="#rfc2119">1</a></p>
<p>The term "network upgrade" in this document is to be interpreted as described in ZIP 200. <a id="id2" class="footnote_reference" href="#zip-0200">2</a></p>
<p>The terms "Testnet" and "Mainnet" are to be interpreted as described in section 3.11 of the Zcash Protocol Specification <a id="id3" class="footnote_reference" href="#protocol-networks">6</a>.</p>
<p>The term "txid" means a transaction identifier, computed as a SHA-256d hash of the transaction data for v4 and earlier transactions, or as specified in <a id="id4" class="footnote_reference" href="#zip-0244">4</a> for v5 and later transactions.</p>
<p>The term "authorizing data commitment" (denoted <code>auth_digest</code>), defined only for v5 and later transactions, is to be interpreted as described in <a id="id5" class="footnote_reference" href="#zip-0244">4</a>.</p>
<p>The term "witnessed transaction identifier" ("wtxid"), defined only for v5 and later transactions, is a 64-byte value given by concatenating the txid and the authorizing data commitment of the transaction.</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" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This ZIP describes changes to the Zcash peer-to-peer protocol to support transaction relay based on a transaction's authorizing data commitment as well as its txid.</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" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>Historically, as in Bitcoin, the <code>inv</code> and <code>getdata</code> messages sent on the Zcash peer-to-peer network to announce or request transactions have referred to those transactions by txid.</p>
<p>Prior to the introduction of v5 transactions <a id="id6" class="footnote_reference" href="#zip-0225">3</a> in the NU5 network upgrade <a id="id7" class="footnote_reference" href="#zip-0252">5</a>, a txid was always defined as the SHA-256d hash of the transaction data, the encoding of which is the same in block data and in the peer-to-peer protocol.</p>
<p>For v5 transactions, a new transaction digest algorithm is defined that constructs the txid from a tree of hashes, which include only effecting data <a id="id8" class="footnote_reference" href="#zip-0244">4</a>. Witness data is committed to by a separate "authorizing data commitment". Unlike previous transaction versions, the format of serialized v5 transaction data is not consensus-critical.</p>
<p>Not committing to the witness data in v5 transaction announcements would create inefficiencies: because a v5 transaction's witness can be malleated without altering the txid, a node in receipt of a v5 transaction that the node does not accept would generally still have to download that same transaction when announced by other peers. This is because the alternative — of not downloading a v5 transaction with a given txid after rejecting a previous transaction with that txid — would allow a third party to interfere with transaction relay by malleating a transaction's witness and announcing the resulting invalid transaction to nodes, preventing relay of the valid version of the transaction as well.</p>
<p>This inefficiency was present in Bitcoin for almost 3 years after activation of its Segwit upgrade <a id="id9" class="footnote_reference" href="#bip-0141">8</a>, until the adoption of BIP 339 <a id="id10" class="footnote_reference" href="#bip-0339">9</a>. The latter BIP specifies a way to use the Segwit "wtxid" (which commits to both effecting and witness data) in place of the txid when announcing and fetching transactions. In Zcash, the analogous identifier is also called the wtxid, but it encodes the pair (txid, auth_digest).</p>
<p>This ZIP is modelled after BIP 339: it adds a <code>MSG_WTX</code> inv type to the peer-to-peer protocol, analogous to BIP 339's <code>MSG_WTX</code> inv type, that announces transactions by their wtxid. Note that the encoding and length of a Zcash wtxid is different to that of a Bitcoin wtxid.</p>
<p>This ZIP does not introduce any equivalent of BIP 339's <code>wtxidrelay</code> message, since that is not needed for compatibility given that Zcash full nodes are required to support <code>MSG_WTX</code> based on the negotiated peer protocol version (see <a href="#deployment">Deployment</a>).</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" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>A new inv type <code>MSG_WTX</code> (0x00000005) is added, for use in both <code>inv</code> messages and <code>getdata</code> requests, indicating that the hash being referenced is the wtxid (i.e. the 64-byte value <code>txid</code> || <code>auth_digest</code>). This inv type MUST be used when announcing v5 transactions. The <code>txid</code> and <code>auth_digest</code> are as defined in <a id="id11" class="footnote_reference" href="#zip-0244">4</a>.</p>
<p>In the case of <code>getdata</code> requests, the format of a v5 transaction obtained by a <code>MSG_WTX</code> inv type is as given in the Zcash protocol specification. <a id="id12" class="footnote_reference" href="#protocol-txnencodingandconsensus">7</a></p>
<p>An <code>inv</code> or <code>getdata</code> message MUST NOT use the <code>MSG_WTX</code> inv type for v4 or earlier transactions, or on peer connections that have not negotiated at least the peer protocol version specified in <a href="#deployment">Deployment</a>.</p>
<p>Note that <code>MSG_WTX</code> might also be used for future transaction versions after v5. Since such versions are not currently consensus-valid, this is left unspecified for now.</p>
<p><code>MSG_TX</code> and <code>MSG_WTX</code> entries may be mixed in arbitrary order in an <code>inv</code> message or a <code>getdata</code> message. Since these entry types are of different lengths (36 bytes or 68 bytes respectively including the 4-byte type field), this implies that the size of the message is not determined by its initial <code>count</code> field, and has to be determined by parsing the whole message.</p>
<p><strong>Open issue:</strong></p>
<ul>
<li>Should we redefine <code>inv</code> and <code>getdata</code> to segregate <code>MSG_TX</code> and <code>MSG_WTX</code>, making these messages simpler / more efficient to parse? This could be done by adding new <code>invw</code> and <code>getdataw</code> messages. See <a id="id13" class="footnote_reference" href="#p2p-inv">10</a> and <a id="id14" class="footnote_reference" href="#p2p-getdata">11</a> for how <code>inv</code> and <code>getdata</code> respectively are currently defined in Bitcoin.</li>
</ul>
<section id="deployment"><h3><span class="section-heading">Deployment</span><span class="section-anchor"> <a rel="bookmark" href="#deployment"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>This ZIP is assumed to be deployed in advance of the network upgrade that introduces v5 transactions, i.e. NU5. In <a id="id15" class="footnote_reference" href="#zip-0252">5</a>, the minimum protocol version that signals support for NU5 on Testnet is defined to be 170014. Therefore, the peer protocol version that enables support for this specification is also defined to be 170014 (on both Testnet and Mainnet).</p>
<p>As specified in <a id="id16" class="footnote_reference" href="#zip-0200">2</a>, a node that supports a network upgrade will clear its mempool when reaching the block before that upgrade's activation block. Before this point, the node will not accept transactions into its mempool that are invalid according to the pre-upgrade consensus protocol (so, in this case, it would not accept v5 transactions). This means that a correctly functioning node will not use the <code>MSG_WTX</code> inv type until it has received the block preceding the NU5 network upgrade.</p>
<p>Nevertheless, it is possible for a node to receive an <code>inv</code> or <code>getdata</code> message with a <code>MSG_WTX</code> inv type, on a peer connection that has negotiated protocol version 170014 or later, before NU5 has activated. The node MUST handle this case in the same way that it would after NU5 activation when it has no v5 transactions to relay. Receiving a <code>MSG_WTX</code> inv type on a peer connection that has negotiated a protocol version before 170014, on the other hand, SHOULD be treated as a protocol error.</p>
<p>As the <code>MSG_WTX</code> inv type is only enabled between peers that both support it, older clients remain fully compatible and interoperable before NU5 activates, or on a chain in which it does not activate.</p>
</section>
</section>
<section id="acknowledgements"><h2><span class="section-heading">Acknowledgements</span><span class="section-anchor"> <a rel="bookmark" href="#acknowledgements"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This ZIP is partly based on BIP 339, written by Suhas Daftuar. <a id="id17" class="footnote_reference" href="#bip-0339">9</a></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" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<table id="rfc2119" class="footnote">
<tbody>
<tr>
<th>1</th>
<td><a href="https://www.rfc-editor.org/rfc/rfc2119.html">RFC 2119: Key words for use in RFCs to Indicate Requirement Levels</a></td>
</tr>
</tbody>
</table>
<table id="zip-0200" class="footnote">
<tbody>
<tr>
<th>2</th>
<td><a href="zip-0200">ZIP 200: Network Upgrade Activation Mechanism</a></td>
</tr>
</tbody>
</table>
<table id="zip-0225" class="footnote">
<tbody>
<tr>
<th>3</th>
<td><a href="zip-0225">ZIP 225: Version 5 Transaction Format</a></td>
</tr>
</tbody>
</table>
<table id="zip-0244" class="footnote">
<tbody>
<tr>
<th>4</th>
<td><a href="zip-0244">ZIP 244: Transaction Identifier Non-Malleability</a></td>
</tr>
</tbody>
</table>
<table id="zip-0252" class="footnote">
<tbody>
<tr>
<th>5</th>
<td><a href="zip-0252">ZIP 252: Deployment of the NU5 Network Upgrade</a></td>
</tr>
</tbody>
</table>
<table id="protocol-networks" class="footnote">
<tbody>
<tr>
<th>6</th>
<td><a href="protocol/nu5.pdf#networks">Zcash Protocol Specification, Version 2020.2.2 [NU5 proposal]. Section 3.12 Mainnet and Testnet</a></td>
</tr>
</tbody>
</table>
<table id="protocol-txnencodingandconsensus" class="footnote">
<tbody>
<tr>
<th>7</th>
<td><a href="protocol/nu5.pdf#txnencodingandconsensus">Zcash Protocol Specification, Version 2020.2.2 [NU5 proposal]. Section 7.1: Transaction Encoding and Consensus</a></td>
</tr>
</tbody>
</table>
<table id="bip-0141" class="footnote">
<tbody>
<tr>
<th>8</th>
<td><a href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki">BIP 141: Segregated Witness (Consensus layer)</a></td>
</tr>
</tbody>
</table>
<table id="bip-0339" class="footnote">
<tbody>
<tr>
<th>9</th>
<td><a href="https://github.com/bitcoin/bips/blob/master/bip-0339.mediawiki">BIP 339: WTXID-based transaction relay</a></td>
</tr>
</tbody>
</table>
<table id="p2p-inv" class="footnote">
<tbody>
<tr>
<th>10</th>
<td><a href="https://developer.bitcoin.org/reference/p2p_networking.html#inv">Bitcoin Developer Reference: P2P Network — Inv</a></td>
</tr>
</tbody>
</table>
<table id="p2p-getdata" class="footnote">
<tbody>
<tr>
<th>11</th>
<td><a href="https://developer.bitcoin.org/reference/p2p_networking.html#getdata">Bitcoin Developer Reference: P2P Network — GetData</a></td>
</tr>
</tbody>
</table>
</section>
</section>
</body>
</html>

175
zip-0239.rst Normal file
View File

@ -0,0 +1,175 @@
::
ZIP: 239
Title: Relay of Version 5 Transactions
Owners: Daira Hopwood <daira@electriccoin.co>
Jack Grigg <jack@electriccoin.co>
Status: Proposed
Category: Network
Created: 2021-05-29
License: MIT
Discussions-To: <https://github.com/zcash/zips/issues/515>
Pull-Request: <https://github.com/zcash/zips/pull/516>
Terminology
===========
The key words "MUST", "MUST NOT", and "SHOULD" in this document are to be interpreted
as described in RFC 2119. [#RFC2119]_
The term "network upgrade" in this document is to be interpreted as described in
ZIP 200. [#zip-0200]_
The terms "Testnet" and "Mainnet" are to be interpreted as described in
section 3.11 of the Zcash Protocol Specification [#protocol-networks]_.
The term "txid" means a transaction identifier, computed as a SHA-256d hash of
the transaction data for v4 and earlier transactions, or as specified in [#zip-0244]_
for v5 and later transactions.
The term "authorizing data commitment" (denoted ``auth_digest``), defined only for v5
and later transactions, is to be interpreted as described in [#zip-0244]_.
The term "witnessed transaction identifier" ("wtxid"), defined only for v5 and later
transactions, is a 64-byte value given by concatenating the txid and the authorizing
data commitment of the transaction.
Abstract
========
This ZIP describes changes to the Zcash peer-to-peer protocol to support transaction
relay based on a transaction's authorizing data commitment as well as its txid.
Motivation
==========
Historically, as in Bitcoin, the ``inv`` and ``getdata`` messages sent on the Zcash
peer-to-peer network to announce or request transactions have referred to those
transactions by txid.
Prior to the introduction of v5 transactions [#zip-0225]_ in the NU5 network upgrade
[#zip-0252]_, a txid was always defined as the SHA-256d hash of the transaction data,
the encoding of which is the same in block data and in the peer-to-peer protocol.
For v5 transactions, a new transaction digest algorithm is defined that constructs
the txid from a tree of hashes, which include only effecting data [#zip-0244]_.
Witness data is committed to by a separate "authorizing data commitment". Unlike
previous transaction versions, the format of serialized v5 transaction data is not
consensus-critical.
Not committing to the witness data in v5 transaction announcements would create
inefficiencies: because a v5 transaction's witness can be malleated without altering
the txid, a node in receipt of a v5 transaction that the node does not accept would
generally still have to download that same transaction when announced by other peers.
This is because the alternative — of not downloading a v5 transaction with a given
txid after rejecting a previous transaction with that txid — would allow a third
party to interfere with transaction relay by malleating a transaction's witness and
announcing the resulting invalid transaction to nodes, preventing relay of the valid
version of the transaction as well.
This inefficiency was present in Bitcoin for almost 3 years after activation of its
Segwit upgrade [#bip-0141]_, until the adoption of BIP 339 [#bip-0339]_. The latter
BIP specifies a way to use the Segwit "wtxid" (which commits to both effecting and
witness data) in place of the txid when announcing and fetching transactions.
In Zcash, the analogous identifier is also called the wtxid, but it encodes the pair
(txid, auth_digest).
This ZIP is modelled after BIP 339: it adds a ``MSG_WTX`` inv type to the peer-to-peer
protocol, analogous to BIP 339's ``MSG_WTX`` inv type, that announces transactions by
their wtxid. Note that the encoding and length of a Zcash wtxid is different to that
of a Bitcoin wtxid.
This ZIP does not introduce any equivalent of BIP 339's ``wtxidrelay`` message,
since that is not needed for compatibility given that Zcash full nodes are required to
support ``MSG_WTX`` based on the negotiated peer protocol version (see `Deployment`_).
Specification
=============
A new inv type ``MSG_WTX`` (0x00000005) is added, for use in both ``inv`` messages
and ``getdata`` requests, indicating that the hash being referenced is the wtxid
(i.e. the 64-byte value ``txid`` || ``auth_digest``). This inv type MUST be used
when announcing v5 transactions. The ``txid`` and ``auth_digest`` are as defined in
[#zip-0244]_.
In the case of ``getdata`` requests, the format of a v5 transaction obtained by a
``MSG_WTX`` inv type is as given in the Zcash protocol specification.
[#protocol-txnencodingandconsensus]_
An ``inv`` or ``getdata`` message MUST NOT use the ``MSG_WTX`` inv type for v4
or earlier transactions, or on peer connections that have not negotiated at least
the peer protocol version specified in `Deployment`_.
Note that ``MSG_WTX`` might also be used for future transaction versions after v5.
Since such versions are not currently consensus-valid, this is left unspecified
for now.
``MSG_TX`` and ``MSG_WTX`` entries may be mixed in arbitrary order in an ``inv``
message or a ``getdata`` message. Since these entry types are of different lengths
(36 bytes or 68 bytes respectively including the 4-byte type field), this implies
that the size of the message is not determined by its initial ``count`` field, and
has to be determined by parsing the whole message.
**Open issue:**
* Should we redefine ``inv`` and ``getdata`` to segregate ``MSG_TX``
and ``MSG_WTX``, making these messages simpler / more efficient to parse?
This could be done by adding new ``invw`` and ``getdataw`` messages.
See [#p2p-inv]_ and [#p2p-getdata]_ for how ``inv`` and ``getdata``
respectively are currently defined in Bitcoin.
Deployment
----------
This ZIP is assumed to be deployed in advance of the network upgrade that introduces
v5 transactions, i.e. NU5. In [#zip-0252]_, the minimum protocol version that signals
support for NU5 on Testnet is defined to be 170014. Therefore, the peer protocol
version that enables support for this specification is also defined to be 170014
(on both Testnet and Mainnet).
As specified in [#zip-0200]_, a node that supports a network upgrade will clear its
mempool when reaching the block before that upgrade's activation block. Before this
point, the node will not accept transactions into its mempool that are invalid
according to the pre-upgrade consensus protocol (so, in this case, it would not
accept v5 transactions). This means that a correctly functioning node will not
use the ``MSG_WTX`` inv type until it has received the block preceding the NU5
network upgrade.
Nevertheless, it is possible for a node to receive an ``inv`` or ``getdata`` message
with a ``MSG_WTX`` inv type, on a peer connection that has negotiated protocol
version 170014 or later, before NU5 has activated. The node MUST handle this case
in the same way that it would after NU5 activation when it has no v5 transactions
to relay. Receiving a ``MSG_WTX`` inv type on a peer connection that has negotiated
a protocol version before 170014, on the other hand, SHOULD be treated as a protocol
error.
As the ``MSG_WTX`` inv type is only enabled between peers that both support it,
older clients remain fully compatible and interoperable before NU5 activates, or on
a chain in which it does not activate.
Acknowledgements
================
This ZIP is partly based on BIP 339, written by Suhas Daftuar. [#bip-0339]_
References
==========
.. [#RFC2119] `RFC 2119: Key words for use in RFCs to Indicate Requirement Levels <https://www.rfc-editor.org/rfc/rfc2119.html>`_
.. [#zip-0200] `ZIP 200: Network Upgrade Activation Mechanism <zip-0200.rst>`_
.. [#zip-0225] `ZIP 225: Version 5 Transaction Format <zip-0225.rst>`_
.. [#zip-0244] `ZIP 244: Transaction Identifier Non-Malleability <zip-0244.rst>`_
.. [#zip-0252] `ZIP 252: Deployment of the NU5 Network Upgrade <zip-0252.rst>`_
.. [#protocol-networks] `Zcash Protocol Specification, Version 2020.2.2 [NU5 proposal]. Section 3.12 Mainnet and Testnet <protocol/nu5.pdf#networks>`_
.. [#protocol-txnencodingandconsensus] `Zcash Protocol Specification, Version 2020.2.2 [NU5 proposal]. Section 7.1: Transaction Encoding and Consensus <protocol/nu5.pdf#txnencodingandconsensus>`_
.. [#bip-0141] `BIP 141: Segregated Witness (Consensus layer) <https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki>`_
.. [#bip-0339] `BIP 339: WTXID-based transaction relay <https://github.com/bitcoin/bips/blob/master/bip-0339.mediawiki>`_
.. [#p2p-inv] `Bitcoin Developer Reference: P2P Network — Inv <https://developer.bitcoin.org/reference/p2p_networking.html#inv>`_
.. [#p2p-getdata] `Bitcoin Developer Reference: P2P Network — GetData <https://developer.bitcoin.org/reference/p2p_networking.html#getdata>`_

View File

@ -26,7 +26,7 @@ Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/446">https://githu
</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" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<section id="nu5-deployment"><h3><span class="section-heading">NU5 deployment</span><span class="section-anchor"> <a rel="bookmark" href="#nu5-deployment"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The primary sources of information about NU5 consensus protocol changes are:</p>
<p>The primary sources of information about NU5 consensus and peer-to-peer protocol changes are:</p>
<ul>
<li>The Zcash Protocol Specification <a id="id4" class="footnote_reference" href="#protocol">2</a></li>
<li>ZIP 200: Network Upgrade Mechanism <a id="id5" class="footnote_reference" href="#zip-0200">5</a></li>
@ -34,12 +34,13 @@ Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/446">https://githu
<li>ZIP 221: FlyClient - Consensus-Layer Changes <a id="id7" class="footnote_reference" href="#zip-0221">8</a> (amended)</li>
<li>ZIP 224: Orchard Shielded Protocol <a id="id8" class="footnote_reference" href="#zip-0224">9</a></li>
<li>ZIP 225: Version 5 Transaction Format <a id="id9" class="footnote_reference" href="#zip-0225">10</a></li>
<li>ZIP 244: Transaction Identifier Non-Malleability <a id="id10" class="footnote_reference" href="#zip-0244">11</a></li>
<li>The Orchard Book <a id="id11" class="footnote_reference" href="#orchard-book">13</a></li>
<li>The halo2 Book <a id="id12" class="footnote_reference" href="#halo2-book">14</a></li>
<li>ZIP 239: Relay of Version 5 Transactions <a id="id10" class="footnote_reference" href="#zip-0239">11</a></li>
<li>ZIP 244: Transaction Identifier Non-Malleability <a id="id11" class="footnote_reference" href="#zip-0244">12</a></li>
<li>The Orchard Book <a id="id12" class="footnote_reference" href="#orchard-book">14</a></li>
<li>The halo2 Book <a id="id13" class="footnote_reference" href="#halo2-book">15</a></li>
</ul>
<p>The network handshake and peer management mechanisms defined in ZIP 201 <a id="id13" class="footnote_reference" href="#zip-0201">6</a> also apply to this upgrade. Unified addresses and viewing keys are described in ZIP 316 <a id="id14" class="footnote_reference" href="#zip-0316">12</a>.</p>
<p>The following network upgrade constants <a id="id15" class="footnote_reference" href="#zip-0200">5</a> are defined for the NU5 upgrade:</p>
<p>The network handshake and peer management mechanisms defined in ZIP 201 <a id="id14" class="footnote_reference" href="#zip-0201">6</a> also apply to this upgrade. Unified addresses and viewing keys are described in ZIP 316 <a id="id15" class="footnote_reference" href="#zip-0316">13</a>.</p>
<p>The following network upgrade constants <a id="id16" class="footnote_reference" href="#zip-0200">5</a> are defined for the NU5 upgrade:</p>
<dl>
<dt>CONSENSUS_BRANCH_ID</dt>
<dd><code>0xF919A198</code></dd>
@ -61,12 +62,13 @@ Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/446">https://githu
<li>reject new connections from pre-NU5 nodes on that network;</li>
<li>disconnect any existing connections to pre-NU5 nodes on that network.</li>
</ul>
<p>The change to the peer-to-peer protocol described in ZIP 239 takes effect from peer protocol version 170014 onward, on both Testnet and Mainnet. <a id="id17" class="footnote_reference" href="#zip-0239">11</a></p>
</section>
</section>
<section id="backward-compatibility"><h2><span class="section-heading">Backward compatibility</span><span class="section-anchor"> <a rel="bookmark" href="#backward-compatibility"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>Prior to the network upgrade activating on each network, NU5 and pre-NU5 nodes are compatible and can connect to each other.</p>
<p>Once the network upgrades, even though pre-NU5 nodes can still accept the numerically larger protocol version used by NU5 as being valid, NU5 nodes will always disconnect peers using lower protocol versions.</p>
<p>Unlike Blossom, Heartwood, and Canopy, and like Overwinter and Sapling, NU5 defines a new transaction version. Therefore, NU5 transactions MAY be in the new v5 format specified by <a id="id16" class="footnote_reference" href="#zip-0225">10</a>. Unlike previous transaction version updates, the existing v4 transaction format remains valid after NU5 activation. Both transaction formats MUST be accepted by NU5 nodes.</p>
<p>Unlike Blossom, Heartwood, and Canopy, and like Overwinter and Sapling, NU5 defines a new transaction version. Therefore, NU5 transactions MAY be in the new v5 format specified by <a id="id18" class="footnote_reference" href="#zip-0225">10</a>. Unlike previous transaction version updates, the existing v4 transaction format remains valid after NU5 activation. Both transaction formats MUST be accepted by NU5 nodes.</p>
</section>
<section id="support-in-zcashd"><h2><span class="section-heading">Support in zcashd</span><span class="section-anchor"> <a rel="bookmark" href="#support-in-zcashd"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p><strong>TODO: Update as needed</strong></p>
@ -81,7 +83,7 @@ Pull-Request: &lt;<a href="https://github.com/zcash/zips/pull/446">https://githu
* This was three days for upgrades up to and including Blossom, and is 1.5 days from Heartwood onward.
*/
static const int NETWORK_UPGRADE_PEER_PREFERENCE_BLOCK_PERIOD = 1728;</pre>
<p>The implementation is similar to that for Overwinter which was described in <a id="id17" class="footnote_reference" href="#zip-0201">6</a>.</p>
<p>The implementation is similar to that for Overwinter which was described in <a id="id19" class="footnote_reference" href="#zip-0201">6</a>.</p>
<p>However, NU5 nodes will have a preference for connecting to other NU5 nodes, so pre-NU5 nodes will gradually be disconnected in the run up to activation.</p>
</section>
</section>
@ -181,10 +183,18 @@ static const int NETWORK_UPGRADE_PEER_PREFERENCE_BLOCK_PERIOD = 1728;</pre>
</tr>
</tbody>
</table>
<table id="zip-0244" class="footnote">
<table id="zip-0239" class="footnote">
<tbody>
<tr>
<th>11</th>
<td><a href="zip-0239">ZIP 239: Relay of Version 5 Transactions</a></td>
</tr>
</tbody>
</table>
<table id="zip-0244" class="footnote">
<tbody>
<tr>
<th>12</th>
<td><a href="zip-0244">ZIP 244: Transaction Identifier Non-Malleability</a></td>
</tr>
</tbody>
@ -192,7 +202,7 @@ static const int NETWORK_UPGRADE_PEER_PREFERENCE_BLOCK_PERIOD = 1728;</pre>
<table id="zip-0316" class="footnote">
<tbody>
<tr>
<th>12</th>
<th>13</th>
<td><a href="zip-0316">ZIP 316: Unified Addresses and Unified Viewing Keys</a></td>
</tr>
</tbody>
@ -200,7 +210,7 @@ static const int NETWORK_UPGRADE_PEER_PREFERENCE_BLOCK_PERIOD = 1728;</pre>
<table id="orchard-book" class="footnote">
<tbody>
<tr>
<th>13</th>
<th>14</th>
<td><a href="https://zcash.github.io/orchard/">The Orchard Book</a></td>
</tr>
</tbody>
@ -208,7 +218,7 @@ static const int NETWORK_UPGRADE_PEER_PREFERENCE_BLOCK_PERIOD = 1728;</pre>
<table id="halo2-book" class="footnote">
<tbody>
<tr>
<th>14</th>
<th>15</th>
<td><a href="https://zcash.github.io/halo2/">The halo2 Book</a></td>
</tr>
</tbody>

View File

@ -37,7 +37,8 @@ Specification
NU5 deployment
--------------
The primary sources of information about NU5 consensus protocol changes are:
The primary sources of information about NU5 consensus and peer-to-peer protocol
changes are:
- The Zcash Protocol Specification [#protocol]_
- ZIP 200: Network Upgrade Mechanism [#zip-0200]_
@ -45,6 +46,7 @@ The primary sources of information about NU5 consensus protocol changes are:
- ZIP 221: FlyClient - Consensus-Layer Changes [#zip-0221]_ (amended)
- ZIP 224: Orchard Shielded Protocol [#zip-0224]_
- ZIP 225: Version 5 Transaction Format [#zip-0225]_
- ZIP 239: Relay of Version 5 Transactions [#zip-0239]_
- ZIP 244: Transaction Identifier Non-Malleability [#zip-0244]_
- The Orchard Book [#orchard-book]_
- The halo2 Book [#halo2-book]_
@ -85,6 +87,9 @@ Once NU5 activates on testnet or mainnet, NU5 nodes SHOULD take steps to:
- reject new connections from pre-NU5 nodes on that network;
- disconnect any existing connections to pre-NU5 nodes on that network.
The change to the peer-to-peer protocol described in ZIP 239 takes effect
from peer protocol version 170014 onward, on both Testnet and Mainnet. [#zip-0239]_
Backward compatibility
======================
@ -187,6 +192,7 @@ References
.. [#zip-0221] `ZIP 221: FlyClient - Consensus-Layer Changes <zip-0221.rst>`_
.. [#zip-0224] `ZIP 224: Orchard Shielded Protocol <zip-0224.rst>`_
.. [#zip-0225] `ZIP 225: Version 5 Transaction Format <zip-0225.rst>`_
.. [#zip-0239] `ZIP 239: Relay of Version 5 Transactions <zip-0239.rst>`_
.. [#zip-0244] `ZIP 244: Transaction Identifier Non-Malleability <zip-0244.rst>`_
.. [#zip-0316] `ZIP 316: Unified Addresses and Unified Viewing Keys <zip-0316.rst>`_
.. [#orchard-book] `The Orchard Book <https://zcash.github.io/orchard/>`_