Very easy Debug Qtum to find genesis block hash
Please review my video
Like and sub me for more video
Thank
https://www.youtube.com/watch?v=5rqiGruTe4E
git clone https://github.com/qtumproject/qtum --recursive
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");// Start
https://en.bitcoin.it/wiki/List_of_address_prefixes
58 Q
70-71 V
132-133 v
############################## Make publickey ##################################
openssl ecparam -genkey -name secp256k1 -out genesiscoinbase.pem
openssl ec -in genesiscoinbase.pem -text > genesiscoinbase.hex
################################################################
date +%s
############################## Genesis hash Debug ##################################
File src/chainparams.cpp
Add before
/**
* Main network
*/
#######################
static void MineGenesis(CBlockHeader& genesisBlock, const uint256& powLimit, bool noProduction)
{
if(noProduction)
genesisBlock.nTime = std::time(0);
genesisBlock.nNonce = 0;
LogPrintf("NOTE: Genesis nTime = %u \n", genesisBlock.nTime);
LogPrintf("WARN: Genesis nNonce (BLANK!) = %u \n", genesisBlock.nNonce);
arith_uint256 besthash;
memset(&besthash,0xFF,32);
arith_uint256 hashTarget = UintToArith256(powLimit);
LogPrintf("Target: %s\n", hashTarget.GetHex().c_str());
arith_uint256 newhash = UintToArith256(genesisBlock.GetHash());
while (newhash > hashTarget) {
genesisBlock.nNonce++;
if (genesisBlock.nNonce == 0) {
LogPrintf("NONCE WRAPPED, incrementing time\n");
++genesisBlock.nTime;
}
// If nothing found after trying for a while, print status
if ((genesisBlock.nNonce & 0xfff) == 0)
LogPrintf("nonce %08X: hash = %s (target = %s)\n",
genesisBlock.nNonce, newhash.ToString().c_str(),
hashTarget.ToString().c_str());
if(newhash < besthash) {
besthash = newhash;
LogPrintf("New best: %s\n", newhash.GetHex().c_str());
}
newhash = UintToArith256(genesisBlock.GetHash());
}
LogPrintf("Genesis nTime = %u \n", genesisBlock.nTime);
LogPrintf("Genesis nNonce = %u \n", genesisBlock.nNonce);
LogPrintf("Genesis nBits: %08x\n", genesisBlock.nBits);
LogPrintf("Genesis Hash = %s\n", newhash.ToString().c_str());
LogPrintf("Genesis hashStateRoot = %s\n", genesisBlock.hashStateRoot.ToString().c_str());
LogPrintf("Genesis Hash Merkle Root = %s\n", genesisBlock.hashMerkleRoot.ToString().c_str());
}
#######################
####################### 1. Mainnet #######################
Find and replace
#######################
genesis = CreateGenesisBlock(1504695029, 8026361, 0x1f00ffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x000075aef83cf2853580f8ae8ce6f8c3096cfa21d98334d6e3f95e5582ed986c"));
assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
#######################
with
#######################
//Debug Mainnet
startNewChain = true;
genesis = CreateGenesisBlock(1506211200, 0, 0x1f00ffff, 1, 50 * COIN);// Change time and set nonce =0
if (startNewChain)
MineGenesis(genesis, consensus.powLimit, false);
//genesis = CreateGenesisBlock(1504695029, 8026361, 0x1f00ffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
//assert(consensus.hashGenesisBlock == uint256S("0x000075aef83cf2853580f8ae8ce6f8c3096cfa21d98334d6e3f95e5582ed986c"));
//assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
LogPrintf("Main Genesis nTime = %u \n", genesis.nTime);
LogPrintf("Main Genesis nNonce = %u \n", genesis.nNonce);
LogPrintf("Main Genesis nBits: %08x\n", genesis.nBits);
LogPrintf("Main Genesis Hash = %s\n", genesis.GetHash().ToString().c_str());
LogPrintf("Main Genesis hashStateRoot = %s\n", genesis.hashStateRoot.ToString().c_str());
LogPrintf("Main Genesis Hash Merkle Root = %s\n", genesis.hashMerkleRoot.ToString().c_str());
//End Debug Mainnet
####################### 2. Testnet #######################
Find and replace
#######################
genesis = CreateGenesisBlock(1504695029, 7349697, 0x1f00ffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x0000e803ee215c0684ca0d2f9220594d3f828617972aad66feb2ba51f5e14222"));
assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
#######################
with
#######################
//Debug Testnet
startNewChain = true;
genesis = CreateGenesisBlock(1645276728, 0, 0x1f00ffff, 1, 50 * COIN);// Change time and set nonce =0
if (startNewChain)
MineGenesis(genesis, consensus.powLimit, false);
//genesis = CreateGenesisBlock(1504695029, 7349697, 0x1f00ffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
//assert(consensus.hashGenesisBlock == uint256S("0x0000e803ee215c0684ca0d2f9220594d3f828617972aad66feb2ba51f5e14222"));
//assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
LogPrintf("Test Genesis nTime = %u \n", genesis.nTime);
LogPrintf("Test Genesis nNonce = %u \n", genesis.nNonce);
LogPrintf("Test Genesis nBits: %08x\n", genesis.nBits);
LogPrintf("Test Genesis Hash = %s\n", genesis.GetHash().ToString().c_str());
LogPrintf("Test Genesis hashStateRoot = %s\n", genesis.hashStateRoot.ToString().c_str());
LogPrintf("Test Genesis Hash Merkle Root = %s\n", genesis.hashMerkleRoot.ToString().c_str());
//End Debug Testnet
####################### 3. Regtest #######################
Find and replace
#######################
genesis = CreateGenesisBlock(1504695029, 17, 0x207fffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x665ed5b402ac0b44efc37d8926332994363e8a7278b7ee9a58fb972efadae943"));
assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
#######################
with
#######################
//Debug Regtest
startNewChain = true;
genesis = CreateGenesisBlock(1506211200, 17, 0x207fffff, 1, 50 * COIN);// Change time and set nonce = any number
if (startNewChain)
MineGenesis(genesis, consensus.powLimit, false);
//genesis = CreateGenesisBlock(1504695029, 17, 0x207fffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
//assert(consensus.hashGenesisBlock == uint256S("0x665ed5b402ac0b44efc37d8926332994363e8a7278b7ee9a58fb972efadae943"));
//assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
LogPrintf("Reg Genesis nTime = %u \n", genesis.nTime);
LogPrintf("Reg Genesis nNonce = %u \n", genesis.nNonce);
LogPrintf("Reg Genesis nBits: %08x\n", genesis.nBits);
LogPrintf("Reg Genesis Hash = %s\n", genesis.GetHash().ToString().c_str());
LogPrintf("Reg Genesis hashStateRoot = %s\n", genesis.hashStateRoot.ToString().c_str());
LogPrintf("Reg Genesis Hash Merkle Root = %s\n", genesis.hashMerkleRoot.ToString().c_str());
//End Debug Regtest
##############################################
File src/chainparams.h
Add below
bool startNewChain;
before
CCheckpointData checkpointData;
############################### Build your debug chain #################################
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git cmake libboost-all-dev libgmp3-dev
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler qrencode
./autogen.sh
./configure
make -j4
#### Take 20-30 min to complete ####
cd src/qt
./qtum-qt
qtum-qt: validation.cpp:1639: void InvalidChainFound(CBlockIndex*): Assertion `tip' failed.
Aborted (core dumped)
############################## Find genesis hash, nonce debug.log ##################################
Ctr H
View hidden file and folder
############## MainNet Find ##############
2022-02-19T14:16:06Z Main Genesis nTime = 1645278122
2022-02-19T14:16:06Z Main Genesis nNonce = 35110
2022-02-19T14:16:06Z Main Genesis nBits: 1f00ffff
2022-02-19T14:16:06Z Main Genesis Hash = 00007c13b508f80a556139c390a06ee51e59ecd9246e03bf00acac4299a508b0
2022-02-19T14:16:06Z Main Genesis hashStateRoot = 9514771014c9ae803d8cea2731b2063e83de44802b40dce2d06acd02d0ff65e9
2022-02-19T14:16:06Z Main Genesis Hash Merkle Root = 49e2dd855ad104b945cd2f6980d7d69d0470bc69646dbdb77a275b4196f7a55f
############## TestNet Find ##############
2022-02-19T14:16:06Z Test Genesis nTime = 1645278327
2022-02-19T14:16:06Z Test Genesis nNonce = 13721
2022-02-19T14:16:06Z Test Genesis nBits: 1f00ffff
2022-02-19T14:16:06Z Test Genesis Hash = 00008067af1d36cacf194d0f0508ee0f58371314b84e21cbf4ec3d60f1f4cc2c
2022-02-19T14:16:06Z Test Genesis hashStateRoot = 9514771014c9ae803d8cea2731b2063e83de44802b40dce2d06acd02d0ff65e9
2022-02-19T14:16:06Z Test Genesis Hash Merkle Root = 49e2dd855ad104b945cd2f6980d7d69d0470bc69646dbdb77a275b4196f7a55f
############## RegTest Find ##############
2022-02-19T14:16:06Z Reg Genesis nTime = 1645278420
2022-02-19T14:16:06Z Reg Genesis nNonce = 1
2022-02-19T14:16:06Z Reg Genesis nBits: 207fffff
2022-02-19T14:16:06Z Reg Genesis Hash = 71b2f068167ce06588cb167d10acbffc4e069ab6172fc5db6c24e3e83e10e1b9
2022-02-19T14:16:06Z Reg Genesis hashStateRoot = 9514771014c9ae803d8cea2731b2063e83de44802b40dce2d06acd02d0ff65e9
2022-02-19T14:16:06Z Reg Genesis Hash Merkle Root = 49e2dd855ad104b945cd2f6980d7d69d0470bc69646dbdb77a275b4196f7a55f
############################## Change back your chainparams.cpp with new info ##################################
Remove //Debug Mainnet
Remove //Debug Testnet
Remove //Debug Regtest
############################## Change back your chainparams.h ##################################
src/chainparams.h
Remove
bool startNewChain;
############################### Build your new chain #################################
cd ../..
make -j4
cd src/qt
./qtum-qt
Now you completed fork Qtum for new chain
Let check
Have Fun
Good luck!