Skip to content

Instantly share code, notes, and snippets.

@moh53n
Created January 14, 2017 16:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save moh53n/de6b2b07002d5deea4aad05fa8fd059a to your computer and use it in GitHub Desktop.
Save moh53n/de6b2b07002d5deea4aad05fa8fd059a to your computer and use it in GitHub Desktop.
This code is from "http://dillingers.com/blog/2015/04/18/how-to-make-an-altcoin" with some changes for newer versions of Bitcoin. Use this for mine the genesis block for a new coin.
/**
* This code is from "http://dillingers.com/blog/2015/04/18/how-to-make-an-altcoin" with some changes for newer versions of Bitcoin.
* Use this for mine the genesis block for a new coin.
* Put this before "consensus.hashGenesisBlock = genesis.GetHash();"
*/
/////////GENESIS MINING///////////////
/*
printf("Genesis mining started\n");
genesis.nNonce = 0;
consensus.hashGenesisBlock = uint256S("0x001");
for(genesis.nNonce == 0; UintToArith256(genesis.GetHash()) > UintToArith256(consensus.powLimit); genesis.nNonce++){ }
printf("New genesis merkle root: %s\n", genesis.hashMerkleRoot.ToString().c_str());
printf("New genesis nonce: %lu\n", (unsigned long)genesis.nNonce);
printf("New genesis hash: %s\n", genesis.GetHash().ToString().c_str());
printf("Now replace the values, reComment the Genesis mining code and reCompile. \n");
*/
//////////////////////////////////////
@Jolly-Pirate
Copy link

You forgot to add #include <arith_uint256.h>, otherwise you get errors error: ‘UintToArith256’ was not declared in this scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment