zebra_chain/parameters/network/subsidy/constants.rs
1//! Constants for block subsidies.
2
3pub(crate) mod mainnet;
4pub(crate) mod regtest;
5pub(crate) mod testnet;
6
7use crate::amount::COIN;
8use crate::block::HeightDiff;
9
10/// The largest block subsidy, used before the first halving.
11///
12/// We use `25 / 2` instead of `12.5`, so that we can calculate the correct value without using floating-point.
13/// This calculation is exact, because COIN is divisible by 2, and the division is done last.
14pub(crate) const MAX_BLOCK_SUBSIDY: u64 = ((25 * COIN) / 2) as u64;
15
16/// Used as a multiplier to get the new halving interval after Blossom.
17///
18/// Calculated as `PRE_BLOSSOM_POW_TARGET_SPACING / POST_BLOSSOM_POW_TARGET_SPACING`
19/// in the Zcash specification.
20pub(crate) const BLOSSOM_POW_TARGET_SPACING_RATIO: u32 = 2;
21
22/// Halving is at about every 4 years, before Blossom block time is 150 seconds.
23///
24/// `(60 * 60 * 24 * 365 * 4) / 150 = 840960`
25pub(crate) const PRE_BLOSSOM_HALVING_INTERVAL: HeightDiff = 840_000;
26
27/// After Blossom the block time is reduced to 75 seconds but halving period should remain around 4 years.
28pub(crate) const POST_BLOSSOM_HALVING_INTERVAL: HeightDiff =
29 PRE_BLOSSOM_HALVING_INTERVAL * (BLOSSOM_POW_TARGET_SPACING_RATIO as HeightDiff);
30
31/// Denominator as described in [protocol specification ยง7.10.1][7.10.1].
32///
33/// [7.10.1]: https://zips.z.cash/protocol/protocol.pdf#zip214fundingstreams
34pub(crate) const FUNDING_STREAM_RECEIVER_DENOMINATOR: u64 = 100;
35
36/// The specification for pre-NU6 funding stream receivers, a URL that links to [ZIP-214].
37///
38/// [ZIP-214]: https://zips.z.cash/zip-0214
39pub(crate) const FUNDING_STREAM_SPECIFICATION: &str = "https://zips.z.cash/zip-0214";
40
41/// The specification for post-NU6 funding stream and lockbox receivers, a URL that links to [ZIP-1015].
42///
43/// [ZIP-1015]: https://zips.z.cash/zip-1015
44pub(crate) const LOCKBOX_SPECIFICATION: &str = "https://zips.z.cash/zip-1015";
45
46/// The number of blocks contained in the post-NU6 funding streams height ranges on Mainnet or Testnet, as specified
47/// in [ZIP-1015](https://zips.z.cash/zip-1015).
48pub(crate) const POST_NU6_FUNDING_STREAM_NUM_BLOCKS: u32 = 420_000;