zebra_chain/parameters/
constants.rs

1//! Definitions of Zebra chain constants, including:
2//! - slow start interval,
3//! - slow start shift
4
5use crate::block::Height;
6
7/// An initial period from Genesis to this Height where the block subsidy is gradually incremented. [What is slow-start mining][slow-mining]
8///
9/// [slow-mining]: https://z.cash/support/faq/#what-is-slow-start-mining
10pub const SLOW_START_INTERVAL: Height = Height(20_000);
11
12/// `SlowStartShift()` as described in [protocol specification ยง7.8][7.8]
13///
14/// [7.8]: https://zips.z.cash/protocol/protocol.pdf#subsidies
15///
16/// This calculation is exact, because `SLOW_START_INTERVAL` is divisible by 2.
17pub const SLOW_START_SHIFT: Height = Height(SLOW_START_INTERVAL.0 / 2);
18
19/// Magic numbers used to identify different Zcash networks.
20pub mod magics {
21    use crate::parameters::network::magic::Magic;
22
23    /// The production mainnet.
24    pub const MAINNET: Magic = Magic([0x24, 0xe9, 0x27, 0x64]);
25    /// The testnet.
26    pub const TESTNET: Magic = Magic([0xfa, 0x1a, 0xf9, 0xbf]);
27    /// The regtest, see <https://github.com/zcash/zcash/blob/master/src/chainparams.cpp#L716-L719>
28    pub const REGTEST: Magic = Magic([0xaa, 0xe8, 0x3f, 0x5f]);
29}
30
31/// The block heights at which network upgrades activate.
32pub mod activation_heights {
33    /// Network upgrade activation heights for Testnet.
34    pub mod testnet {
35        use crate::block::Height;
36
37        /// The block height at which `BeforeOverwinter` activates on Testnet.
38        pub const BEFORE_OVERWINTER: Height = Height(1);
39        /// The block height at which `Overwinter` activates on Testnet.
40        pub const OVERWINTER: Height = Height(207_500);
41        /// The block height at which `Sapling` activates on Testnet.
42        pub const SAPLING: Height = Height(280_000);
43        /// The block height at which `Blossom` activates on Testnet.
44        pub const BLOSSOM: Height = Height(584_000);
45        /// The block height at which `Heartwood` activates on Testnet.
46        pub const HEARTWOOD: Height = Height(903_800);
47        /// The block height at which `Canopy` activates on Testnet.
48        pub const CANOPY: Height = Height(1_028_500);
49        /// The block height at which `NU5` activates on Testnet.
50        pub const NU5: Height = Height(1_842_420);
51        /// The block height at which `NU6` activates on Testnet.
52        pub const NU6: Height = Height(2_976_000);
53        /// The block height at which `NU6.1` activates on Testnet.
54        pub const NU6_1: Height = Height(3_536_500);
55    }
56
57    /// Network upgrade activation heights for Mainnet.
58    pub mod mainnet {
59        use crate::block::Height;
60
61        /// The block height at which `BeforeOverwinter` activates on Mainnet.
62        pub const BEFORE_OVERWINTER: Height = Height(1);
63        /// The block height at which `Overwinter` activates on Mainnet.
64        pub const OVERWINTER: Height = Height(347_500);
65        /// The block height at which `Sapling` activates on Mainnet.
66        pub const SAPLING: Height = Height(419_200);
67        /// The block height at which `Blossom` activates on Mainnet.
68        pub const BLOSSOM: Height = Height(653_600);
69        /// The block height at which `Heartwood` activates on Mainnet.
70        pub const HEARTWOOD: Height = Height(903_000);
71        /// The block height at which `Canopy` activates on Mainnet.
72        pub const CANOPY: Height = Height(1_046_400);
73        /// The block height at which `NU5` activates on Mainnet.
74        pub const NU5: Height = Height(1_687_104);
75        /// The block height at which `NU6` activates on Mainnet.
76        pub const NU6: Height = Height(2_726_400);
77        /// The block height at which `NU6.1` activates on Mainnet.
78        pub const NU6_1: Height = Height(3_146_400);
79    }
80}