zcash_protocol/
constants.rs

1//! Network-specific Zcash constants.
2
3pub mod mainnet;
4pub mod regtest;
5pub mod testnet;
6
7// The `V<n>_TX_VERSION` constants, although trivial, serve to clarify that a
8// transaction version is meant in APIs that use a bare `u32`. Consider using
9// `zcash_primitives::transaction::TxVersion` instead.
10
11/// Transaction version 3, which was introduced by the Overwinter network upgrade
12/// and allowed until Sapling activation. It is specified in
13/// [§ 7.1 Transaction Encoding and Consensus](https://zips.z.cash/protocol/protocol.pdf#txnencoding).
14///
15/// This constant is called `OVERWINTER_TX_VERSION` in the zcashd source.
16pub const V3_TX_VERSION: u32 = 3;
17/// The version group ID for Zcash v3 transactions.
18///
19/// This constant is called `OVERWINTER_VERSION_GROUP_ID` in the zcashd source.
20pub const V3_VERSION_GROUP_ID: u32 = 0x03C48270;
21
22/// Transaction version 4, which was introduced by the Sapling network upgrade.
23/// It is specified in [§ 7.1 Transaction Encoding and Consensus](https://zips.z.cash/protocol/protocol.pdf#txnencoding).
24///
25/// This constant is called `SAPLING_TX_VERSION` in the zcashd source.
26pub const V4_TX_VERSION: u32 = 4;
27/// The version group ID for Zcash v4 transactions.
28///
29/// This constant is called `SAPLING_VERSION_GROUP_ID` in the zcashd source.
30pub const V4_VERSION_GROUP_ID: u32 = 0x892F2085;
31
32/// Transaction version 5, which was introduced by the NU5 network upgrade.
33/// It is specified in [§ 7.1 Transaction Encoding and Consensus](https://zips.z.cash/protocol/protocol.pdf#txnencoding)
34/// and [ZIP 225](https://zips.z.cash/zip-0225).
35pub const V5_TX_VERSION: u32 = 5;
36/// The version group ID for Zcash v5 transactions.
37pub const V5_VERSION_GROUP_ID: u32 = 0x26A7270A;
38
39/// Transaction version 6, specified in [ZIP 230](https://zips.z.cash/zip-0230).
40#[cfg(zcash_unstable = "nu7")]
41pub const V6_TX_VERSION: u32 = 6;
42/// The version group ID for Zcash v6 transactions.
43#[cfg(zcash_unstable = "nu7")]
44pub const V6_VERSION_GROUP_ID: u32 = 0xFFFFFFFF;
45
46/// This version is used exclusively for in-development transaction
47/// serialization, and will never be active under the consensus rules.
48/// When new consensus transaction versions are added, all call sites
49/// using this constant should be inspected, and uses should be
50/// removed as appropriate in favor of the new transaction version.
51#[cfg(zcash_unstable = "zfuture")]
52pub const ZFUTURE_TX_VERSION: u32 = 0x0000FFFF;
53/// This version group ID is used exclusively for in-development transaction
54/// serialization, and will never be active under the consensus rules.
55/// When new consensus version group IDs are added, all call sites
56/// using this constant should be inspected, and uses should be
57/// removed as appropriate in favor of the new version group ID.
58#[cfg(zcash_unstable = "zfuture")]
59pub const ZFUTURE_VERSION_GROUP_ID: u32 = 0xFFFFFFFF;