I am researching bitcoin/litecoin source.
I am trying to revise and start new block, create genesis block.
So I changed genesisOutputScript variable at chainparams.cpp 52 line, via [ cat genesiscoinbase.hex ]
and then changed below line's source like following..
pchMessageStart[2] = 0xb1;
pchMessageStart[3] = 0xde;
nDefaultPort = 2454;
nPruneAfterHeight = 100000;
genesis = CreateGenesisBlock(1518706741, 2084524493, 0x1e0ffff0, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());
printf("genesis.hashMerkleRoot = %s\n", genesis.hashMerkleRoot.ToString().c_str());
assert(consensus.hashGenesisBlock == uint256S("0xf333b8dff21df2ec0034590afa921a09e43ff41c5c8e5ac10cd83bf17615554d"));
assert(genesis.hashMerkleRoot == uint256S("0xc4ef14392acd1d6123ab6b4497601f2a164e50f5da77903dc7e2ad1a8fa25f2d"));
// Note that of those with the service bits flag, most only support a subset of possible options
vSeeds.emplace_back("something.something.com", true);
base58Prefixes[PUBKEY_ADDRESS] = std::vector(1, 55);
base58Prefixes[SCRIPT_ADDRESS] = std::vector(1, 55);
base58Prefixes[SCRIPT_ADDRESS2] = std::vector(1, 55);
base58Prefixes[SECRET_KEY] = std::vector(1,176);
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
vFixedSeeds = std::vector(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
fDefaultConsistencyChecks = false;
fRequireStandard = true;
fMineBlocksOnDemand = false;
checkpointData = (CCheckpointData) {
{
{ 0, uint256S("0x001")},
}
};
chainTxData = ChainTxData{
// Data as of block 59c9b9d3fec105bdc716d84caa7579503d5b05b73618d0bf2d5fa639f780a011 (height 1353397).
1518706741, // * UNIX timestamp of last known number of transactions
0, // * total number of transactions between genesis and that timestamp
// (the tx=... number in the SetBestChain debug.log lines)
0.06 // * estimated number of transactions per second after that timestamp
};
but after compile this with 'make' , then run ./litecoind ,
error says,
genesis.GetHash = f333b8dff21df2ec0034590afa921a09e43ff41c5c8e5ac10cd83bf17615554d
genesis.hashMerkleRoot = c4ef14392acd1d6123ab6b4497601f2a164e50f5da77903dc7e2ad1a8fa25f2d
Error: Error: A fatal internal error occurred, see debug.log for details
Segmentation fault (core dumped)
and here is debug.log file says,
2018-02-15 15:23:10 Litecoin version v0.15.1.0-845fc69ab-dirty
2018-02-15 15:23:10 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2018-02-15 15:23:10 Assuming ancestors of block 59c9b9d3fec105bdc716d84caa7579503d5b05b73618d0bf2d5fa639f780a011 have valid signatures.
2018-02-15 15:23:10 Setting nMinimumChainWork=00000000000000000000000000000000000000000000002ebcfe2dd9eff82666
2018-02-15 15:23:10 Using the 'standard' SHA256 implementation
2018-02-15 15:23:10 Using RdRand as an additional entropy source
2018-02-15 15:23:10 Default data directory /home/ubuntu/.litecoin
2018-02-15 15:23:10 Using data directory /home/ubuntu/.litecoin
2018-02-15 15:23:10 Using config file /home/ubuntu/.litecoin/litecoin.conf
2018-02-15 15:23:10 Using at most 125 automatic connections (1024 file descriptors available)
2018-02-15 15:23:10 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-02-15 15:23:10 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-02-15 15:23:10 Using 4 threads for script verification
2018-02-15 15:23:10 scheduler thread start
2018-02-15 15:23:10 HTTP: creating work queue of depth 16
2018-02-15 15:23:10 No rpcpassword set - using random cookie authentication
2018-02-15 15:23:10 Generated RPC authentication cookie /home/ubuntu/.litecoin/.cookie
2018-02-15 15:23:10 HTTP: starting 4 worker threads
2018-02-15 15:23:10 init message: Verifying wallet(s)...
2018-02-15 15:23:10 Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)
2018-02-15 15:23:10 Using wallet wallet.dat
2018-02-15 15:23:10 CDBEnv::Open: LogDir=/home/ubuntu/.litecoin/database ErrorFile=/home/ubuntu/.litecoin/db.log
2018-02-15 15:23:10 Cache configuration:
2018-02-15 15:23:10 * Using 2.0MiB for block index database
2018-02-15 15:23:10 * Using 8.0MiB for chain state database
2018-02-15 15:23:10 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-02-15 15:23:10 init message: Loading block index...
2018-02-15 15:23:10 Opening LevelDB in /home/ubuntu/.litecoin/blocks/index
2018-02-15 15:23:10 Opened LevelDB successfully
2018-02-15 15:23:10 Using obfuscation key for /home/ubuntu/.litecoin/blocks/index: 0000000000000000
2018-02-15 15:23:10 LoadBlockIndexDB: last block file = 0
2018-02-15 15:23:10 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2018-02-15 15:23:10 Checking all blk files are present...
2018-02-15 15:23:10 LoadBlockIndexDB: transaction index disabled
2018-02-15 15:23:10 Initializing databases...
2018-02-15 15:23:10 Pre-allocating up to position 0x1000000 in blk00000.dat
2018-02-15 15:23:10 Opening LevelDB in /home/ubuntu/.litecoin/chainstate
2018-02-15 15:23:10 Opened LevelDB successfully
2018-02-15 15:23:10 Wrote new obfuscate key for /home/ubuntu/.litecoin/chainstate: 926d8d907f958c5b
2018-02-15 15:23:10 Using obfuscation key for /home/ubuntu/.litecoin/chainstate: 926d8d907f958c5b
2018-02-15 15:23:10 init message: Rewinding blocks...
2018-02-15 15:23:10 block index 18ms
2018-02-15 15:23:10 init message: Loading wallet...
2018-02-15 15:23:10 nFileVersion = 150100
2018-02-15 15:23:10 Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total
2018-02-15 15:23:10 Performing wallet upgrade to 60000
2018-02-15 15:23:10 keypool added 2000 keys (1000 internal), size=2000 (1000 internal)
2018-02-15 15:23:10 keypool reserve 1
2018-02-15 15:23:10 keypool keep 1
2018-02-15 15:23:10 wallet 738ms
2018-02-15 15:23:10 keypool added 1 keys (0 internal), size=2000 (1000 internal)
2018-02-15 15:23:10 setKeyPool.size() = 2000
2018-02-15 15:23:10 mapWallet.size() = 0
2018-02-15 15:23:10 mapAddressBook.size() = 1
2018-02-15 15:23:10 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
2018-02-15 15:23:10 *** Failed to read block
2018-02-15 15:23:10 Error: Error: A fatal internal error occurred, see debug.log for details
So what is the problem? What am I missing? How to fix and can make my own genesis block?
Thanks.