Browse Source

WIP: started working on genesis block.

0.16.3-insta
Jianping Wu 6 years ago
parent
commit
479efb0e70
  1. 57
      src/chainparams.cpp
  2. 6
      src/util.cpp

57
src/chainparams.cpp

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <arith_uint256.h>
#include <chainparams.h>
#include <consensus/merkle.h>
@ -50,7 +51,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi @@ -50,7 +51,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
const char* pszTimestamp = "NY Times 05/Oct/2011 Steve Jobs, Apple’s Visionary, Dies at 56";
const CScript genesisOutputScript = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
const CScript genesisOutputScript = CScript() << ParseHex("049451c9ac3be691a4fa375ea69537a46ef374c1f454dbc7c2c6fe27b280f2b979991aadb29358591a1f72c326b537d7fd03e14d4978a1b57486d9e6d2c3645717") << OP_CHECKSIG;
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}
@ -121,6 +122,21 @@ public: @@ -121,6 +122,21 @@ public:
nPruneAfterHeight = 100000;
genesis = CreateGenesisBlock(1317972665, 2084524493, 0x1e0ffff0, 1, 50 * COIN);
//JW remove the following code!
arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
uint256 hashGenesisBlock = uint256S("0x01");
if (true && genesis.GetHash() != hashGenesisBlock) {
printf("recalculating params for mainnet.\n");
printf("old mainnet genesis nonce: %d\n", genesis.nNonce);
printf("old mainnet genesis hash: %s\n", hashGenesisBlock.ToString().c_str());
// deliberately empty for loop finds nonce value.
for(genesis.nNonce = 0; hashTarget < UintToArith256(genesis.GetHash()); genesis.nNonce++){}
printf("new mainnet genesis merkle root: %s\n", genesis.hashMerkleRoot.ToString().c_str());
printf("new mainnet genesis nonce: %d\n", genesis.nNonce);
printf("new mainnet genesis hash: %s\n", genesis.GetHash().ToString().c_str());
}
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2"));
assert(genesis.hashMerkleRoot == uint256S("0x97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9"));
@ -131,6 +147,7 @@ public: @@ -131,6 +147,7 @@ public:
vSeeds.emplace_back("dnsseed.litecointools.com");
vSeeds.emplace_back("dnsseed.litecoinpool.org");
vSeeds.emplace_back("dnsseed.koin-project.com");
vSeeds.clear(); //JW remove this!
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,48);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
@ -142,6 +159,7 @@ public: @@ -142,6 +159,7 @@ public:
bech32_hrp = "ltc";
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
vFixedSeeds.clear(); //JW remove this!
fDefaultConsistencyChecks = false;
fRequireStandard = true;
@ -218,14 +236,28 @@ public: @@ -218,14 +236,28 @@ public:
// By default assume that the signatures in ancestors of this block are valid.
consensus.defaultAssumeValid = uint256S("0x1efb29c8187d5a496a33377941d1df415169c3ce5d8c05d055f25b683ec3f9a3"); //612653
pchMessageStart[0] = 0xfd;
pchMessageStart[1] = 0xd2;
pchMessageStart[2] = 0xc8;
pchMessageStart[3] = 0xf1;
pchMessageStart[0] = 0x6a;
pchMessageStart[1] = 0xc6;
pchMessageStart[2] = 0x07;
pchMessageStart[3] = 0x9a;
nDefaultPort = 19335;
nPruneAfterHeight = 1000;
genesis = CreateGenesisBlock(1486949366, 293345, 0x1e0ffff0, 1, 50 * COIN);
//JW remove the following code!
arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
uint256 hashGenesisBlock = uint256S("0x01");
if (true && genesis.GetHash() != hashGenesisBlock) {
printf("recalculating params for mainnet.\n");
printf("old mainnet genesis nonce: %d\n", genesis.nNonce);
printf("old mainnet genesis hash: %s\n", hashGenesisBlock.ToString().c_str());
// deliberately empty for loop finds nonce value.
for(genesis.nNonce = 0; hashTarget < UintToArith256(genesis.GetHash()); genesis.nNonce++){}
printf("new mainnet genesis merkle root: %s\n", genesis.hashMerkleRoot.ToString().c_str());
printf("new mainnet genesis nonce: %d\n", genesis.nNonce);
printf("new mainnet genesis hash: %s\n", genesis.GetHash().ToString().c_str());
}
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x4966625a4b2851d9fdee139e56211a0d88575f59ed816ff5e6a63deb4e3e29a0"));
assert(genesis.hashMerkleRoot == uint256S("0x97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9"));
@ -236,6 +268,7 @@ public: @@ -236,6 +268,7 @@ public:
vSeeds.emplace_back("testnet-seed.litecointools.com");
vSeeds.emplace_back("seed-b.litecoin.loshan.co.uk");
vSeeds.emplace_back("dnsseed-testnet.thrasher.io");
vSeeds.clear(); // JWU remove this!
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
@ -312,6 +345,20 @@ public: @@ -312,6 +345,20 @@ public:
nPruneAfterHeight = 1000;
genesis = CreateGenesisBlock(1296688602, 0, 0x207fffff, 1, 50 * COIN);
//JW remove the following code!
arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
uint256 hashGenesisBlock = uint256S("0x01");
if (true && genesis.GetHash() != hashGenesisBlock) {
printf("recalculating params for mainnet.\n");
printf("old mainnet genesis nonce: %d\n", genesis.nNonce);
printf("old mainnet genesis hash: %s\n", hashGenesisBlock.ToString().c_str());
// deliberately empty for loop finds nonce value.
for(genesis.nNonce = 0; hashTarget < UintToArith256(genesis.GetHash()); genesis.nNonce++){}
printf("new mainnet genesis merkle root: %s\n", genesis.hashMerkleRoot.ToString().c_str());
printf("new mainnet genesis nonce: %d\n", genesis.nNonce);
printf("new mainnet genesis hash: %s\n", genesis.GetHash().ToString().c_str());
}
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x530827f38f93b43ed12af0b3ad25a288dc02ed74d6d7857862df51fc56c416f9"));
assert(genesis.hashMerkleRoot == uint256S("0x97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9"));

6
src/util.cpp

@ -583,7 +583,7 @@ fs::path GetDefaultDataDir() @@ -583,7 +583,7 @@ fs::path GetDefaultDataDir()
// Unix: ~/.bitcoin
#ifdef WIN32
// Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "Litecoin";
return GetSpecialFolderPath(CSIDL_APPDATA) / "Kevacoin";
#else
fs::path pathRet;
char* pszHome = getenv("HOME");
@ -593,10 +593,10 @@ fs::path GetDefaultDataDir() @@ -593,10 +593,10 @@ fs::path GetDefaultDataDir()
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
// Mac
return pathRet / "Library/Application Support/Litecoin";
return pathRet / "Library/Application Support/Kevacoin";
#else
// Unix
return pathRet / ".litecoin";
return pathRet / ".kevacoin";
#endif
#endif
}

Loading…
Cancel
Save