From 6526ebb0881eccece6ff8e789efc233f1dd6fbb8 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 10 Mar 2020 21:49:50 +0000 Subject: [PATCH] Add ZIPs 214 and 251. Signed-off-by: Daira Hopwood --- README.rst | 2 + index.html | 2 + zip-0214.html | 198 ++++++++++++++++++++++++++++++ zip-0214.rst | 327 ++++++++++++++++++++++++++++++++++++++++++++++++++ zip-0251.html | 135 +++++++++++++++++++++ zip-0251.rst | 134 +++++++++++++++++++++ 6 files changed, 798 insertions(+) create mode 100644 zip-0214.html create mode 100644 zip-0214.rst create mode 100644 zip-0251.html create mode 100644 zip-0251.rst diff --git a/README.rst b/README.rst index 7211ee6d..d377de23 100644 --- a/README.rst +++ b/README.rst @@ -62,9 +62,11 @@ Index of ZIPs 209 Prohibit Negative Shielded Value Pool Final 210 Sapling Anchor Deduplication within Transactions Draft 213 Shielded Coinbase Implemented (zcashd) + 214 Consensus rules for a Zcash Development Fund Draft 221 FlyClient - Consensus-Layer Changes Proposed 243 Transaction Signature Verification for Sapling Final 250 Deployment of the Heartwood Network Upgrade Draft + 251 Deployment of the ${NU4} Network Upgrade Draft 308 Sprout to Sapling Migration Final 310 Security Properties of Sapling Viewing Keys Draft 401 Addressing mempool denial-of-service Final diff --git a/index.html b/index.html index 8ab8fe37..6da551a0 100644 --- a/index.html +++ b/index.html @@ -41,9 +41,11 @@ 209 Prohibit Negative Shielded Value Pool Final 210 Sapling Anchor Deduplication within Transactions Draft 213 Shielded Coinbase Implemented (zcashd) + 214 Consensus rules for a Zcash Development Fund Draft 221 FlyClient - Consensus-Layer Changes Proposed 243 Transaction Signature Verification for Sapling Final 250 Deployment of the Heartwood Network Upgrade Draft + 251 Deployment of the ${NU4} Network Upgrade Draft 308 Sprout to Sapling Migration Final 310 Security Properties of Sapling Viewing Keys Draft 401 Addressing mempool denial-of-service Final diff --git a/zip-0214.html b/zip-0214.html new file mode 100644 index 00000000..6ea7b69c --- /dev/null +++ b/zip-0214.html @@ -0,0 +1,198 @@ + + + + ZIP 214: Consensus rules for a Zcash Development Fund + + + +
+
ZIP: 214
+Title: Consensus rules for a Zcash Development Fund
+Owners: Daira Hopwood <daira@electriccoin.co>
+Status: Draft
+Category: Consensus
+Created: 2020-02-28
+License: MIT
+Discussions-To: <https://forum.zcashcommunity.com/t/community-sentiment-polling-results-nu4-and-draft-zip-1014/35560>
+

Terminology

+

The key words "MUST", "MUST NOT", "SHALL", "SHALL NOT", "SHOULD", and "MAY" in this document are to be interpreted as described in RFC 2119. 1

+

The term "network upgrade" in this document is to be interpreted as described in ZIP 200 5 and the Zcash Trademark Donation and License Agreement (3 or successor agreement).

+

The terms "block subsidy" and "halving" in this document are to be interpreted as described in sections 3.9 and 7.7 of the Zcash Protocol Specification. 2

+

The terms "Electric Coin Company" (or "ECC"), "Zcash Foundation" (or "ZF"), "Major Grants", "ECC slice", "ZF slice", and "MG slice" in this document are to be interpreted as described in ZIP 1014 9.

+

The terms below are to be interpreted as follows:

+
+
${NU4}
+
Code-name for the fifth Zcash network upgrade, also known as Network Upgrade 4.
+
Testnet
+
The Zcash test network, as defined in 2.
+
Mainnet
+
The Zcash production network, as defined in 2.
+
+
+

Abstract

+

This ZIP describes consensus rule changes interpreting the proposed structure of the Zcash Development Fund, which is to be enacted in Network Upgrade 4 and last for 4 years.

+
+

Motivation

+

Motivation for the Zcash Development Fund itself is considered in ZIP 1014 9, which gives a high-level description of the intended structure of the fund.

+

