|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | | -using System.Linq; |
4 | | -using System.Net; |
5 | | -using System.Text; |
| 3 | +using City.Networks; |
| 4 | +using City.Networks.Setup; |
6 | 5 | using NBitcoin; |
7 | | -using NBitcoin.Protocol; |
8 | 6 |
|
9 | 7 | namespace City |
10 | 8 | { |
11 | | - public class CitySetup |
| 9 | + internal class CitySetup |
12 | 10 | { |
13 | | - public const string FileNamePrefix = "city"; |
14 | | - public const string ConfigFileName = "city.conf"; |
15 | | - public const string Magic = "01-59-54-43"; |
16 | | - public const int CoinType = 1926; // SLIP-0044: https://github.com/satoshilabs/slips/blob/master/slip-0044.md |
17 | | - public const decimal PremineReward = 13736000000; |
18 | | - public const decimal PoWBlockReward = 2; |
19 | | - public const decimal PoSBlockReward = 20; |
20 | | - public const int LastPowBlock = 2500; |
21 | | - public const string GenesisText = "July 27, 2018, New Scientiest, Bitcoin’s roots are in anarcho-capitalism"; // The New York Times, 2020-04-16 |
22 | | - public static TimeSpan TargetSpacing = TimeSpan.FromSeconds(64); |
23 | | - public const uint ProofOfStakeTimestampMask = 0x0000000F; // 0x0000003F // 64 sec |
24 | | - public const int PoSVersion = 3; |
| 11 | + internal static CitySetup Instance = new CitySetup(); |
25 | 12 |
|
26 | | - public class Main |
| 13 | + internal CoinSetup Setup = new CoinSetup |
27 | 14 | { |
28 | | - public const string Name = "CityMain"; |
29 | | - public const string RootFolderName = "city"; |
30 | | - public const string CoinTicker = "CITY"; |
31 | | - public const int DefaultPort = 4333; |
32 | | - public const int DefaultRPCPort = 4334; |
33 | | - public const int DefaultAPIPort = 4335; |
34 | | - public const int DefaultSignalRPort = 4336; |
35 | | - public const int PubKeyAddress = 28; // B https://en.bitcoin.it/wiki/List_of_address_prefixes |
36 | | - public const int ScriptAddress = 88; // b |
37 | | - public const int SecretAddress = 237; |
38 | | - |
39 | | - public const uint GenesisTime = 1538481600; |
40 | | - public const uint GenesisNonce = 1626464; |
41 | | - public const uint GenesisBits = 0x1E0FFFFF; |
42 | | - public const int GenesisVersion = 1; |
43 | | - public static Money GenesisReward = Money.Zero; |
44 | | - public const string HashGenesisBlock = "00000b0517068e602ed5279c20168cfa1e69884ee4e784909652da34c361bff2"; |
45 | | - public const string HashMerkleRoot = "b3425d46594a954b141898c7eebe369c6e6a35d2dab393c1f495504d2147883b"; |
46 | | - |
47 | | - public static List<DNSSeedData> DNS = new List<DNSSeedData> |
48 | | - { |
49 | | - // TODO: Add additional DNS seeds here |
50 | | - new DNSSeedData("seed.city-chain.org", "seed.city-chain.org"), |
51 | | - new DNSSeedData("seed.citychain.foundation", "seed.citychain.foundation"), |
52 | | - new DNSSeedData("city.seed.blockcore.net", "city.seed.blockcore.net"), |
53 | | - }; |
54 | | - |
55 | | - public static List<NetworkAddress> Nodes = new List<NetworkAddress> |
56 | | - { |
57 | | - // TODO: Add additional seed nodes here |
58 | | - new NetworkAddress(IPAddress.Parse("23.97.234.230"), CitySetup.Test.DefaultPort), |
59 | | - new NetworkAddress(IPAddress.Parse("13.73.143.193"), CitySetup.Test.DefaultPort), |
60 | | - }; |
61 | | - |
62 | | - public static Dictionary<int, CheckpointInfo> Checkpoints = new Dictionary<int, CheckpointInfo> |
| 15 | + FileNamePrefix = "city", |
| 16 | + ConfigFileName = "city.conf", |
| 17 | + Magic = "01-59-54-43", |
| 18 | + CoinType = 1926, // SLIP-0044: https://github.com/satoshilabs/slips/blob/master/slip-0044.md, |
| 19 | + PremineReward = 13736000000, |
| 20 | + PoWBlockReward = 2, |
| 21 | + PoSBlockReward = 20, |
| 22 | + LastPowBlock = 2500, |
| 23 | + GenesisText = "July 27, 2018, New Scientiest, Bitcoin’s roots are in anarcho-capitalism", // The New York Times, 2020-04-16 |
| 24 | + TargetSpacing = TimeSpan.FromSeconds(64), |
| 25 | + ProofOfStakeTimestampMask = 0x0000000F, // 0x0000003F // 64 sec |
| 26 | + PoSVersion = 3 |
| 27 | + }; |
| 28 | + |
| 29 | + internal NetworkSetup Main = new NetworkSetup |
| 30 | + { |
| 31 | + Name = "CityMain", |
| 32 | + RootFolderName = "city", |
| 33 | + CoinTicker = "CITY", |
| 34 | + DefaultPort = 4333, |
| 35 | + DefaultRPCPort = 4334, |
| 36 | + DefaultAPIPort = 4335, |
| 37 | + DefaultSignalRPort = 4336, |
| 38 | + PubKeyAddress = 28, // B https://en.bitcoin.it/wiki/List_of_address_prefixes |
| 39 | + ScriptAddress = 88, // b |
| 40 | + SecretAddress = 237, |
| 41 | + GenesisTime = 1538481600, |
| 42 | + GenesisNonce = 1626464, |
| 43 | + GenesisBits = 0x1E0FFFFF, |
| 44 | + GenesisVersion = 1, |
| 45 | + GenesisReward = Money.Zero, |
| 46 | + HashGenesisBlock = "00000b0517068e602ed5279c20168cfa1e69884ee4e784909652da34c361bff2", |
| 47 | + HashMerkleRoot = "b3425d46594a954b141898c7eebe369c6e6a35d2dab393c1f495504d2147883b", |
| 48 | + DNS = new[] { "seed.city-chain.org", "seed.citychain.foundation", "seed.city-coin.org", "seed.liberstad.com", "city.seed.blockcore.net" }, |
| 49 | + Nodes = new[] { "23.97.234.230", "13.73.143.193", "89.10.227.34" }, |
| 50 | + Checkpoints = new Dictionary<int, CheckpointInfo> |
63 | 51 | { |
64 | 52 | // TODO: Add checkpoints as the network progresses. |
65 | | - }; |
66 | | - } |
| 53 | + } |
| 54 | + }; |
67 | 55 |
|
68 | | - public class RegTest |
| 56 | + internal NetworkSetup RegTest = new NetworkSetup |
69 | 57 | { |
70 | | - public const string Name = "CityRegTest"; |
71 | | - public const string RootFolderName = "CityRegTest"; |
72 | | - public const string CoinTicker = "TCITY"; |
73 | | - public const int DefaultPort = 14333; |
74 | | - public const int DefaultRPCPort = 14334; |
75 | | - public const int DefaultAPIPort = 14335; |
76 | | - public const int DefaultSignalRPort = 14336; |
77 | | - public const int PubKeyAddress = 111; |
78 | | - public const int ScriptAddress = 196; |
79 | | - public const int SecretAddress = 239; |
80 | | - |
81 | | - public const uint GenesisTime = 1587115302; |
82 | | - public const uint GenesisNonce = 5917; |
83 | | - public const uint GenesisBits = 0x1F00FFFF; |
84 | | - public const int GenesisVersion = 1; |
85 | | - public static Money GenesisReward = Money.Zero; |
86 | | - public const string HashGenesisBlock = "000039df5f7c79084bf96c67ea24761e177d77c24f326eb5294860144301cb68"; |
87 | | - public const string HashMerkleRoot = "d382311c9e4a1ec84be1b32eddb33f7f0420544a460754f573d7cb7054566d75"; |
88 | | - |
89 | | - public static List<DNSSeedData> DNS = new List<DNSSeedData> |
90 | | - { |
91 | | - // TODO: Add additional DNS seeds here |
92 | | - new DNSSeedData("seedregtest1.city.blockcore.net", "seedregtest1.city.blockcore.net"), |
93 | | - new DNSSeedData("seedregtest2.city.blockcore.net", "seedregtest2.city.blockcore.net"), |
94 | | - new DNSSeedData("seedregtest.city.blockcore.net", "seedregtest.city.blockcore.net"), |
95 | | - }; |
96 | | - |
97 | | - public static List<NetworkAddress> Nodes = new List<NetworkAddress> |
98 | | - { |
99 | | - // TODO: Add additional seed nodes here |
100 | | - new NetworkAddress(IPAddress.Parse("23.97.234.230"), CitySetup.Test.DefaultPort), |
101 | | - new NetworkAddress(IPAddress.Parse("13.73.143.193"), CitySetup.Test.DefaultPort), |
102 | | - }; |
103 | | - |
104 | | - public static Dictionary<int, CheckpointInfo> Checkpoints = new Dictionary<int, CheckpointInfo> |
| 58 | + Name = "CityRegTest", |
| 59 | + RootFolderName = "cityregtest", |
| 60 | + CoinTicker = "TCITY", |
| 61 | + DefaultPort = 14333, |
| 62 | + DefaultRPCPort = 14334, |
| 63 | + DefaultAPIPort = 14335, |
| 64 | + DefaultSignalRPort = 14336, |
| 65 | + PubKeyAddress = 111, |
| 66 | + ScriptAddress = 196, |
| 67 | + SecretAddress = 239, |
| 68 | + GenesisTime = 1587115302, |
| 69 | + GenesisNonce = 5917, |
| 70 | + GenesisBits = 0x1F00FFFF, |
| 71 | + GenesisVersion = 1, |
| 72 | + GenesisReward = Money.Zero, |
| 73 | + HashGenesisBlock = "000039df5f7c79084bf96c67ea24761e177d77c24f326eb5294860144301cb68", |
| 74 | + HashMerkleRoot = "d382311c9e4a1ec84be1b32eddb33f7f0420544a460754f573d7cb7054566d75", |
| 75 | + DNS = new[] { "seedregtest1.city.blockcore.net", "seedregtest2.city.blockcore.net", "seedregtest.city.blockcore.net" }, |
| 76 | + Nodes = new[] { "23.97.234.230", "13.73.143.193", "89.10.227.34" }, |
| 77 | + Checkpoints = new Dictionary<int, CheckpointInfo> |
105 | 78 | { |
106 | 79 | // TODO: Add checkpoints as the network progresses. |
107 | | - }; |
108 | | - } |
| 80 | + } |
| 81 | + }; |
109 | 82 |
|
110 | | - public class Test |
| 83 | + internal NetworkSetup Test = new NetworkSetup |
111 | 84 | { |
112 | | - public const string Name = "CityTest"; |
113 | | - public const string RootFolderName = "CityTest"; |
114 | | - public const string CoinTicker = "TCITY"; |
115 | | - public const int DefaultPort = 24333; |
116 | | - public const int DefaultRPCPort = 24334; |
117 | | - public const int DefaultAPIPort = 24335; |
118 | | - public const int DefaultSignalRPort = 24336; |
119 | | - public const int PubKeyAddress = 111; |
120 | | - public const int ScriptAddress = 196; |
121 | | - public const int SecretAddress = 239; |
122 | | - |
123 | | - public const uint GenesisTime = 1587115303; |
124 | | - public const uint GenesisNonce = 3451; |
125 | | - public const uint GenesisBits = 0x1F0FFFFF; |
126 | | - public const int GenesisVersion = 1; |
127 | | - public static Money GenesisReward = Money.Zero; |
128 | | - public const string HashGenesisBlock = "00090058f8a37e4190aa341ab9605d74b282f0c80983a676ac44b0689be0fae1"; |
129 | | - public const string HashMerkleRoot = "88cd7db112380c4d6d4609372b04cdd56c4f82979b7c3bf8c8a764f19859961f"; |
130 | | - |
131 | | - public static List<DNSSeedData> DNS = new List<DNSSeedData> |
132 | | - { |
133 | | - // TODO: Add additional DNS seeds here |
134 | | - new DNSSeedData("seedtest1.city.blockcore.net", "seedtest1.city.blockcore.net"), |
135 | | - new DNSSeedData("seedtest2.city.blockcore.net", "seedtest2.city.blockcore.net"), |
136 | | - new DNSSeedData("seedtest.city.blockcore.net", "seedtest.city.blockcore.net"), |
137 | | - }; |
138 | | - |
139 | | - public static List<NetworkAddress> Nodes = new List<NetworkAddress> |
140 | | - { |
141 | | - // TODO: Add additional seed nodes here |
142 | | - new NetworkAddress(IPAddress.Parse("23.97.234.230"), CitySetup.Test.DefaultPort), |
143 | | - new NetworkAddress(IPAddress.Parse("13.73.143.193"), CitySetup.Test.DefaultPort), |
144 | | - }; |
145 | | - |
146 | | - public static Dictionary<int, CheckpointInfo> Checkpoints = new Dictionary<int, CheckpointInfo> |
| 85 | + Name = "CityTest", |
| 86 | + RootFolderName = "citytest", |
| 87 | + CoinTicker = "TCITY", |
| 88 | + DefaultPort = 24333, |
| 89 | + DefaultRPCPort = 24334, |
| 90 | + DefaultAPIPort = 24335, |
| 91 | + DefaultSignalRPort = 24336, |
| 92 | + PubKeyAddress = 111, |
| 93 | + ScriptAddress = 196, |
| 94 | + SecretAddress = 239, |
| 95 | + GenesisTime = 1587115303, |
| 96 | + GenesisNonce = 3451, |
| 97 | + GenesisBits = 0x1F0FFFFF, |
| 98 | + GenesisVersion = 1, |
| 99 | + GenesisReward = Money.Zero, |
| 100 | + HashGenesisBlock = "00090058f8a37e4190aa341ab9605d74b282f0c80983a676ac44b0689be0fae1", |
| 101 | + HashMerkleRoot = "88cd7db112380c4d6d4609372b04cdd56c4f82979b7c3bf8c8a764f19859961f", |
| 102 | + DNS = new[] { "seedtest1.city.blockcore.net", "seedtest2.city.blockcore.net", "seedtest.city.blockcore.net" }, |
| 103 | + Nodes = new[] { "23.97.234.230", "13.73.143.193", "89.10.227.34" }, |
| 104 | + Checkpoints = new Dictionary<int, CheckpointInfo> |
147 | 105 | { |
148 | 106 | // TODO: Add checkpoints as the network progresses. |
149 | | - }; |
150 | | - } |
| 107 | + } |
| 108 | + }; |
151 | 109 |
|
152 | | - public static bool IsPoSv3() |
| 110 | + public bool IsPoSv3() |
153 | 111 | { |
154 | | - return PoSVersion == 3; |
| 112 | + return Setup.PoSVersion == 3; |
155 | 113 | } |
156 | 114 |
|
157 | | - public static bool IsPoSv4() |
| 115 | + public bool IsPoSv4() |
158 | 116 | { |
159 | | - return PoSVersion == 4; |
| 117 | + return Setup.PoSVersion == 4; |
160 | 118 | } |
161 | 119 | } |
162 | 120 | } |
0 commit comments