Bitcoin Forum
June 01, 2024, 03:24:39 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Generic genesis block miner  (Read 50 times)
DarkArrow (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
May 22, 2021, 04:07:47 PM
 #1

Hi, I'm trying to create the genesis block for an altcoin that has a different hashing algorithm (can't use GenesisH0). I found a snippet (see below) and tested it on the litecoin code, but it doesn't work, the hashes are wrong and the litecoind crashes with a segfault. And if I try with -reindex, I get a
Code:
AcceptBlock: high-hash, proof of work failed


Is there a better generic solution that works for any altcoin no matter what hashing algo it uses? Preferably something like that gist I pasted, that can be done within chainparams.cpp. Thanks.

https://gist.github.com/moh53n/de6b2b07002d5deea4aad05fa8fd059a
Code:
        /**
        * 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");
        */
        //////////////////////////////////////
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!