Repository navigation
Expand file tree
/
Copy pathchain_spec.rs
More file actions
146 lines (132 loc) · 5.12 KB
/
Copy pathchain_spec.rs
File metadata and controls
146 lines (132 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
use quantus_runtime::{
genesis_config_presets::{
HEISENBERG_RUNTIME_PRESET, MAINNET_RUNTIME_PRESET, PLANCK_RUNTIME_PRESET,
},
WASM_BINARY,
};
use sc_service::{ChainType, Properties};
use sc_telemetry::TelemetryEndpoints;
use serde_json::json;
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec;
pub fn development_chain_spec() -> Result<ChainSpec, String> {
let mut properties = Properties::new();
properties.insert("tokenDecimals".into(), json!(12));
properties.insert("tokenSymbol".into(), json!("DEV"));
properties.insert("ss58Format".into(), json!(189));
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Quantus DevNet wasm not available".to_string())?,
None,
)
.with_name("Quantus DevNet")
.with_id("dev")
.with_protocol_id("quantus-devnet")
.with_chain_type(ChainType::Development)
.with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET)
.with_properties(properties)
.build())
}
/// Heisenberg — internal integration testnet, **not** mainnet.
///
/// Genesis intentionally endows the well-known Dilithium accounts
/// (`crystal_alice` / `dilithium_bob` / `crystal_charlie`, seeds `[0]/` /
/// `[1]` / `[2]`) and uses them as treasury signers and tech-collective
/// members. Those private keys are public by design so integrators and CI can
/// exercise governance, treasury, and transfer flows without distributing
/// secrets. Tokens have no monetary value; the network may be reset. Do not
/// treat Heisenberg key material, balances, or authority as production-grade.
pub fn heisenberg_chain_spec() -> Result<ChainSpec, String> {
let mut properties = Properties::new();
properties.insert("tokenDecimals".into(), json!(12));
properties.insert("tokenSymbol".into(), json!("HEI"));
properties.insert("ss58Format".into(), json!(189));
let telemetry_endpoints = TelemetryEndpoints::new(vec![(
"/dns/shard-telemetry.quantus.cat/tcp/443/x-parity-wss/%2Fsubmit%2F".to_string(),
0,
)])
.expect("Telemetry endpoints config is valid; qed");
let boot_nodes = vec![
"/dns/a1-p2p-heisenberg.quantus.cat/tcp/30333/p2p/Qmdts9fu3NCMFnvLdD1dHAHFer8EPzVDXxVnyPxRKA3Gkt"
.parse()
.unwrap(),
"/dns/a2-p2p-heisenberg.quantus.cat/tcp/30333/p2p/QmcKHndoiNRdiT6iVp6ugj8bNse5Vd5WmCoE9YWn9kNaTM"
.parse()
.unwrap(),
];
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Runtime wasm not available".to_string())?,
None,
)
.with_name("Heisenberg")
.with_id("heisenberg")
.with_protocol_id("heisenberg")
.with_boot_nodes(boot_nodes)
.with_telemetry_endpoints(telemetry_endpoints)
.with_chain_type(ChainType::Live)
.with_genesis_config_preset_name(HEISENBERG_RUNTIME_PRESET)
.with_properties(properties)
.build())
}
/// Mainnet. Genesis comes from the `mainnet` runtime preset; the allocation
/// table is `runtime/src/genesis_config_presets/mainnet_vesting.rs`. Spec
/// building panics until that table is finalized. Bootnodes are added once
/// infrastructure exists (`bootNodes` is outside genesis).
pub fn mainnet_chain_spec() -> Result<ChainSpec, String> {
let mut properties = Properties::new();
properties.insert("tokenDecimals".into(), json!(12));
properties.insert("tokenSymbol".into(), json!("QTC"));
properties.insert("ss58Format".into(), json!(189));
let telemetry_endpoints = TelemetryEndpoints::new(vec![(
"/dns/shard-telemetry.quantus.cat/tcp/443/x-parity-wss/%2Fsubmit%2F".to_string(),
0,
)])
.expect("Telemetry endpoints config is valid; qed");
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Runtime wasm not available".to_string())?,
None,
)
.with_name("Quantus")
.with_id("mainnet")
.with_protocol_id("quantus")
.with_telemetry_endpoints(telemetry_endpoints)
.with_chain_type(ChainType::Live)
.with_genesis_config_preset_name(MAINNET_RUNTIME_PRESET)
.with_properties(properties)
.build())
}
/// Planck network — live treasury signers + faucet; dev dilithium accounts for testing.
pub fn planck_chain_spec() -> Result<ChainSpec, String> {
let mut properties = Properties::new();
properties.insert("tokenDecimals".into(), json!(12));
properties.insert("tokenSymbol".into(), json!("PLK"));
properties.insert("ss58Format".into(), json!(189));
let telemetry_endpoints = TelemetryEndpoints::new(vec![(
"/dns/shard-telemetry.quantus.cat/tcp/443/x-parity-wss/%2Fsubmit%2F".to_string(),
0,
)])
.expect("Telemetry endpoints config is valid; qed");
let boot_nodes = vec![
"/dns/a1-p2p-planck.quantus.cat/tcp/30333/p2p/QmQ4AywkRZuv2L4XKb71Y3erk2DpQPNUTmMS2LGEEr5q8r"
.parse()
.unwrap(),
"/dns/a2-p2p-planck.quantus.cat/tcp/30333/p2p/QmZT5LVJjBWf3QeJY6JKcFY6bCJoWucji96pKwpgbfTgic"
.parse()
.unwrap(),
"/ip4/72.61.118.55/tcp/30333/p2p/QmbctLKQojifo6bym7a1ypph55n1nSw58YZGDkGtgRNVmF"
.parse()
.unwrap(),
];
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Runtime wasm not available".to_string())?,
None,
)
.with_name("Planck")
.with_id("planck")
.with_protocol_id("planck")
.with_boot_nodes(boot_nodes)
.with_telemetry_endpoints(telemetry_endpoints)
.with_chain_type(ChainType::Live)
.with_genesis_config_preset_name(PLANCK_RUNTIME_PRESET)
.with_properties(properties)
.build())
}