1use chia_consensus::consensus_constants::ConsensusConstants;
21use chia_protocol::Bytes32;
22use hex_literal::hex;
23
24#[derive(Debug, Clone)]
31pub struct NetworkConstants {
32 inner: ConsensusConstants,
33}
34
35impl NetworkConstants {
36 pub fn consensus(&self) -> &ConsensusConstants {
39 &self.inner
40 }
41
42 pub fn genesis_challenge(&self) -> Bytes32 {
44 self.inner.genesis_challenge
45 }
46
47 pub fn agg_sig_me_additional_data(&self) -> Bytes32 {
49 self.inner.agg_sig_me_additional_data
50 }
51
52 pub fn max_block_cost_clvm(&self) -> u64 {
54 self.inner.max_block_cost_clvm
55 }
56
57 pub fn cost_per_byte(&self) -> u64 {
59 self.inner.cost_per_byte
60 }
61
62 pub fn max_coin_amount(&self) -> u64 {
64 self.inner.max_coin_amount
65 }
66}
67
68const DIG_MAINNET_GENESIS_CHALLENGE: [u8; 32] =
92 hex!("0000000000000000000000000000000000000000000000000000000000000000");
93
94pub const DIG_MAINNET: NetworkConstants = NetworkConstants {
100 inner: ConsensusConstants {
101 genesis_challenge: Bytes32::new(DIG_MAINNET_GENESIS_CHALLENGE),
103
104 agg_sig_me_additional_data: Bytes32::new(DIG_MAINNET_GENESIS_CHALLENGE),
113 agg_sig_parent_additional_data: Bytes32::new(hex!(
114 "978722459e638504a3c4ed25b0eae952f1cba668de5a44ccbb3b311eb6901218"
115 )),
116 agg_sig_puzzle_additional_data: Bytes32::new(hex!(
117 "b5b75cf3f16babd124b3c36ac239db038cf9384b6f4343ab65121e7994fa87e4"
118 )),
119 agg_sig_amount_additional_data: Bytes32::new(hex!(
120 "568b7e86b93e78c4a70a90902134266d5f666400d449c827c32422c14a8df42a"
121 )),
122 agg_sig_puzzle_amount_additional_data: Bytes32::new(hex!(
123 "73f82ca7a07025c76c91a3faf2e574ffa13759597fc5d9a0573b4df70245de2e"
124 )),
125 agg_sig_parent_amount_additional_data: Bytes32::new(hex!(
126 "3a2914bb834c69f745c1932450bad277f975b3e1b246d003e3a53e550cf74936"
127 )),
128 agg_sig_parent_puzzle_additional_data: Bytes32::new(hex!(
129 "4f59298d607f3143532ed694fb2f10454a684c1a29ef83e250bf5e234c6720b7"
130 )),
131
132 max_block_cost_clvm: 11_000_000_000, cost_per_byte: 12_000,
135 max_coin_amount: u64::MAX,
136
137 max_generator_size: 1_000_000,
139 max_generator_ref_list_size: 512,
140
141 hard_fork_height: 0,
144 hard_fork2_height: 0,
145
146 genesis_pre_farm_pool_puzzle_hash: Bytes32::new([0u8; 32]),
148 genesis_pre_farm_farmer_puzzle_hash: Bytes32::new([0u8; 32]),
149
150 slot_blocks_target: 32,
154 min_blocks_per_challenge_block: 16,
155 max_sub_slot_blocks: 128,
156 num_sps_sub_slot: 64,
157 sub_slot_iters_starting: 1 << 27,
158 difficulty_constant_factor: 1 << 67,
159 difficulty_starting: 7,
160 difficulty_change_max_factor: 3,
161 sub_epoch_blocks: 384,
162 epoch_blocks: 4608,
163 significant_bits: 8,
164 discriminant_size_bits: 1024,
165 number_zero_bits_plot_filter_v1: 9,
166 number_zero_bits_plot_filter_v2: 9,
167 min_plot_size_v1: 32,
168 max_plot_size_v1: 50,
169 min_plot_size_v2: 28,
170 max_plot_size_v2: 32,
171 sub_slot_time_target: 600,
172 num_sp_intervals_extra: 3,
173 max_future_time2: 120,
174 number_of_timestamps: 11,
175 max_vdf_witness_size: 64,
176 mempool_block_buffer: 10,
177 weight_proof_threshold: 2,
178 blocks_cache_size: 4608 + (128 * 4),
179 weight_proof_recent_blocks: 1000,
180 max_block_count_per_requests: 32,
181 pool_sub_slot_iters: 37_600_000_000,
182 plot_filter_128_height: 0xffff_ffff,
183 plot_filter_64_height: 0xffff_ffff,
184 plot_filter_32_height: 0xffff_ffff,
185 plot_difficulty_initial: 2,
186 plot_difficulty_4_height: 0xffff_ffff,
187 plot_difficulty_5_height: 0xffff_ffff,
188 plot_difficulty_6_height: 0xffff_ffff,
189 plot_difficulty_7_height: 0xffff_ffff,
190 plot_difficulty_8_height: 0xffff_ffff,
191 },
192};
193
194const DIG_TESTNET_GENESIS_CHALLENGE: [u8; 32] =
200 hex!("0000000000000000000000000000000000000000000000000000000000000001");
201
202pub const DIG_TESTNET: NetworkConstants = NetworkConstants {
207 inner: ConsensusConstants {
208 genesis_challenge: Bytes32::new(DIG_TESTNET_GENESIS_CHALLENGE),
209 agg_sig_me_additional_data: Bytes32::new(DIG_TESTNET_GENESIS_CHALLENGE),
211 agg_sig_parent_additional_data: Bytes32::new(hex!(
212 "6ae3f62deccdc8d56baf955e45dad1d40332a7b8e4afbb38f07719a863658054"
213 )),
214 agg_sig_puzzle_additional_data: Bytes32::new(hex!(
215 "5d962189ce65d3b3799f032add1ab29ef94ebc0e349fe1db231752304cdd6904"
216 )),
217 agg_sig_amount_additional_data: Bytes32::new(hex!(
218 "3724d66f2da5614aa650517a2feb7d681807d5107441c9c72579e9a751b82d67"
219 )),
220 agg_sig_puzzle_amount_additional_data: Bytes32::new(hex!(
221 "fb6a54a5b51e9734a6ff72fe4105cd5db891d4dbaef9361586091f0d4486581b"
222 )),
223 agg_sig_parent_amount_additional_data: Bytes32::new(hex!(
224 "a5556086f1b58dfd5966bf1aac5257c7f60774ffe5a9e219919c56640993f68b"
225 )),
226 agg_sig_parent_puzzle_additional_data: Bytes32::new(hex!(
227 "3fcc94e67cf3975473b065f0b21a4e92dd3df498d8b4464d7da9582669ac4e48"
228 )),
229 max_block_cost_clvm: 11_000_000_000,
231 cost_per_byte: 12_000,
232 max_coin_amount: u64::MAX,
233 max_generator_size: 1_000_000,
234 max_generator_ref_list_size: 512,
235 hard_fork_height: 0,
236 hard_fork2_height: 0,
237 genesis_pre_farm_pool_puzzle_hash: Bytes32::new([0u8; 32]),
238 genesis_pre_farm_farmer_puzzle_hash: Bytes32::new([0u8; 32]),
239 slot_blocks_target: 32,
240 min_blocks_per_challenge_block: 16,
241 max_sub_slot_blocks: 128,
242 num_sps_sub_slot: 64,
243 sub_slot_iters_starting: 1 << 27,
244 difficulty_constant_factor: 1 << 67,
245 difficulty_starting: 7,
246 difficulty_change_max_factor: 3,
247 sub_epoch_blocks: 384,
248 epoch_blocks: 4608,
249 significant_bits: 8,
250 discriminant_size_bits: 1024,
251 number_zero_bits_plot_filter_v1: 9,
252 number_zero_bits_plot_filter_v2: 9,
253 min_plot_size_v1: 32,
254 max_plot_size_v1: 50,
255 min_plot_size_v2: 28,
256 max_plot_size_v2: 32,
257 sub_slot_time_target: 600,
258 num_sp_intervals_extra: 3,
259 max_future_time2: 120,
260 number_of_timestamps: 11,
261 max_vdf_witness_size: 64,
262 mempool_block_buffer: 10,
263 weight_proof_threshold: 2,
264 blocks_cache_size: 4608 + (128 * 4),
265 weight_proof_recent_blocks: 1000,
266 max_block_count_per_requests: 32,
267 pool_sub_slot_iters: 37_600_000_000,
268 plot_filter_128_height: 0xffff_ffff,
269 plot_filter_64_height: 0xffff_ffff,
270 plot_filter_32_height: 0xffff_ffff,
271 plot_difficulty_initial: 2,
272 plot_difficulty_4_height: 0xffff_ffff,
273 plot_difficulty_5_height: 0xffff_ffff,
274 plot_difficulty_6_height: 0xffff_ffff,
275 plot_difficulty_7_height: 0xffff_ffff,
276 plot_difficulty_8_height: 0xffff_ffff,
277 },
278};