Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GenesisCalculator - code to be included in chainparams.cpp to calculate the genesis block, nnonce, merkle root etc.
#include "arith_uint256.h"//Mod.
//----------------------------------------------------------------------------------------------------------
//Mod.
/*
// calcolo del Blocco Genesi
// Resettiamo il valore del blocco
consensus.hashGenesisBlock = uint256S("0x");
std::cout << std::string("Iniziamo a calcolare il blocco:\n");
if (true && (genesis.GetHash() != consensus.hashGenesisBlock)) {
LogPrintf("Calcolo del blocco genesi:\n");
arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
uint256 hash;
genesis.nNonce = 0;
while (UintToArith256(genesis.GetHash()) > hashTarget)
{
++genesis.nNonce;
if (genesis.nNonce == 0)
{
LogPrintf("NONCE WRAPPED, tempo di incremento");
std::cout << std::string("NONCE WRAPPED, tempo di incremento:\n");
++genesis.nTime;
}
if (genesis.nNonce % 10000 == 0)
{
LogPrintf("Mainnet: nonce %08u: hash = %s \n", genesis.nNonce, genesis.GetHash().ToString().c_str());
//std::cout << strNetworkID << " nonce: " << genesis.nNonce << " time: " << genesis.nTime << " hash: " << genesis.GetHash().ToString().c_str() << "\n";
}
}
std::cout << "Mainnet ---\n";
std::cout << " nonce: " << genesis.nNonce << "\n";
std::cout << " time: " << genesis.nTime << "\n";
std::cout << " hash: " << genesis.GetHash().ToString().c_str() << "\n";
std::cout << " merklehash: " << genesis.hashMerkleRoot.ToString().c_str() << "\n";
// Mainnet --- nonce: 296277 time: 1390095618 hash: 000000bdd771b14e5a031806292305e563956ce2584278de414d9965f6ab54b0
}
// std::cout << std::string("Finished calculating Mainnet Genesis Block:\n");
LogPrintf("Finished calculating Mainnet Genesis Block:\n");
// std::cout << "Mainnet ---\n";
// std::cout << " nonce: " << genesis.nNonce << "\n";
LogPrintf("nonce: %s\n",genesis.nNonce);
// std::cout << " time: " << genesis.nTime << "\n";
LogPrintf("time: %s\n", genesis.nTime);
// std::cout << " hash: " << genesis.GetHash().ToString().c_str() << "\n";
LogPrintf("hash: %s\n", genesis.GetHash().ToString().c_str());
// std::cout << " merklehash: " << genesis.hashMerkleRoot.ToString().c_str() << "\n";
LogPrintf("merkle hash: %s\n",genesis.hashMerkleRoot.ToString().c_str());
//----------------------------------------------------------------------------------------------------------
*/
LogPrintf("Merkle Root: %s\n", genesis.hashMerkleRoot.ToString().c_str());//Mod.
LogPrintf("Blocco Genesi: %s\n", consensus.hashGenesisBlock.ToString().c_str());//Mod.
@anewstarslot

This comment has been minimized.

Copy link
Owner Author

commented Jun 28, 2018

code to be included in chainparams.cpp to calculate the genesis block, nnonce, merkle root etc.

Baruzzo Omar Developing

@ricardofriba

This comment has been minimized.

Copy link

commented Sep 21, 2018

scrypt? or sha256?

@NicolasChoukroun

This comment has been minimized.

Copy link

commented Dec 2, 2018

Dash = X11 but should work with most Bitcoin clones.

@j4ys0n

This comment has been minimized.

Copy link

commented Dec 30, 2018

any idea if this will work with x16r (from ravencoin)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.