An important motivation for describing the consensus rules in a separate ZIP is to avoid making unintended changes to ZIP 1014, which has already been agreed between ECC, ZF, and the Zcash community. This facilitates critically assessing whether the consensus rule changes accurately reflect the intent of ZIP 1014.

+
+

Requirements

+

The primary requirement of this ZIP is to make changes to consensus rules necessary and sufficient to implement the intent of ZIP 1014.

+

The Zcash Development Fund distributes funding in ZEC obtained from block subsidies on Mainnet. This ZIP should also specify corresponding rules, addresses, and activation height for Testnet, in order to allow testing and auditing of the design and implementation within sufficient lead time before activation on Mainnet.

+
+

Non-requirements

+

This ZIP is not required to enforce provisions of ZIP 1014 that fall outside what is implementable by Zcash consensus rules.

+
+

Specification

+

The Blossom network upgrade changed the height of the first halving to block height 1046400 7, as a consequence of reducing the block target spacing from 150 seconds to 75 seconds.

+

Since ZIP 1014 specifies that the Zcash Development Fund starts at the first halving, the activation height of ${NU4} on Mainnet therefore SHALL be 1046400.

+

ZIP 207 6 SHALL be activated in ${NU4}.

+

The following funding streams are defined for Mainnet:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
StreamNumeratorDenominatorStart heightEnd height
FS_ECC710010464002726400
FS_ZF510010464002726400
FS_MG810010464002726400
+
+

The funding streams are defined for Testnet are identical except that the start height of each stream is the activation height of ${NU4} on Testnet, i.e. xxxxxxx.

+

Note: on Testnet, the activation height of ${NU4} will be before the first halving. Therefore, the consequence of the above rules for Testnet is that the amount sent to each Zcash Development Fund recipient address will initially (before Testnet block height 1046400) be double the corresponding initial amount on Mainnet. This reduces to the same amount as on Mainnet, from Testnet block heights 1046400 (inclusive) to 2726400 (exclusive).

+

Dev Fund Recipient Addresses

+

For each of Testnet and Mainnet, before deploying this ZIP in a node implementation with the activation height set for that network, each of the parties (ECC and ZF) SHALL generate sequences of independent recipient addresses to be used for each stream in each funding period:

+
    +
  • ECC SHALL generate the addresses for the FS_ECC funding stream, which on Mainnet corresponds to the ECC slice;
  • +
  • ZF SHALL generate the addresses for the FS_ZF and FS_MG funding streams, which on Mainnet correspond to the ZF slice and MG slice respectively.
  • +
+

Funds sent to each Mainnet funding stream SHALL be governed by all requirements on the corresponding slice specified in ZIP 1014 9.

+

No requirements are imposed on the use of funds sent to Testnet funding streams.

+

Direct-grant option

+

ZIP 1014 specifies a "direct-grant option" by which, if agreed upon by both ECC and ZF before ${NU4} activation, some portion of the MG slice may be directly assigned to the grantee(s), rather than accepted and disbursed by ZF. 9

+

The funding stream mechanism allows for this option by adding a funding stream corresponding to each direct grantee, with addresses generated by ZF. In this case the total amount of funding streams assigned to direct grantees MUST be subtracted from the funding stream for the remaining MG slice (or, if all Major Grants are direct, replace the funding stream for the MG slice).

+

For each network upgrade after ${NU4} requiring modifications to the set of direct grantees, a separate ZIP would be published specifying those modifications.

+
+
+

Mainnet Recipient Addresses

+
+
+
FS_ECC_Addresses[0..47] = [
+
"TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO" ]
+
FS_ZF_Addresses[0..47] = [
+
"TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO" ]
+
FS_MG_Addresses[0..47] = [
+
"TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO", "TODO" ]
+
+
+
+

Testnet Recipient Addresses

+

TODO

+
+
+

Deployment

+

This proposal is intended to be deployed with ${NU4}. 8

+
+

References

+ + + + + + + +
1Key words for use in RFCs to Indicate Requirement Levels
+ + + + + + + +
2Zcash Protocol Specification [Overwinter+Sapling+Blossom]
+ + + + + + + +
3Zcash Trademark Donation and License Agreement
+ + + + + + + +
4The Open Source Definition
+ + + + + + + +
5ZIP 200: Network Upgrade Mechanism
+ + + + + + + +
6ZIP 207: Funding Streams
+ + + + + + + +
7ZIP 208: Shorter Block Target Spacing
+ + + + + + + +
8ZIP 251: Deployment of the ${NU4} Network Upgrade
+ + + + + + + +
9ZIP 1014: Establishing a Dev Fund for ECC, ZF, and Major Grants
+
+
+ + \ No newline at end of file diff --git a/zip-0214.rst b/zip-0214.rst new file mode 100644 index 00000000..236f5bfb --- /dev/null +++ b/zip-0214.rst @@ -0,0 +1,327 @@ +:: + + ZIP: 214 + Title: Consensus rules for a Zcash Development Fund + Owners: Daira Hopwood + Status: Draft + Category: Consensus + Created: 2020-02-28 + License: MIT + Discussions-To: + + +Terminology +=========== + +The key words "MUST", "MUST NOT", "SHALL", "SHALL NOT", "SHOULD", and "MAY" +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]_ and the Zcash Trademark Donation and License +Agreement ([#trademark]_ or successor agreement). + +The terms "block subsidy" and "halving" in this document are to be interpreted +as described in sections 3.9 and 7.7 of the Zcash Protocol Specification. +[#protocol]_ + +The terms "Electric Coin Company" (or "ECC"), "Zcash Foundation" (or "ZF"), +"Major Grants", "ECC slice", "ZF slice", and "MG slice" in this document are to +be interpreted as described in ZIP 1014 [#zip-1014]_. + +The terms below are to be interpreted as follows: + +${NU4} + Code-name for the fifth Zcash network upgrade, also known as Network Upgrade 4. +Testnet + The Zcash test network, as defined in [#protocol]_. +Mainnet + The Zcash production network, as defined in [#protocol]_. + + +Abstract +======== + +This ZIP describes consensus rule changes interpreting the proposed structure of +the Zcash Development Fund, which is to be enacted in Network Upgrade 4 and last +for 4 years. + + +Motivation +========== + +Motivation for the Zcash Development Fund itself is considered in ZIP 1014 +[#zip-1014]_, which gives a high-level description of the intended structure of +the fund. + +An important motivation for describing the consensus rules in a separate ZIP is +to avoid making unintended changes to ZIP 1014, which has already been agreed +between ECC, ZF, and the Zcash community. This facilitates critically assessing +whether the consensus rule changes accurately reflect the intent of ZIP 1014. + + +Requirements +============ + +The primary requirement of this ZIP is to make changes to consensus rules necessary +and sufficient to implement the intent of ZIP 1014. + +The Zcash Development Fund distributes funding in ZEC obtained from block subsidies +on Mainnet. This ZIP should also specify corresponding rules, addresses, and +activation height for Testnet, in order to allow testing and auditing of the design +and implementation within sufficient lead time before activation on Mainnet. + + +Non-requirements +================ + +This ZIP is not required to enforce provisions of ZIP 1014 that fall outside what +is implementable by Zcash consensus rules. + + +Specification +============= + +The Blossom network upgrade changed the height of the first halving to block height +1046400 [#zip-0208]_, as a consequence of reducing the block target spacing from +150 seconds to 75 seconds. + +Since ZIP 1014 specifies that the Zcash Development Fund starts at the first halving, +the activation height of ${NU4} on Mainnet therefore SHALL be 1046400. + +ZIP 207 [#zip-0207]_ SHALL be activated in ${NU4}. + +The following funding streams are defined for Mainnet: + + ========== =========== ============= ============== ============ + Stream Numerator Denominator Start height End height + ========== =========== ============= ============== ============ + ``FS_ECC`` 7 100 1046400 2726400 + ``FS_ZF`` 5 100 1046400 2726400 + ``FS_MG`` 8 100 1046400 2726400 + ========== =========== ============= ============== ============ + +The funding streams are defined for Testnet are identical except that the +start height of each stream is the activation height of ${NU4} on Testnet, i.e. +xxxxxxx. + +Note: on Testnet, the activation height of ${NU4} will be before the first halving. +Therefore, the consequence of the above rules for Testnet is that the amount sent +to each Zcash Development Fund recipient address will initially (before Testnet +block height 1046400) be double the corresponding initial amount on Mainnet. This +reduces to the same amount as on Mainnet, from Testnet block heights 1046400 +(inclusive) to 2726400 (exclusive). + + +Dev Fund Recipient Addresses +---------------------------- + +For each of Testnet and Mainnet, before deploying this ZIP in a node implementation +with the activation height set for that network, each of the parties (ECC and ZF) +SHALL generate sequences of independent recipient addresses to be used for each +stream in each funding period: + +* ECC SHALL generate the addresses for the ``FS_ECC`` funding stream, which on + Mainnet corresponds to the **ECC slice**; +* ZF SHALL generate the addresses for the ``FS_ZF`` and ``FS_MG`` funding streams, + which on Mainnet correspond to the **ZF slice** and **MG slice** respectively. + +Funds sent to each Mainnet funding stream SHALL be governed by all requirements on +the corresponding slice specified in ZIP 1014 [#zip-1014]_. + +No requirements are imposed on the use of funds sent to Testnet funding streams. + + +Direct-grant option +''''''''''''''''''' + +ZIP 1014 specifies a "direct-grant option" by which, if agreed upon by both ECC +and ZF before ${NU4} activation, some portion of the **MG slice** may be directly +assigned to the grantee(s), rather than accepted and disbursed by ZF. [#zip-1014]_ + +The funding stream mechanism allows for this option by adding a funding stream +corresponding to each direct grantee, with addresses generated by ZF. In this case +the total amount of funding streams assigned to direct grantees MUST be subtracted +from the funding stream for the remaining **MG slice** (or, if all Major Grants are +direct, replace the funding stream for the **MG slice**). + +For each network upgrade after ${NU4} requiring modifications to the set of direct +grantees, a separate ZIP would be published specifying those modifications. + + +Mainnet Recipient Addresses +--------------------------- + + FS_ECC_Addresses[0..47] = [ + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO" ] + + FS_ZF_Addresses[0..47] = [ + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO" ] + + FS_MG_Addresses[0..47] = [ + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO", + "TODO" ] + +Testnet Recipient Addresses +--------------------------- + +TODO + + +Deployment +========== + +This proposal is intended to be deployed with ${NU4}. [#zip-0251]_ + + +References +========== + +.. [#RFC2119] `Key words for use in RFCs to Indicate Requirement Levels `_ +.. [#protocol] `Zcash Protocol Specification [Overwinter+Sapling+Blossom] `_ +.. [#trademark] `Zcash Trademark Donation and License Agreement `_ +.. [#osd] `The Open Source Definition `_ +.. [#zip-0200] `ZIP 200: Network Upgrade Mechanism `_ +.. [#zip-0207] `ZIP 207: Funding Streams `_ +.. [#zip-0208] `ZIP 208: Shorter Block Target Spacing `_ +.. [#zip-0251] `ZIP 251: Deployment of the ${NU4} Network Upgrade `_ +.. [#zip-1014] `ZIP 1014: Establishing a Dev Fund for ECC, ZF, and Major Grants `_ diff --git a/zip-0251.html b/zip-0251.html new file mode 100644 index 00000000..07198272 --- /dev/null +++ b/zip-0251.html @@ -0,0 +1,135 @@ + + + + ZIP 251: Deployment of the Network Upgrade + + + +
+
ZIP: 251
+Title: Deployment of the ${NU4} Network Upgrade
+Owners: Daira Hopwood <daira@electriccoin.co>
+Status: Draft
+Category: Consensus
+Created: 2020-02-28
+License: MIT
+

Terminology

+

The key words "MUST", "MUST NOT", "SHOULD", and "MAY" in this document are to be interpreted as described in RFC 2119. 1

+

The term "network upgrade" in this document is to be interpreted as described in ZIP 200. 3

+

The terms below are to be interpreted as follows:

+
+
${NU4}
+
Code-name for the fifth Zcash network upgrade, also known as Network Upgrade 4.
+
Testnet
+
The Zcash test network, as defined in 2.
+
Mainnet
+
The Zcash production network, as defined in 2.
+
+
+

Abstract

+

This proposal defines the deployment of the ${NU4} network upgrade.

+
+

Specification

+

${NU4} deployment

+

The primary sources of information about ${NU4} consensus protocol changes are:

+
    +
  • The Zcash Protocol Specification 2
  • +
  • ZIP 200: Network Upgrade Mechanism 3
  • +
  • ZIP 207: Funding Streams 5
  • +
  • ZIP 214: Consensus rules for a Zcash Development Fund 6
  • +
  • ZIP 1014: Establishing a Dev Fund for ECC, ZF, and Major Grants 7
  • +
  • TODO: other ZIPs
  • +
+

The network handshake and peer management mechanisms defined in ZIP 201 4 also apply to this upgrade.

+

The following network upgrade constants 3 are defined for the ${NU4} upgrade:

+
+
BRANCH_ID
+
0xTODO
+
ACTIVATION_HEIGHT (${NU4})
+
+

Testnet: TODO

+

Mainnet: 1046400

+
+
+

Nodes compatible with ${NU4} activation on testnet MUST advertise protocol version TODO or later. Nodes compatible with ${NU4} activation on mainnet MUST advertise protocol version TODO or later. The minimum peer protocol version that ${NU4}-compatible nodes will connect to is 170002.

+

Pre-${NU4} testnet nodes are defined as nodes on testnet advertising a protocol version less than TODO. Pre-${NU4} mainnet nodes are defined as nodes on mainnet advertising a protocol version less than TODO.

+

For each network (testnet and mainnet), approximately three days (defined in terms of block height) before the corresponding ${NU4} activation height, nodes compatible with ${NU4} activation on that network will change the behaviour of their peer connection logic in order to prefer pre-${NU4} peers on that network for eviction from the set of peer connections:

+
/** The period before a network upgrade activates, where connections to upgrading peers are preferred (in blocks). */
+static const int NETWORK_UPGRADE_PEER_PREFERENCE_BLOCK_PERIOD = 24 * 24 * 3;
+

The implementation is similar to that for Overwinter which was described in 4.

+

Once ${NU4} activates on testnet or mainnet, ${NU4} nodes SHOULD take steps to:

+
    +
  • reject new connections from pre-${NU4} nodes on that network;
  • +
  • disconnect any existing connections to pre-${NU4} nodes on that network.
  • +
+
+
+

Backward compatibility

+

Prior to the network upgrade activating on each network, ${NU4} and pre-${NU4} nodes are compatible and can connect to each other. However, ${NU4} nodes will have a preference for connecting to other ${NU4} nodes, so pre-${NU4} nodes will gradually be disconnected in the run up to activation.

+

Once the network upgrades, even though pre-${NU4} nodes can still accept the numerically larger protocol version used by ${NU4} as being valid, ${NU4} nodes will always disconnect peers using lower protocol versions.

+

TODO: delete if applicable. Unlike Overwinter and Sapling, and like Blossom, ${NU4} does not define a new transaction version. ${NU4} transactions are therefore in the same v4 format as Sapling transactions, and use the same version group ID, i.e. 0x892F2085 as defined in 2 section 7.1. This does not imply that transactions are valid across the ${NU4} activation, since signatures MUST use the appropriate consensus branch ID.

+
+

Support in zcashd

+

Support for ${NU4} on testnet will be implemented in zcashd version TODO, which will advertise protocol version TODO. Support for ${NU4} on mainnet will be implemented in zcashd version 3.0.0, which will advertise protocol version TODO.

+
+

References

+ + + + + + + +
1Key words for use in RFCs to Indicate Requirement Levels
+ + + + + + + +
2Zcash Protocol Specification, Version 2019.0.4 or later [Overwinter+Sapling+Blossom]
+ + + + + + + +
3ZIP 200: Network Upgrade Activation Mechanism
+ + + + + + + +
4ZIP 201: Network Peer Management for Overwinter
+ + + + + + + +
5ZIP 208: Shorter Block Target Spacing
+ + + + + + + +
6ZIP 214: Consensus rules for a Zcash Development Fund
+ + + + + + + +
7ZIP 1014: Establishing a Dev Fund for ECC, ZF, and Major Grants
+
+
+ + \ No newline at end of file diff --git a/zip-0251.rst b/zip-0251.rst new file mode 100644 index 00000000..d5610b1b --- /dev/null +++ b/zip-0251.rst @@ -0,0 +1,134 @@ +:: + + ZIP: 251 + Title: Deployment of the ${NU4} Network Upgrade + Owners: Daira Hopwood + Status: Draft + Category: Consensus + Created: 2020-02-28 + License: MIT + + +Terminology +=========== + +The key words "MUST", "MUST NOT", "SHOULD", and "MAY" 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 below are to be interpreted as follows: + +${NU4} + Code-name for the fifth Zcash network upgrade, also known as Network Upgrade 4. +Testnet + The Zcash test network, as defined in [#protocol]_. +Mainnet + The Zcash production network, as defined in [#protocol]_. + + +Abstract +======== + +This proposal defines the deployment of the ${NU4} network upgrade. + + +Specification +============= + +${NU4} deployment +----------------- + +The primary sources of information about ${NU4} consensus protocol changes are: + +- The Zcash Protocol Specification [#protocol]_ +- ZIP 200: Network Upgrade Mechanism [#zip-0200]_ +- ZIP 207: Funding Streams [#zip-0207]_ +- ZIP 214: Consensus rules for a Zcash Development Fund [#zip-0214]_ +- ZIP 1014: Establishing a Dev Fund for ECC, ZF, and Major Grants [#zip-1014]_ +- TODO: other ZIPs + +The network handshake and peer management mechanisms defined in ZIP 201 [#zip-0201]_ +also apply to this upgrade. + + +The following network upgrade constants [#zip-0200]_ are defined for the ${NU4} +upgrade: + +BRANCH_ID + ``0xTODO`` + + +ACTIVATION_HEIGHT (${NU4}) + Testnet: TODO + + Mainnet: 1046400 + + +Nodes compatible with ${NU4} activation on testnet MUST advertise protocol version +TODO or later. Nodes compatible with ${NU4} activation on mainnet MUST advertise +protocol version TODO or later. The minimum peer protocol version that +${NU4}-compatible nodes will connect to is 170002. + +Pre-${NU4} testnet nodes are defined as nodes on testnet advertising a protocol +version less than TODO. Pre-${NU4} mainnet nodes are defined as nodes on mainnet +advertising a protocol version less than TODO. + +For each network (testnet and mainnet), approximately three days (defined in terms of +block height) before the corresponding ${NU4} activation height, nodes compatible +with ${NU4} activation on that network will change the behaviour of their peer +connection logic in order to prefer pre-${NU4} peers on that network for eviction +from the set of peer connections:: + + /** The period before a network upgrade activates, where connections to upgrading peers are preferred (in blocks). */ + static const int NETWORK_UPGRADE_PEER_PREFERENCE_BLOCK_PERIOD = 24 * 24 * 3; + +The implementation is similar to that for Overwinter which was described in +[#zip-0201]_. + +Once ${NU4} activates on testnet or mainnet, ${NU4} nodes SHOULD take steps to: + +- reject new connections from pre-${NU4} nodes on that network; +- disconnect any existing connections to pre-${NU4} nodes on that network. + + +Backward compatibility +====================== + +Prior to the network upgrade activating on each network, ${NU4} and pre-${NU4} +nodes are compatible and can connect to each other. However, ${NU4} nodes will +have a preference for connecting to other ${NU4} nodes, so pre-${NU4} nodes will +gradually be disconnected in the run up to activation. + +Once the network upgrades, even though pre-${NU4} nodes can still accept the +numerically larger protocol version used by ${NU4} as being valid, ${NU4} nodes +will always disconnect peers using lower protocol versions. + +TODO: delete if applicable. +Unlike Overwinter and Sapling, and like Blossom, ${NU4} does not define a new +transaction version. ${NU4} transactions are therefore in the same v4 format as +Sapling transactions, and use the same version group ID, i.e. 0x892F2085 as +defined in [#protocol]_ section 7.1. This does not imply that transactions are +valid across the ${NU4} activation, since signatures MUST use the appropriate +consensus branch ID. + + +Support in zcashd +================= + +Support for ${NU4} on testnet will be implemented in ``zcashd`` version TODO, which +will advertise protocol version TODO. Support for ${NU4} on mainnet will be implemented +in ``zcashd`` version 3.0.0, which will advertise protocol version TODO. + + +References +========== + +.. [#RFC2119] `Key words for use in RFCs to Indicate Requirement Levels `_ +.. [#protocol] `Zcash Protocol Specification, Version 2019.0.4 or later [Overwinter+Sapling+Blossom] `_ +.. [#zip-0200] `ZIP 200: Network Upgrade Activation Mechanism `_ +.. [#zip-0201] `ZIP 201: Network Peer Management for Overwinter `_ +.. [#zip-0207] `ZIP 208: Shorter Block Target Spacing `_ +.. [#zip-0214] `ZIP 214: Consensus rules for a Zcash Development Fund `_ +.. [#zip-1014] `ZIP 1014: Establishing a Dev Fund for ECC, ZF, and Major Grants `_