// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "assert.h" #include "chainparams.h" #include "main.h" #include "util.h" #include using namespace boost::assign; struct SeedSpec6 { uint8_t addr[16]; uint16_t port; }; #include "chainparamsseeds.h" // // Main network // // Convert the pnSeeds6 array into usable address objects. static void convertSeed6(std::vector &vSeedsOut, const SeedSpec6 *data, unsigned int count) { // It'll only connect to one or two seed nodes because once it connects, // it'll get a pile of addresses with newer timestamps. // Seed nodes are given a random 'last seen time' of between one and two // weeks ago. const int64_t nOneWeek = 7*24*60*60; for (unsigned int i = 0; i < count; i++) { struct in6_addr ip; memcpy(&ip, data[i].addr, sizeof(ip)); CAddress addr(CService(ip, data[i].port)); addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek; vSeedsOut.push_back(addr); } } class CMainParams : public CChainParams { public: CMainParams() { // The message start string is designed to be unlikely to occur in normal data. // The characters are rarely used upper ASCII, not valid as UTF-8, and produce // a large 4-byte int at any alignment. pchMessageStart[0] = 0xfa; pchMessageStart[1] = 0xf4; pchMessageStart[2] = 0xfb; pchMessageStart[3] = 0xff; vAlertPubKey = ParseHex("0486bce1bac0d543f104cbff2bd23680056a3b9ea05e1137d2ff90eeb5e08472eb500322593a2cb06fbf8297d7beb6cd30cb90f98153b5b7cce1493749e41e0284"); nDefaultPort = 25159; nRPCPort = 26159; bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20); // Build the genesis block. Note that the output of the genesis coinbase cannot // be spent as it did not originally exist in the database. const char* pszTimestamp = "aurovine goes live"; std::vector vin; vin.resize(1); vin[0].scriptSig = CScript() << 0 << CBigNum(42) << vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); std::vector vout; vout.resize(1); vout[0].SetEmpty(); CTransaction txNew(1, 1417617640, vin, vout, 0); genesis.vtx.push_back(txNew); genesis.hashPrevBlock = 0; genesis.hashMerkleRoot = genesis.BuildMerkleTree(); genesis.nVersion = 1; genesis.nTime = 1417617640; genesis.nBits = bnProofOfWorkLimit.GetCompact(); genesis.nNonce = 513798; hashGenesisBlock = genesis.GetHash(); assert(hashGenesisBlock == uint256("0x000003d9347a2ed183e9167c5e3d6932530886401bd7769b991c40e6962f85d6")); assert(genesis.hashMerkleRoot == uint256("0x77e4b157ed08be1836b38295aefc49da8608431dd0407df8f52ca492ca3266dc")); //Pushing our seed nodes vSeeds.push_back(CDNSSeedData("52.56.111.222", "52.56.111.222")); vSeeds.push_back(CDNSSeedData("52.56.175.189", "52.56.175.189")); vSeeds.push_back(CDNSSeedData("35.176.14.149", "35.176.14.149")); //Seed Nodes that were available by default vSeeds.push_back(CDNSSeedData("178.62.233.116", "178.62.233.116")); vSeeds.push_back(CDNSSeedData("presstab", "adcseed.presstab.pw")); base58Prefixes[PUBKEY_ADDRESS] = std::vector(1, 23); base58Prefixes[SCRIPT_ADDRESS] = std::vector(1, 125); base58Prefixes[SECRET_KEY] = std::vector(1, 151); base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container >(); base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container >(); convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main)); nLastPOWBlock = 201600; } virtual const CBlock& GenesisBlock() const { return genesis; } virtual Network NetworkID() const { return CChainParams::MAIN; } virtual const vector& FixedSeeds() const { return vFixedSeeds; } protected: CBlock genesis; vector vFixedSeeds; }; static CMainParams mainParams; // // Testnet // class CTestNetParams : public CMainParams { public: CTestNetParams() { // The message start string is designed to be unlikely to occur in normal data. // The characters are rarely used upper ASCII, not valid as UTF-8, and produce // a large 4-byte int at any alignment. pchMessageStart[0] = 0xfa; pchMessageStart[1] = 0xf4; pchMessageStart[2] = 0xfb; pchMessageStart[3] = 0xff; bnProofOfWorkLimit = CBigNum(~uint256(0) >> 16); vAlertPubKey = ParseHex("0471dc165db490094d35cde15b1f5d755fa6ad6f2b5ed0f340e3f17f57389c3c2af113a8cbcc885bde73305a553b5640c83021128008ddf882e856336269080496"); nDefaultPort = 25159; nRPCPort = 25715; strDataDir = "testnet"; // Modify the testnet genesis block so the timestamp is valid for a later start. genesis.nBits = bnProofOfWorkLimit.GetCompact(); genesis.nNonce = 216178; hashGenesisBlock = genesis.GetHash(); //assert(hashGenesisBlock == uint256("0x0000724595fb3b9609d441cbfb9577615c292abf07d996d3edabc48de843642d")); vFixedSeeds.clear(); vSeeds.clear(); base58Prefixes[PUBKEY_ADDRESS] = std::vector(1, 111); base58Prefixes[SCRIPT_ADDRESS] = std::vector(1, 196); base58Prefixes[SECRET_KEY] = std::vector(1, 239); base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container >(); base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container >(); convertSeed6(vFixedSeeds, pnSeed6_test, ARRAYLEN(pnSeed6_test)); nLastPOWBlock = 0x7fffffff; } virtual Network NetworkID() const { return CChainParams::TESTNET; } }; static CTestNetParams testNetParams; // // Regression test // class CRegTestParams : public CTestNetParams { public: CRegTestParams() { pchMessageStart[0] = 0xfa; pchMessageStart[1] = 0xf4; pchMessageStart[2] = 0xfb; pchMessageStart[3] = 0xff; bnProofOfWorkLimit = CBigNum(~uint256(0) >> 1); genesis.nTime = 1411111111; genesis.nBits = bnProofOfWorkLimit.GetCompact(); genesis.nNonce = 2; hashGenesisBlock = genesis.GetHash(); nDefaultPort = 25159; strDataDir = "regtest"; // assert(hashGenesisBlock == uint256("0x523dda6d336047722cbaf1c5dce622298af791bac21b33bf6e2d5048b2a13e3d")); vSeeds.clear(); // Regtest mode doesn't have any DNS seeds. } virtual bool RequireRPCPassword() const { return false; } virtual Network NetworkID() const { return CChainParams::REGTEST; } }; static CRegTestParams regTestParams; static CChainParams *pCurrentParams = &mainParams; const CChainParams &Params() { return *pCurrentParams; } void SelectParams(CChainParams::Network network) { switch (network) { case CChainParams::MAIN: pCurrentParams = &mainParams; break; case CChainParams::TESTNET: pCurrentParams = &testNetParams; break; case CChainParams::REGTEST: pCurrentParams = ®TestParams; break; default: assert(false && "Unimplemented network"); return; } } bool SelectParamsFromCommandLine() { bool fRegTest = GetBoolArg("-regtest", false); bool fTestNet = GetBoolArg("-testnet", false); if (fTestNet && fRegTest) { return false; } if (fRegTest) { SelectParams(CChainParams::REGTEST); } else if (fTestNet) { SelectParams(CChainParams::TESTNET); } else { SelectParams(CChainParams::MAIN); } return true; }