Raven Core  3.0.0
P2P Digital Currency
chainparams.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 The Bitcoin Core developers
3 // Copyright (c) 2017-2019 The Raven Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #include "chainparams.h"
8 #include "consensus/merkle.h"
9 
10 #include "tinyformat.h"
11 #include "util.h"
12 #include "utilstrencodings.h"
13 #include "arith_uint256.h"
14 
15 #include <assert.h>
16 
17 #include "chainparamsseeds.h"
18 
19 //TODO: Take these out
20 extern double algoHashTotal[16];
21 extern int algoHashHits[16];
22 
23 
24 static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
25 {
26  CMutableTransaction txNew;
27  txNew.nVersion = 1;
28  txNew.vin.resize(1);
29  txNew.vout.resize(1);
30  txNew.vin[0].scriptSig = CScript() << CScriptNum(0) << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
31  txNew.vout[0].nValue = genesisReward;
32  txNew.vout[0].scriptPubKey = genesisOutputScript;
33 
34  CBlock genesis;
35  genesis.nTime = nTime;
36  genesis.nBits = nBits;
37  genesis.nNonce = nNonce;
38  genesis.nVersion = nVersion;
39  genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
40  genesis.hashPrevBlock.SetNull();
41  genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
42  return genesis;
43 }
44 
56 static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
57 {
58  const char* pszTimestamp = "The Times 03/Jan/2018 Bitcoin is name of the game for new generation of firms";
59  const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
60  return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
61 }
62 
63 void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
64 {
65  consensus.vDeployments[d].nStartTime = nStartTime;
66  consensus.vDeployments[d].nTimeout = nTimeout;
67 }
68 
70  consensus.nSegwitEnabled = false;
71 }
72 
74  consensus.nCSVEnabled = false;
75 }
76 
78  consensus.nBIP34Enabled = false;
79 }
80 
82  consensus.nBIP65Enabled = false;
83 }
84 
86  consensus.nBIP66Enabled = false;
87 }
88 
90  return consensus.nBIP34Enabled;
91 }
92 
94  return consensus.nBIP34Enabled;
95 }
96 
98  return consensus.nBIP34Enabled;
99 }
100 
102  return consensus.nCSVEnabled;
103 }
104 
105 
117 class CMainParams : public CChainParams {
118 public:
120  strNetworkID = "main";
121  consensus.nSubsidyHalvingInterval = 2100000; //~ 4 yrs at 1 min block time
122  consensus.nBIP34Enabled = true;
123  consensus.nBIP65Enabled = true; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
124  consensus.nBIP66Enabled = true;
125  consensus.nSegwitEnabled = true;
126  consensus.nCSVEnabled = true;
127  consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
128  consensus.nPowTargetTimespan = 2016 * 60; // 1.4 days
129  consensus.nPowTargetSpacing = 1 * 60;
132  consensus.nRuleChangeActivationThreshold = 1613; // Approx 80% of 2016
133  consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
135  consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
136  consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
140  consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nStartTime = 1540944000; // Oct 31, 2018
141  consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nTimeout = 1572480000; // Oct 31, 2019
145  consensus.vDeployments[Consensus::DEPLOYMENT_MESSAGING].nStartTime = 5544116233; // TODO Update when ready
146  consensus.vDeployments[Consensus::DEPLOYMENT_MESSAGING].nTimeout = 5544116233; //TODO Update when ready
150  consensus.vDeployments[Consensus::DEPLOYMENT_RESTRICTED_ASSETS].nStartTime = 5544116233; // TODO Update when ready
151  consensus.vDeployments[Consensus::DEPLOYMENT_RESTRICTED_ASSETS].nTimeout = 5544116233; //TODO Update when ready
154 
155  // The best chain should have at least this much work.
157 
158  // By default assume that the signatures in ancestors of this block are valid.
160 
161 
162  // The best chain should have at least this much work.
163  //consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000000000c000c00");
164 
165  // By default assume that the signatures in ancestors of this block are valid.
166  consensus.defaultAssumeValid = uint256S("0x00000000000027d11bf1e7a3b57d3c89acc1722f39d6e08f23ac3a07e16e3172"); // 740000
167 
173  pchMessageStart[0] = 0x52; // R
174  pchMessageStart[1] = 0x41; // A
175  pchMessageStart[2] = 0x56; // V
176  pchMessageStart[3] = 0x4e; // N
177  nDefaultPort = 8767;
178  nPruneAfterHeight = 100000;
179 
180  genesis = CreateGenesisBlock(1514999494, 25023712, 0x1e00ffff, 4, 5000 * COIN);
181 
182  consensus.hashGenesisBlock = genesis.GetHash();
183 
184  assert(consensus.hashGenesisBlock == uint256S("0000006b444bc2f2ffe627be9d9e7e7a0730000870ef6eb6da46c8eae389df90"));
185  assert(genesis.hashMerkleRoot == uint256S("28ff00a867739a352523808d301f504bc4547699398d70faf2266a8bae5f3516"));
186 
187  vSeeds.emplace_back("seed-raven.bitactivate.com", false);
188  vSeeds.emplace_back("seed-raven.ravencoin.com", false);
189  vSeeds.emplace_back("seed-raven.ravencoin.org", false);
190 
191  base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,60);
192  base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,122);
193  base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128);
194  base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
195  base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
196 
197  vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
198 
200  fRequireStandard = true;
201  fMineBlocksOnDemand = false;
202  fMiningRequiresPeers = true;
203 
205  {
206  { 535721, uint256S("0x000000000001217f58a594ca742c8635ecaaaf695d1a63f6ab06979f1c159e04")},
207  { 697376, uint256S("0x000000000000499bf4ebbe61541b02e4692b33defc7109d8f12d2825d4d2dfa0")},
208  { 740000, uint256S("0x00000000000027d11bf1e7a3b57d3c89acc1722f39d6e08f23ac3a07e16e3172")},
209  }
210  };
211 
213  // Update as we know more about the contents of the Raven chain
214  // Stats as of 000000000000a72545994ce72b25042ea63707fca169ca4deb7f9dab4f1b1798 window size 43200
215  1543817453, // * UNIX timestamp of last known number of transactions
216  2033711, // * total number of transactions between genesis and that timestamp
217  // (the tx=... number in the SetBestChain debug.log lines)
218  0.1 // * estimated number of transactions per second after that timestamp
219  };
220 
222  // Burn Amounts
223  nIssueAssetBurnAmount = 500 * COIN;
224  nReissueAssetBurnAmount = 100 * COIN;
225  nIssueSubAssetBurnAmount = 100 * COIN;
226  nIssueUniqueAssetBurnAmount = 5 * COIN;
227  nIssueMsgChannelAssetBurnAmount = 100 * COIN;
228  nIssueQualifierAssetBurnAmount = 1000 * COIN;
230  nIssueRestrictedAssetBurnAmount = 1500 * COIN;
231  nAddNullQualifierTagBurnAmount = .1 * COIN;
232 
233  // Burn Addresses
234  strIssueAssetBurnAddress = "RXissueAssetXXXXXXXXXXXXXXXXXhhZGt";
235  strReissueAssetBurnAddress = "RXReissueAssetXXXXXXXXXXXXXXVEFAWu";
236  strIssueSubAssetBurnAddress = "RXissueSubAssetXXXXXXXXXXXXXWcwhwL";
237  strIssueUniqueAssetBurnAddress = "RXissueUniqueAssetXXXXXXXXXXWEAe58";
238  strIssueMsgChannelAssetBurnAddress = "RXissueMsgChanneLAssetXXXXXXSjHvAY";
239  strIssueQualifierAssetBurnAddress = "RXissueQuaLifierXXXXXXXXXXXXUgEDbC";
240  strIssueSubQualifierAssetBurnAddress = "RXissueSubQuaLifierXXXXXXXXXVTzvv5";
241  strIssueRestrictedAssetBurnAddress = "RXissueRestrictedXXXXXXXXXXXXzJZ1q";
242  strAddNullQualifierTagBurnAddress = "RXaddTagBurnXXXXXXXXXXXXXXXXZQm5ya";
243 
244  //Global Burn Address
245  strGlobalBurnAddress = "RXBurnXXXXXXXXXXXXXXXXXXXXXXWUo9FV";
246 
247  // DGW Activation
248  nDGWActivationBlock = 338778;
249 
250  nMaxReorganizationDepth = 60; // 60 at 1 minute block timespan is +/- 60 minutes.
252  nMinReorganizationAge = 60 * 60 * 12; // 12 hours
253 
254  nAssetActivationHeight = 435456; // Asset activated block height
255  nMessagingActivationBlock = 0; // Messaging activated block height // TODO after messaging goes active on mainnet
256  nRestrictedActivationBlock = 0; // Restricted activated block height // TODO after restricted goes active on mainnet
258  }
259 };
260 
264 class CTestNetParams : public CChainParams {
265 public:
267  strNetworkID = "test";
268  consensus.nSubsidyHalvingInterval = 2100000; //~ 4 yrs at 1 min block time
269  consensus.nBIP34Enabled = true;
270  consensus.nBIP65Enabled = true; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
271  consensus.nBIP66Enabled = true;
272  consensus.nSegwitEnabled = true;
273  consensus.nCSVEnabled = true;
274 
275  consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
276  consensus.nPowTargetTimespan = 2016 * 60; // 1.4 days
277  consensus.nPowTargetSpacing = 1 * 60;
280  consensus.nRuleChangeActivationThreshold = 1310; // Approx 65% for testchains
281  consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
283  consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
284  consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
288  consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nStartTime = 1533924000; // GMT: Friday, August 10, 2018 6:00:00 PM
289  consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nTimeout = 1538351999; // GMT: Sunday, September 30, 2018 11:59:59 PM
293  consensus.vDeployments[Consensus::DEPLOYMENT_MESSAGING].nStartTime = 1551657600; // GMT: Sun Mar 3, 2019 5:00:00 PM
294  consensus.vDeployments[Consensus::DEPLOYMENT_MESSAGING].nTimeout = 1579480000; // GMT: Sun Jan 19 2020 05:26:40 PM
298  consensus.vDeployments[Consensus::DEPLOYMENT_RESTRICTED_ASSETS].nStartTime = 1559908800; // GMT Sun, Jun 07 2019 6:00:00 PM
299  consensus.vDeployments[Consensus::DEPLOYMENT_RESTRICTED_ASSETS].nTimeout = 1591531200; // GMT Sun, Jun 07 2020 6:00:00 PM
302 
303 
304  // The best chain should have at least this much work.
306 
307  // By default assume that the signatures in ancestors of this block are valid.
309 
310 
311  pchMessageStart[0] = 0x52; // R
312  pchMessageStart[1] = 0x56; // V
313  pchMessageStart[2] = 0x4E; // N
314  pchMessageStart[3] = 0x54; // T
315  nDefaultPort = 18770;
316  nPruneAfterHeight = 1000;
317 
318  uint32_t nGenesisTime = 1537466400; // Thursday, September 20, 2018 12:00:00 PM GMT-06:00
319 
320  // This is used inorder to mine the genesis block. Once found, we can use the nonce and block hash found to create a valid genesis block
321 // /////////////////////////////////////////////////////////////////
322 
323 
324 // arith_uint256 test;
325 // bool fNegative;
326 // bool fOverflow;
327 // test.SetCompact(0x1e00ffff, &fNegative, &fOverflow);
328 // std::cout << "Test threshold: " << test.GetHex() << "\n\n";
329 //
330 // int genesisNonce = 0;
331 // uint256 TempHashHolding = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");
332 // uint256 BestBlockHash = uint256S("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
333 // for (int i=0;i<40000000;i++) {
334 // genesis = CreateGenesisBlock(nGenesisTime, i, 0x1e00ffff, 2, 5000 * COIN);
335 // //genesis.hashPrevBlock = TempHashHolding;
336 // consensus.hashGenesisBlock = genesis.GetHash();
337 //
338 // arith_uint256 BestBlockHashArith = UintToArith256(BestBlockHash);
339 // if (UintToArith256(consensus.hashGenesisBlock) < BestBlockHashArith) {
340 // BestBlockHash = consensus.hashGenesisBlock;
341 // std::cout << BestBlockHash.GetHex() << " Nonce: " << i << "\n";
342 // std::cout << " PrevBlockHash: " << genesis.hashPrevBlock.GetHex() << "\n";
343 // }
344 //
345 // TempHashHolding = consensus.hashGenesisBlock;
346 //
347 // if (BestBlockHashArith < test) {
348 // genesisNonce = i - 1;
349 // break;
350 // }
351 // //std::cout << consensus.hashGenesisBlock.GetHex() << "\n";
352 // }
353 // std::cout << "\n";
354 // std::cout << "\n";
355 // std::cout << "\n";
356 //
357 // std::cout << "hashGenesisBlock to 0x" << BestBlockHash.GetHex() << std::endl;
358 // std::cout << "Genesis Nonce to " << genesisNonce << std::endl;
359 // std::cout << "Genesis Merkle " << genesis.hashMerkleRoot.GetHex() << std::endl;
360 //
361 // std::cout << "\n";
362 // std::cout << "\n";
363 // int totalHits = 0;
364 // double totalTime = 0.0;
365 //
366 // for(int x = 0; x < 16; x++) {
367 // totalHits += algoHashHits[x];
368 // totalTime += algoHashTotal[x];
369 // std::cout << "hash algo " << x << " hits " << algoHashHits[x] << " total " << algoHashTotal[x] << " avg " << algoHashTotal[x]/algoHashHits[x] << std::endl;
370 // }
371 //
372 // std::cout << "Totals: hash algo " << " hits " << totalHits << " total " << totalTime << " avg " << totalTime/totalHits << std::endl;
373 //
374 // genesis.hashPrevBlock = TempHashHolding;
375 //
376 // return;
377 
378 // /////////////////////////////////////////////////////////////////
379 
380  genesis = CreateGenesisBlock(nGenesisTime, 15615880, 0x1e00ffff, 2, 5000 * COIN);
381  consensus.hashGenesisBlock = genesis.GetHash();
382 
383  //Test MerkleRoot and GenesisBlock
384  assert(consensus.hashGenesisBlock == uint256S("0x000000ecfc5e6324a079542221d00e10362bdc894d56500c414060eea8a3ad5a"));
385  assert(genesis.hashMerkleRoot == uint256S("28ff00a867739a352523808d301f504bc4547699398d70faf2266a8bae5f3516"));
386 
387  vFixedSeeds.clear();
388  vSeeds.clear();
389 
390  vSeeds.emplace_back("seed-testnet-raven.bitactivate.com", false);
391  vSeeds.emplace_back("seed-testnet-raven.ravencoin.com", false);
392  vSeeds.emplace_back("seed-testnet-raven.ravencoin.org", false);
393 
394  base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
395  base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
396  base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
397  base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
398  base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
399 
400  vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
401 
403  fRequireStandard = false;
404  fMineBlocksOnDemand = false;
405  fMiningRequiresPeers = true;
406 
408  {
409  }
410  };
411 
413  // Update as we know more about the contents of the Raven chain
414  // Stats as of 00000023b66f46d74890287a7b1157dd780c7c5fdda2b561eb96684d2b39d62e window size 43200
415  1543633332, // * UNIX timestamp of last known number of transactions
416  146666, // * total number of transactions between genesis and that timestamp
417  // (the tx=... number in the SetBestChain debug.log lines)
418  0.02 // * estimated number of transactions per second after that timestamp
419  };
420 
422  // Burn Amounts
423  nIssueAssetBurnAmount = 500 * COIN;
424  nReissueAssetBurnAmount = 100 * COIN;
425  nIssueSubAssetBurnAmount = 100 * COIN;
426  nIssueUniqueAssetBurnAmount = 5 * COIN;
427  nIssueMsgChannelAssetBurnAmount = 100 * COIN;
428  nIssueQualifierAssetBurnAmount = 1000 * COIN;
430  nIssueRestrictedAssetBurnAmount = 1500 * COIN;
431  nAddNullQualifierTagBurnAmount = .1 * COIN;
432 
433  // Burn Addresses
434  strIssueAssetBurnAddress = "n1issueAssetXXXXXXXXXXXXXXXXWdnemQ";
435  strReissueAssetBurnAddress = "n1ReissueAssetXXXXXXXXXXXXXXWG9NLd";
436  strIssueSubAssetBurnAddress = "n1issueSubAssetXXXXXXXXXXXXXbNiH6v";
437  strIssueUniqueAssetBurnAddress = "n1issueUniqueAssetXXXXXXXXXXS4695i";
438  strIssueMsgChannelAssetBurnAddress = "n1issueMsgChanneLAssetXXXXXXT2PBdD";
439  strIssueQualifierAssetBurnAddress = "n1issueQuaLifierXXXXXXXXXXXXUysLTj";
440  strIssueSubQualifierAssetBurnAddress = "n1issueSubQuaLifierXXXXXXXXXYffPLh";
441  strIssueRestrictedAssetBurnAddress = "n1issueRestrictedXXXXXXXXXXXXZVT9V";
442  strAddNullQualifierTagBurnAddress = "n1addTagBurnXXXXXXXXXXXXXXXXX5oLMH";
443 
444  // Global Burn Address
445  strGlobalBurnAddress = "n1BurnXXXXXXXXXXXXXXXXXXXXXXU1qejP";
446 
447  // DGW Activation
448  nDGWActivationBlock = 200;
449 
450  nMaxReorganizationDepth = 60; // 60 at 1 minute block timespan is +/- 60 minutes.
452  nMinReorganizationAge = 60 * 60 * 12; // 12 hours
453 
454  nAssetActivationHeight = 6048; // Asset activated block height
455  nMessagingActivationBlock = 249984; // Messaging activated block height
456  nRestrictedActivationBlock = 0; // Restricted activated block height // TODO after restricted goes active on testnet
459  }
460 };
461 
465 class CRegTestParams : public CChainParams {
466 public:
468  strNetworkID = "regtest";
469  consensus.nBIP34Enabled = true;
470  consensus.nBIP65Enabled = true; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
471  consensus.nBIP66Enabled = true;
472  consensus.nSegwitEnabled = true;
473  consensus.nCSVEnabled = true;
475  consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
476  consensus.nPowTargetTimespan = 2016 * 60; // 1.4 days
477  consensus.nPowTargetSpacing = 1 * 60;
480  consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
481  consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
502 
503  // The best chain should have at least this much work.
505 
506  // By default assume that the signatures in ancestors of this block are valid.
508 
509  pchMessageStart[0] = 0x43; // C
510  pchMessageStart[1] = 0x52; // R
511  pchMessageStart[2] = 0x4F; // O
512  pchMessageStart[3] = 0x57; // W
513  nDefaultPort = 18444;
514  nPruneAfterHeight = 1000;
515 
516 // This is used inorder to mine the genesis block. Once found, we can use the nonce and block hash found to create a valid genesis block
517 // /////////////////////////////////////////////////////////////////
518 //
519 //
520 // arith_uint256 test;
521 // bool fNegative;
522 // bool fOverflow;
523 // test.SetCompact(0x207fffff, &fNegative, &fOverflow);
524 // std::cout << "Test threshold: " << test.GetHex() << "\n\n";
525 //
526 // int genesisNonce = 0;
527 // uint256 TempHashHolding = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");
528 // uint256 BestBlockHash = uint256S("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
529 // for (int i=0;i<40000000;i++) {
530 // genesis = CreateGenesisBlock(1533751200, i, 0x207fffff, 2, 5000 * COIN);
531 // //genesis.hashPrevBlock = TempHashHolding;
532 // consensus.hashGenesisBlock = genesis.GetHash();
533 //
534 // arith_uint256 BestBlockHashArith = UintToArith256(BestBlockHash);
535 // if (UintToArith256(consensus.hashGenesisBlock) < BestBlockHashArith) {
536 // BestBlockHash = consensus.hashGenesisBlock;
537 // std::cout << BestBlockHash.GetHex() << " Nonce: " << i << "\n";
538 // std::cout << " PrevBlockHash: " << genesis.hashPrevBlock.GetHex() << "\n";
539 // }
540 //
541 // TempHashHolding = consensus.hashGenesisBlock;
542 //
543 // if (BestBlockHashArith < test) {
544 // genesisNonce = i - 1;
545 // break;
546 // }
547 // //std::cout << consensus.hashGenesisBlock.GetHex() << "\n";
548 // }
549 // std::cout << "\n";
550 // std::cout << "\n";
551 // std::cout << "\n";
552 //
553 // std::cout << "hashGenesisBlock to 0x" << BestBlockHash.GetHex() << std::endl;
554 // std::cout << "Genesis Nonce to " << genesisNonce << std::endl;
555 // std::cout << "Genesis Merkle " << genesis.hashMerkleRoot.GetHex() << std::endl;
556 //
557 // std::cout << "\n";
558 // std::cout << "\n";
559 // int totalHits = 0;
560 // double totalTime = 0.0;
561 //
562 // for(int x = 0; x < 16; x++) {
563 // totalHits += algoHashHits[x];
564 // totalTime += algoHashTotal[x];
565 // std::cout << "hash algo " << x << " hits " << algoHashHits[x] << " total " << algoHashTotal[x] << " avg " << algoHashTotal[x]/algoHashHits[x] << std::endl;
566 // }
567 //
568 // std::cout << "Totals: hash algo " << " hits " << totalHits << " total " << totalTime << " avg " << totalTime/totalHits << std::endl;
569 //
570 // genesis.hashPrevBlock = TempHashHolding;
571 //
572 // return;
573 
574 // /////////////////////////////////////////////////////////////////
575 
576 
577  genesis = CreateGenesisBlock(1524179366, 1, 0x207fffff, 4, 5000 * COIN);
578  consensus.hashGenesisBlock = genesis.GetHash();
579 
580  assert(consensus.hashGenesisBlock == uint256S("0x0b2c703dc93bb63a36c4e33b85be4855ddbca2ac951a7a0a29b8de0408200a3c "));
581  assert(genesis.hashMerkleRoot == uint256S("0x28ff00a867739a352523808d301f504bc4547699398d70faf2266a8bae5f3516"));
582 
583  vFixedSeeds.clear();
584  vSeeds.clear();
585 
587  fRequireStandard = false;
588  fMineBlocksOnDemand = true;
589 
591  {
592  }
593  };
594 
596  0,
597  0,
598  0
599  };
600 
601  base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
602  base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
603  base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
604  base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
605  base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
606 
607 
609  // Burn Amounts
610  nIssueAssetBurnAmount = 500 * COIN;
611  nReissueAssetBurnAmount = 100 * COIN;
612  nIssueSubAssetBurnAmount = 100 * COIN;
613  nIssueUniqueAssetBurnAmount = 5 * COIN;
614  nIssueMsgChannelAssetBurnAmount = 100 * COIN;
615  nIssueQualifierAssetBurnAmount = 1000 * COIN;
617  nIssueRestrictedAssetBurnAmount = 1500 * COIN;
618  nAddNullQualifierTagBurnAmount = .1 * COIN;
619 
620  // Burn Addresses
621  strIssueAssetBurnAddress = "n1issueAssetXXXXXXXXXXXXXXXXWdnemQ";
622  strReissueAssetBurnAddress = "n1ReissueAssetXXXXXXXXXXXXXXWG9NLd";
623  strIssueSubAssetBurnAddress = "n1issueSubAssetXXXXXXXXXXXXXbNiH6v";
624  strIssueUniqueAssetBurnAddress = "n1issueUniqueAssetXXXXXXXXXXS4695i";
625  strIssueMsgChannelAssetBurnAddress = "n1issueMsgChanneLAssetXXXXXXT2PBdD";
626  strIssueQualifierAssetBurnAddress = "n1issueQuaLifierXXXXXXXXXXXXUysLTj";
627  strIssueSubQualifierAssetBurnAddress = "n1issueSubQuaLifierXXXXXXXXXYffPLh";
628  strIssueRestrictedAssetBurnAddress = "n1issueRestrictedXXXXXXXXXXXXZVT9V";
629  strAddNullQualifierTagBurnAddress = "n1addTagBurnXXXXXXXXXXXXXXXXX5oLMH";
630 
631  // Global Burn Address
632  strGlobalBurnAddress = "n1BurnXXXXXXXXXXXXXXXXXXXXXXU1qejP";
633 
634  // DGW Activation
635  nDGWActivationBlock = 200;
636 
637  nMaxReorganizationDepth = 60; // 60 at 1 minute block timespan is +/- 60 minutes.
639  nMinReorganizationAge = 60 * 60 * 12; // 12 hours
640 
641  nAssetActivationHeight = 0; // Asset activated block height
642  nMessagingActivationBlock = 0; // Messaging activated block height
643  nRestrictedActivationBlock = 0; // Restricted activated block height
645  }
646 };
647 
648 static std::unique_ptr<CChainParams> globalChainParams;
649 
651  assert(globalChainParams);
652  return *globalChainParams;
653 }
654 
655 std::unique_ptr<CChainParams> CreateChainParams(const std::string& chain)
656 {
657  if (chain == CBaseChainParams::MAIN)
658  return std::unique_ptr<CChainParams>(new CMainParams());
659  else if (chain == CBaseChainParams::TESTNET)
660  return std::unique_ptr<CChainParams>(new CTestNetParams());
661  else if (chain == CBaseChainParams::REGTEST)
662  return std::unique_ptr<CChainParams>(new CRegTestParams());
663  throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
664 }
665 
666 void SelectParams(const std::string& network)
667 {
668  SelectBaseParams(network);
669  globalChainParams = CreateChainParams(network);
670 }
671 
672 void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
673 {
674  globalChainParams->UpdateVersionBitsParameters(d, nStartTime, nTimeout);
675 }
676 
678  globalChainParams->TurnOffSegwit();
679 }
680 
681 void TurnOffCSV() {
682  globalChainParams->TurnOffCSV();
683 }
684 
685 void TurnOffBIP34() {
686  globalChainParams->TurnOffBIP34();
687 }
688 
689 void TurnOffBIP65() {
690  globalChainParams->TurnOffBIP65();
691 }
692 
693 void TurnOffBIP66() {
694  globalChainParams->TurnOffBIP66();
695 }
uint32_t nNonce
Definition: block.h:30
bool fMineBlocksOnDemand
Definition: chainparams.h:139
uint32_t nOverrideMinerConfirmationWindow
Use to override the confirmation window on a specific BIP.
Definition: params.h:39
int nAssetActivationHeight
Definition: chainparams.h:178
CAmount nIssueSubQualifierAssetBurnAmount
Definition: chainparams.h:152
void SetNull()
Definition: uint256.h:41
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
Definition: chainparams.cpp:63
Main network.
CAmount nIssueSubAssetBurnAmount
Definition: chainparams.h:148
int64_t nPowTargetTimespan
Definition: params.h:72
bool fPowNoRetargeting
Definition: params.h:70
static const std::string REGTEST
CAmount nIssueAssetBurnAmount
RVN Start.
Definition: chainparams.h:146
Definition: block.h:73
#define strprintf
Definition: tinyformat.h:1054
std::vector< CTxIn > vin
Definition: transaction.h:391
std::vector< unsigned char > base58Prefixes[MAX_BASE58_TYPES]
Definition: chainparams.h:133
int algoHashHits[16]
Definition: hash.cpp:13
bool fPowAllowMinDifficultyBlocks
Definition: params.h:69
void TurnOffBIP65()
Definition: chainparams.cpp:81
int nMinReorganizationAge
Definition: chainparams.h:176
std::string strIssueSubAssetBurnAddress
Definition: chainparams.h:159
CChainParams defines various tweakable parameters of a given instance of the Raven system...
Definition: chainparams.h:48
std::string strAddNullQualifierTagBurnAddress
Definition: chainparams.h:165
std::string strIssueSubQualifierAssetBurnAddress
Definition: chainparams.h:163
std::string strIssueUniqueAssetBurnAddress
Definition: chainparams.h:160
bool CSVEnabled() const
CAmount nReissueAssetBurnAmount
Definition: chainparams.h:147
uint32_t nTime
Definition: block.h:28
CAmount nIssueUniqueAssetBurnAmount
Definition: chainparams.h:149
CMessageHeader::MessageStartChars pchMessageStart
Definition: chainparams.h:129
ChainTxData chainTxData
Definition: chainparams.h:142
static const std::string MAIN
BIP70 chain name strings (main, test or regtest)
int nSubsidyHalvingInterval
Definition: params.h:49
bool nBIP34Enabled
Block height and hash at which BIP34 becomes active.
Definition: params.h:51
bool nSegwitEnabled
Definition: params.h:76
int64_t CAmount
Amount in corbies (Can be negative)
Definition: amount.h:13
uint256 powLimit
Proof of work parameters.
Definition: params.h:68
double algoHashTotal[16]
Definition: hash.cpp:12
uint256 hashMerkleRoot
Definition: block.h:27
void TurnOffBIP34()
Definition: chainparams.cpp:77
std::unique_ptr< CChainParams > CreateChainParams(const std::string &chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
DeploymentPos
Definition: params.h:16
bool fRequireStandard
Definition: chainparams.h:138
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given BIP70 chain name.
std::string strIssueRestrictedAssetBurnAddress
Definition: chainparams.h:164
uint256 uint256S(const char *str)
Definition: uint256.h:150
int64_t nStartTime
Start MedianTime for version bits miner confirmation.
Definition: params.h:35
Regression test.
int64_t nPowTargetSpacing
Definition: params.h:71
uint256 hashPrevBlock
Definition: block.h:26
void TurnOffSegwit()
Definition: chainparams.cpp:69
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
Definition: merkle.cpp:159
bool nBIP65Enabled
Definition: params.h:52
bool nCSVEnabled
Definition: params.h:77
void TurnOffCSV()
Definition: chainparams.cpp:73
uint32_t nMinerConfirmationWindow
Definition: params.h:65
std::vector< CTxOut > vout
Definition: transaction.h:392
int nMinReorganizationPeers
Definition: chainparams.h:175
CAmount nIssueQualifierAssetBurnAmount
Definition: chainparams.h:151
std::vector< CDNSSeedData > vSeeds
Definition: chainparams.h:132
std::string strReissueAssetBurnAddress
Definition: chainparams.h:158
Testnet (v6)
uint256 GetHash() const
Definition: block.cpp:14
int64_t nTimeout
Timeout/expiry MedianTime for the deployment attempt.
Definition: params.h:37
std::string strIssueAssetBurnAddress
Definition: chainparams.h:157
uint256 nMinimumChainWork
Definition: params.h:74
int nMaxReorganizationDepth
Definition: chainparams.h:174
std::vector< CTransactionRef > vtx
Definition: block.h:77
std::vector< SeedSpec6 > vFixedSeeds
Definition: chainparams.h:136
#define ARRAYLEN(array)
uint256 defaultAssumeValid
Definition: params.h:75
const CChainParams & Params()
Return the currently selected parameters.
std::string strGlobalBurnAddress
Definition: chainparams.h:168
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:396
Consensus::Params consensus
Definition: chainparams.h:128
CAmount nIssueMsgChannelAssetBurnAmount
Definition: chainparams.h:150
void TurnOffBIP66()
Definition: chainparams.cpp:85
std::string strNetworkID
Definition: chainparams.h:134
bool fMiningRequiresPeers
Definition: chainparams.h:140
unsigned int nDGWActivationBlock
Definition: chainparams.h:170
static const std::string TESTNET
A mutable version of CTransaction.
Definition: transaction.h:389
bool nBIP66Enabled
Definition: params.h:53
uint32_t nRuleChangeActivationThreshold
Block height at which BIP65 becomes active.
Definition: params.h:64
uint64_t nPruneAfterHeight
Definition: chainparams.h:131
std::string strIssueQualifierAssetBurnAddress
Definition: chainparams.h:162
int bit
Bit position to select the particular bit in nVersion.
Definition: params.h:33
CCheckpointData checkpointData
Definition: chainparams.h:141
void SelectBaseParams(const std::string &chain)
Sets the params returned by Params() to those for the given network.
std::string strIssueMsgChannelAssetBurnAddress
Definition: chainparams.h:161
unsigned int nRestrictedActivationBlock
Definition: chainparams.h:172
uint32_t nOverrideRuleChangeActivationThreshold
Use to override the the activation threshold on a specific BIP.
Definition: params.h:41
int32_t nVersion
Definition: block.h:25
CAmount nIssueRestrictedAssetBurnAmount
Definition: chainparams.h:153
unsigned int nMessagingActivationBlock
Definition: chainparams.h:171
CAmount nAddNullQualifierTagBurnAmount
Definition: chainparams.h:154
uint256 hashGenesisBlock
Definition: params.h:48
bool fDefaultConsistencyChecks
Definition: chainparams.h:137
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS]
Definition: params.h:66
uint32_t nBits
Definition: block.h:29
std::vector< unsigned char > ParseHex(const char *psz)