## Before Mining Genesis Block

5

2

Im trying to make a test altcoin and I created the genesis block, merkle root and nonce. When I compile and run the daemon, The coin is trying to connect other IPs for hours so I can't mine the genesis block. I've changed P2P and RPC port.

Why is this happening ?

How many nodes are on your alt coin's network ? – dbkeys – 2014-10-09T12:36:27.843

4

You're supposed to run a 2nd daemon and let that one connect to the first one

2

2014 methods no longer work. 2017 Bitcoin / Litecoin codebase update http://practicecoin.com/index.php/2017/04/19/genesis-block/

Every cryptocurrency derived from Bitcoin has a Genesis Block, the very first block in the blockchain, whose creation is hard-coded into the full node code. In order to prove that it’s authentic, the usual rules about hashing the Merkle root and the Consensus information apply. So, one has to come up with some seriously magic numbers to put in the code.

The established technique, documented in all the coin cloning guides, involves setting the values to zero for the very first run, getting an error message and using the values displayed in the log file to fill into the source code. However, the section in the Bitcoin code that computes the required hashes for debug printing has been removed from the codebase prior to 0.9 release, around the very end of 2013. The story goes that it makes the chain more secure for miners, but I suspect the usual obfuscation by the developers.

The coins that have already been cloned prior to 2014, like Litecoin, and have running blockchains with the Genesis Block in place are not affected by this change. Neither are the more recent projects that are willing to work with a dated codebase. However, we have an ambitious goal of using the latest Litecoin code, due to all the security and performance improvements they merged in from Bitcoin, plus support for Segwit. So, we have a challenge of developing a method to compute the values on our own.

We could search for the original code or use an example of one, but it may well have to be ported over and debugged. There are several OSS standalone Genesis Block hashing programs in C, Go, and Python, that we’ll evaluate further.

1

have you set the testnet = 1 in the config file? You should first see if you are able to mine the genesis block on the testnet and then check on the real network.

You need to set the nonce in multiple places and same with the merkle root.

1

The default implementation won't let you mine if you're not connected to any peers (except for on the Regression Test network) because any blocks you mine wouldn't be able to be distributed. Check out miner.cpp::BitcoinMiner() (https://github.com/bitcoin/bitcoin/blob/v0.9.3/src/miner.cpp#L512-L517).

You may want to create your own artificial mining method, like MineGenesisBlock(), within chainparams.cpp, and run it in the initialization of each set of parameters. That way you won't have to turn mining on ('setgenerate true') to mine the genesis block.