::

  ZIP: 2001
  Title: Lockbox Funding Streams
  Owners: Kris Nuttycombe <kris@nutty.land>
  Credits: Daira-Emma Hopwood
           Jack Grigg
  Status: Final
  Category: Consensus
  Created: 2024-07-02
  License: MIT
  Pull-Request: <https://github.com/zcash/zips/pull/>


Terminology
===========

The key words "MUST" and "MUST NOT" in this document are to be interpreted as
described in BCP 14 [#BCP14]_ when, and only when, they appear in all capitals.


Abstract
========

This ZIP specifies a change to the Zcash consensus protocol to define a pool
of issued Zcash value to be used to fund future development efforts within the
Zcash ecosystem.

This ZIP builds upon the funding stream mechanism defined in ZIP 207
[#zip-0207]_. It defines a new "DEFERRED_POOL" funding stream type such that
portions of the block reward sent to a stream of this type are deposited
directly into the deferred funding pool instead of being sent to a recipient
address. Other ways of adding to the pool, such as allowing for direct deposits
or fee value currently allocated to miners may be defined in the future.


Motivation
==========

In accordance with ZIP 1014, [#zip-1014]_ the Zcash block reward is allocated
with 80% going to miners, and the remaining 20% distributed among the Major
Grants Fund (8%), Electric Coin Company (ECC) (7%), and the Zcash Foundation
(ZF) (5%). This funding structure supports various essential activities such as
protocol development, security, marketing, and legal expenses. However, this
model will expire in November 2024, leading to the entire block reward being
allocated to miners if no changes are made.

Several draft ZIPs under consideration for replacing the existing direct
allocation of block rewards suggest that part of the block reward be directed
to a reserve, the distribution of which is to be determined via a future ZIP.
This ZIP is intended to provide a common mechanism that can be used to
implement these various proposals.


Requirements
============

The Zcash protocol will maintain a new Deferred chain pool value balance
$\mathsf{ChainValuePoolBalance^{Deferred}}$ for the deferred funding pool,
in much the same fashion as it maintains chain pool value balances for the
transparent, Sprout, Sapling, and Orchard pools.

The funding stream mechanism defined in ZIP 207 [#zip-0207]_ is modified such
that a funding stream may deposit funds into the deferred pool.


Specification
=============

Changes to ZIP 207 [#zip-0207]_
-------------------------------

The following paragraph is added to the section **Motivation**:

    As of NU6, ZIP 1015 [#zip-1015]_ directs part of the block reward to a reserve,
    the distribution of which is to be determined via a future ZIP.
    ZIP 2001 [#zip-2001]_ modified the present ZIP to augment the funding stream
    mechanism with a common mechanism to implement this proposal.

In the section **Funding streams** [#zip-0207-funding-streams]_, instead of:

    Each funding stream has an associated sequence of recipient addresses,
    each of which MUST be either a transparent P2SH address or a Sapling address.

it will be modified to read:

    Each element of $\mathsf{fs.Recipients}$ MUST represent either a transparent
    P2SH address as specified in [#protocol-transparentaddrencoding]_, or a Sapling
    shielded payment address as specified in [#protocol-saplingpaymentaddrencoding]_,
    or the identifier $\mathsf{DEFERRED\_POOL}$.

After the section **Funding streams**, a new section is added with the heading
"Deferred Development Fund Chain Value Pool Balance" and the following contents:

    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\_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\_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.

In the section **Consensus rules** [#zip-0207-consensus-rules]_, instead of:

    - The coinbase transaction in each block MUST contain at least one output per
      active funding stream that pays the stream's value in the prescribed way to
      the stream's recipient address for the block's height.

it will be modified to read:

    - 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\_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})$.

After the list of post-Canopy consensus rules, the following paragraphs are added:

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

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

In the section **Deployment** [#zip-0207-deployment]_, the following sentence is
added:

    Changes to support deferred funding streams are to be deployed with NU6. [#zip-0253]_

Changes to the Zcash Protocol Specification
-------------------------------------------

In section **4.17 Chain Value Pool Balances** [#protocol-chainvaluepoolbalances]_
(which is new in version 2024.5.1 of the protocol specification), include the following:

    Define $\mathsf{totalDeferredOutput}$ as in [#protocol-subsidies]_.

    Then, consistent with [#zip-0207]_, the deferred development fund chain value pool
    balance for a block chain up to and including height $\mathsf{height}$ is given by
    $\mathsf{ChainValuePoolBalance^{Deferred}}(\mathsf{height}) := \sum_{\mathsf{h} = 0}^{\mathsf{height}} \mathsf{totalDeferredOutput}(\mathsf{h})$.

    Non-normative notes:

    * $\mathsf{totalDeferredOutput}(\mathsf{h})$ is necessarily zero for heights
      $\mathsf{h}$ prior to NU6 activation.
    * Currently there is no way to withdraw from the deferred development fund chain value
      pool, so there is no possibility of it going negative. Therefore, no consensus rule
      to prevent that eventuality is needed at this time.

    The *total issued supply* of a block chain at block height $\mathsf{height}$
    is given by the function:

    .. math::

      \begin{array}{ll}
        \mathsf{IssuedSupply}(\mathsf{height}) := &\!\!\!\!\mathsf{ChainValuePoolBalance^{Transparent}}(\mathsf{height}) \\
        &+\,\; \mathsf{ChainValuePoolBalance^{Sprout}}(\mathsf{height}) \\
        &+\,\; \mathsf{ChainValuePoolBalance^{Sapling}}(\mathsf{height}) \\
        &+\,\; \mathsf{ChainValuePoolBalance^{Orchard}}(\mathsf{height}) \\
        &+\,\; \mathsf{ChainValuePoolBalance^{Deferred}}(\mathsf{height})
      \end{array}

In section **7.1.2 Transaction Consensus Rules** [#protocol-txnconsensus]_, instead of:

    The total value in zatoshi of transparent outputs from a coinbase transaction,
    minus $\mathsf{v^{balanceSapling}}$, minus $\mathsf{v^{balanceOrchard}}$,
    MUST NOT be greater than the value in zatoshi of the block subsidy plus the transaction
    fees paid by transactions in this block.

it will be modified to read:

    For the block at block height $\mathsf{height}$:

    - define the "total output value" of its coinbase transaction to be the total value
      in zatoshi of its transparent outputs, minus $\mathsf{v^{balanceSapling}}$,
      minus $\mathsf{v^{balanceOrchard}}$, plus $\mathsf{totalDeferredOutput}(\mathsf{height})$;
    - define the "total input value" of its coinbase transaction to be the value in zatoshi
      of the block subsidy, plus the transaction fees paid by transactions in the block.

    The total output value of a coinbase transaction MUST NOT be greater than its
    total input value.

where $\mathsf{totalDeferredOutput}(\mathsf{height})$ is defined consistently
with ZIP 207.

Note: this ZIP and ZIP 236 both make changes to the above rule. Their combined effect
is that the last paragraph will be replaced by:

    [Pre-NU6] The total output value of a coinbase transaction MUST NOT be greater
    than its total input value.

    [NU6 onward] The total output value of a coinbase transaction MUST be equal to
    its total input value.

Section **7.10 Payment of Funding Streams** [#protocol-fundingstreams]_ contains
language and definitions copied from ZIP 207; it should be updated to reflect the
changes made above.

The second paragraph of section **1.2 High-level Overview** [#protocol-overview]_
should be updated to take into account the deferred chain value pool. Since that
section of the specification is entirely non-normative, we do not give the full
wording change here.


References
==========

.. [#BCP14] `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>`_
.. [#protocol-overview] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 1.2: High-level Overview <protocol/protocol.pdf#overview>`_
.. [#protocol-transactions] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 3.4: Transactions and Treestates <protocol/protocol.pdf#transactions>`_
.. [#protocol-coinbasetransactions] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 3.11: Coinbase Transactions and Issuance <protocol/protocol.pdf#coinbasetransactions>`_
.. [#protocol-chainvaluepoolbalances] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 4.17: Chain Value Pool Balances <protocol/protocol.pdf#chainvaluepoolbalances>`_
.. [#protocol-transparentaddrencoding] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 5.6.1.1: Transparent Addresses <protocol/protocol.pdf#transparentaddrencoding>`_
.. [#protocol-saplingpaymentaddrencoding] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 5.6.3.1: Sapling Payment Addresses <protocol/protocol.pdf#saplingpaymentaddrencoding>`_
.. [#protocol-txnconsensus] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.1.2: Transaction Consensus Rules <protocol/protocol.pdf#txnconsensus>`_
.. [#protocol-subsidies] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.8: Calculation of Block Subsidy, Funding Streams, and Founders’ Reward <protocol/protocol.pdf#subsidies>`_
.. [#protocol-fundingstreams] `Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.10: Payment of Funding Streams <protocol/protocol.pdf#fundingstreams>`_
.. [#zip-0207] `ZIP 207: Funding Streams <zip-0207.rst>`_
.. [#zip-0207-funding-streams] `ZIP 207: Funding Streams. Section: Funding streams <zip-0207.rst#funding-streams>`_
.. [#zip-0207-consensus-rules] `ZIP 207: Funding Streams. Section: Consensus rules <zip-0207.rst#consensus-rules>`_
.. [#zip-0207-deployment] `ZIP 207: Funding Streams. Section: Deployment <zip-0207.rst#deployment>`_
.. [#zip-0253] `ZIP 253: Deployment of the NU6 Network Upgrade <zip-0253.rst>`_
.. [#zip-1014] `ZIP 1014: Establishing a Dev Fund for ECC, ZF, and Major Grants <zip-1014.rst>`_
.. [#zip-1015] `ZIP 1015: Block Reward Allocation for Non-Direct Development Funding <zip-1015.rst>`_
.. [#zip-2001] `ZIP 2001: Lockbox Funding Streams <zip-2001.rst>`_
