ZIP: 207
Title: Funding Streams
Owners: Jack Grigg <str4d@electriccoin.co>
        Daira-Emma Hopwood <daira-emma@electriccoin.co>
Status: Final
Category: Consensus
Created: 2019-01-04
License: MIT

Terminology

The key words "MUST", "SHOULD", "SHOULD NOT", and "MAY" in this document are to be interpreted as described in BCP 14 1 when, and only when, they appear in all capitals.

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. 3 9

The terms "consensus branch" and "network upgrade" in this document are to be interpreted as described in ZIP 200. 13

The terms below are to be interpreted as follows:

Canopy
Code-name for the fifth Zcash network upgrade, also known as Network Upgrade 4.
Testnet
The Zcash test network, as defined in the Zcash Protocol Specification. 4
Mainnet
The Zcash production network, as defined in the Zcash Protocol Specification. 4

Abstract

This proposal specifies a mechanism to support funding streams, distributed from a portion of the block subsidy for a specified range of block heights.

This is intended as a means of implementing the Zcash Development Fund, using the funding stream definitions specified in ZIP 214 17. It should be read in conjunction with ZIP 1014 20, which describes the high-level requirements for that fund.

Motivation

Motivation for the Zcash Development Fund is considered in ZIP 1014 20.

This ZIP 207 was originally proposed for the Blossom network upgrade, as a means of splitting the original Founders' Reward into several streams. It was then withdrawn when such splitting was judged to be unnecessary at the consensus level. Since the capabilities of the funding stream mechanism match the requirements for the Zcash Development Fund, the ZIP was reintroduced for that purpose in the Canopy upgrade in order to reuse specification, analysis, and implementation effort.

As of NU6, ZIP 1015 21 directs part of the block reward to a reserve, the distribution of which is to be determined via a future ZIP. ZIP 2001 22 modified this ZIP to augment the funding stream mechanism with a common mechanism to implement this proposal.

Requirements

The primary requirement of this ZIP is to provide a mechanism for specifying the funding streams that are used in ZIP 214 17 to implement the Zcash Development Fund. It should be sufficiently expressive to handle both the main three "slices" (BP, ZF, and MG) defined in ZIP 1014 20, and also (with additional funding stream definitions) the "direct grant option" described in that ZIP.

As for the original Founders' Reward, a mechanism is provided to allow addresses for a given funding stream to be changed on a roughly-monthly basis, so that keys that are not yet needed may be kept off-line as a security measure.

Specification

Definitions

We use the following constants and functions defined in 5, 8, 9, and 10:

  • \(\mathsf{BlossomActivationHeight}\)
  • \(\mathsf{PostBlossomHalvingInterval}\)
  • \(\mathsf{Halving}(\mathsf{height})\)
  • \(\mathsf{BlockSubsidy}(\mathsf{height})\)
  • \(\mathsf{RedeemScriptHash}(\mathsf{height})\) .

We also define the following function:

  • \(\mathsf{HeightForHalving}(\mathsf{halving})\) : Smallest \(\mathsf{height}\) such that \(\mathsf{Halving}(\mathsf{height}) = \mathsf{halving}\)

Funding streams

A funding stream is defined by a block subsidy fraction (represented as a numerator and a denominator), a start height (inclusive), an end height (exclusive), and a sequence of recipients as defined below.

By defining the issuance as a proportion of the total block subsidy, rather than absolute zatoshis, this ZIP dovetails with any changes to both block target spacing and issuance-per-block rates. Such a change occurred at the Blossom network upgrade, for example. 14

The value of a funding stream at a given block height is defined as:

\(\mathsf{FundingStream[FUND].Value}(\mathsf{height}) = \mathsf{floor}\left( \frac{\mathsf{BlockSubsidy}(\mathsf{height}) \,\cdot\, \mathsf{FundingStream[FUND].ValueNumerator}}{\mathsf{FundingStream[FUND].ValueDenominator}} \right)\)

An active funding stream at a given block height is defined as a funding stream for which the block height is less than its end height, but not less than its start height.

The funding streams are paid to one of a pre-defined set of recipients, depending on the block height. Each recipient identifier MUST be either the string encoding of a transparent P2SH address or Sapling address (as specified in 6 or [#protocol-saplingpaymentaddrencoding]) to be paid by an output in the coinbase transaction, or the identifier \(\mathsf{DEFERRED}\_\mathsf{POOL}\) . The latter, added in the NU6 network upgrade 19, indicates that the value is to be paid to a reserve to be used for development funding, the distribution of which is to be determined via a future ZIP.

Each address is used for at most 1/48th of a halving interval, creating a roughly-monthly sequence of funding periods. The address to be used for a given block height is defined as follows:

\(\begin{eqnarray*} \mathsf{AddressChangeInterval} &=& \mathsf{PostBlossomHalvingInterval} / 48 \\ \mathsf{AddressPeriod}(\mathsf{height}) &=& \mathsf{floor}\left( {\small\frac{\mathsf{height} + \mathsf{PostBlossomHalvingInterval} - \mathsf{HeightForHalving}(1)}{\mathsf{AddressChangeInterval}}} \right) \\ \mathsf{FundingStream[FUND].AddressIndex}(\mathsf{height}) &=& \mathsf{AddressPeriod}(\mathsf{height}) - \\&&\hspace{2em} \mathsf{AddressPeriod}(\mathsf{FundingStream[FUND].StartHeight}) \\ \mathsf{FundingStream[FUND].Address}(\mathsf{height}) &=& \mathsf{FundingStream[FUND].Addresses[} \\&&\hspace{2em} \mathsf{FundingStream[FUND].AddressIndex}(\mathsf{height})\mathsf{]} \end{eqnarray*}\)

This has the property that all active funding streams change the address they are using on the same block height schedule, aligned to the height of the first halving so that 48 funding periods fit cleanly within a halving interval. This can be leveraged to simplify implementations, by batching the necessary outputs for each funding period.

Below is a visual representation of how stream addresses align with funding periods:

Example height Stream A Stream B Stream C
AddressChangeInterval - 2 A0
AddressChangeInterval - 1 A0
AddressChangeInterval A1 B0 C0
AddressChangeInterval + 1 A1 B0 C0
...
2*AddressChangeInterval - 2 A1 B0 C0
2*AddressChangeInterval - 1 A1 B0 C0
2*AddressChangeInterval A2 C1
2*AddressChangeInterval + 1 A2 C1
...
PostBlossomHalvingInterval - 2 A2 C1
PostBlossomHalvingInterval - 1 A2 C1
PostBlossomHalvingInterval C2
PostBlossomHalvingInterval + 1 C2

On Mainnet, Canopy is planned to activate exactly at the point when the Founders' Reward expires, at block height 1046400. On Testnet, there will be a shortened Founders' Reward address period prior to Canopy activation.

Deferred Development Fund Chain Value Pool Balance

Full node implementations MUST track an additional \(\mathsf{ChainValuePoolBalance^{Deferred}}\) chain value pool balance, in addition to the Sprout, Sapling, and Orchard chain value pool balances.

Define \(\mathsf{totalDeferredOutput}(\mathsf{height}) := \sum_{\mathsf{fs} \in \mathsf{DeferredFundingStreams}(\mathsf{height})} \mathsf{fs.Value}(\mathsf{height})\) where \(\mathsf{DeferredFundingStreams}(\mathsf{height})\) is the set of funding streams with recipient identifier \(\mathsf{DEFERRED}\_\mathsf{POOL}\) in the block at height \(\mathsf{height}\) .

The \(\mathsf{ChainValuePoolBalance^{Deferred}}\) chain value pool balance for a given block chain is the sum of the values of payments to \(\mathsf{DEFERRED}\_\mathsf{POOL}\) for transactions in the block chain.

Equivalently, \(\mathsf{ChainValuePoolBalance^{Deferred}}\) for a block chain up to and including height \(\mathsf{height}\) is given by \(\sum_{\mathsf{h} = 0}^{\mathsf{height}} \mathsf{totalDeferredOutput}(\mathsf{h})\) .

Note: \(\mathsf{totalDeferredOutput}(\mathsf{h})\) is necessarily zero for heights \(\mathsf{h}\) prior to NU6 activation.

Consensus rules

Prior to activation of the Canopy network upgrade, the existing consensus rule for payment of the original Founders' Reward is enforced. 10

Once the Canopy network upgrade activates:

  • The existing consensus rule for payment of the Founders' Reward 10 is no longer active. (This would be the case under the preexisting consensus rules for Mainnet, but not for Testnet.)
  • In each block with coinbase transaction \(\mathsf{cb}\) at block height \(\mathsf{height}\) , for each funding stream \(\mathsf{fs}\) active at that block height with a recipient identifier other than \(\mathsf{DEFERRED}\_\mathsf{POOL}\) given by \(\mathsf{fs.Recipient}(\mathsf{height})\!\) , \(\mathsf{cb}\) MUST contain at least one output that pays \(\mathsf{fs.Value}(\mathsf{height})\) zatoshi in the prescribed way to the address represented by that recipient identifier.
  • \(\mathsf{fs.Recipient}(\mathsf{height})\) is defined as \(\mathsf{fs.Recipients_{\,\fs.RecipientIndex}}(\mathsf{height})\!\) .
  • The "prescribed way" to pay a transparent P2SH address is to use a standard P2SH script of the form OP_HASH160 RedeemScriptHash(height) OP_EQUAL as the scriptPubKey.
  • The "prescribed way" to pay a Sapling address is as defined in 16. That is, all Sapling outputs in coinbase transactions (including, but not limited to, outputs for funding streams) MUST have valid note commitments when recovered using a 32-byte array of zeroes as the outgoing viewing key. In this case the note plaintext lead byte MUST be \(\mathbf{0x02}\!\) , as specified in 15.

These rules are reproduced in [#protocol-fundingstreams].

The effect of the definition of \(\mathsf{ChainValuePoolBalance^{Deferred}}\) above is that payments to the \(\mathsf{DEFERRED}\_\mathsf{POOL}\) cause \(\mathsf{FundingStream[FUND].Value}(\mathsf{height})\) to be added to \(\mathsf{ChainValuePoolBalance^{Deferred}}\) for the block chain including that block.

For the funding stream definitions to be activated at Canopy and at NU6, see ZIP 214. 17 Funding stream definitions can be added, changed, or deleted in ZIPs associated with subsequent network upgrades, subject to the ZIP process. 12

Deployment

This proposal was initially deployed with Canopy. 18

Changes to support deferred funding streams are to be deployed with NU6. 19

Backward compatibility

This proposal intentionally creates what is known as a "bilateral consensus rule change". Use of this mechanism requires that all network participants upgrade their software to a compatible version within the upgrade window. Older software will treat post-upgrade blocks as invalid, and will follow any pre-upgrade consensus branch that persists.

Reference Implementation

References

1 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" <https://www.rfc-editor.org/info/bcp14>
2 Zcash Protocol Specification, Version 2024.5.1 or later <protocol/protocol.pdf>
3 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 3.10: Block Subsidy and Founders' Reward <protocol/protocol.pdf#subsidyconcepts>
4 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 3.12: Mainnet and Testnet <protocol/protocol.pdf#networks>
5 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 5.3: Constants <protocol/protocol.pdf#constants>
6 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 5.6.1.1: Transparent Addresses <protocol/protocol.pdf#transparentaddrencoding>
7 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 5.6.3.1: Sapling Payment Addresses <protocol/protocol.pdf#saplingpaymentaddrencoding>
8 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.7.3: Difficulty adjustment <protocol/protocol.pdf#diffadjustment>
9 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.8: Calculation of Block Subsidy, Funding Streams, and Founders' Reward <protocol/protocol.pdf#subsidies>
10 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.9: Payment of Founders' Reward <protocol/protocol.pdf#foundersreward>
11 Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.10: Payment of Funding Streams <protocol/protocol.pdf#fundingstreams>
12 ZIP 0: ZIP Process <zip-0000.rst>
13 ZIP 200: Network Upgrade Mechanism <zip-0200.rst>
14 ZIP 208: Shorter Block Target Spacing <zip-0208.rst>
15 ZIP 212: Allow Recipient to Derive Sapling Ephemeral Secret from Note Plaintext <zip-0212.rst>
16 ZIP 213: Shielded Coinbase <zip-0213.rst>
17 ZIP 214: Consensus rules for a Zcash Development Fund <zip-0214.rst>
18 ZIP 251: Deployment of the Canopy Network Upgrade <zip-0251.rst>
19 ZIP 253: Deployment of the NU6 Network Upgrade <zip-0253.rst>
20 ZIP 1014: Establishing a Dev Fund for ECC, ZF, and Major Grants <zip-1014.rst>
21 ZIP 1015: Block Reward Allocation for Non-Direct Development Funding <zip-1015.rst>
22 ZIP 2001: Lockbox Funding Streams <zip-2001.rst>