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 examples of different versions, 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.
Will keep you posted as to which route we actually took. Will also cover how to pick an address letter, and how to deal with Checkpoints and Version bits.
I created a Helium-branded clone of Dash (which is a 0.10 clone) for coins101 and I left the genesis block calculator in place ready for when the values are decided:
https://github.com/gjhiggins/dash/blob/ac1da11dfdad85f9e1bcd514233ce9d966128524/src/chainparams.cpp#L94
0.10 is now getting a bit elderly but, given the serious nature of the prior vulnerabilities that were fixed in 0.10, it is the earliest version that can responsibly be considered suitable for contemporary use.
Cheers
Graham
Very nice looking, Graham! Is coins101 a project similar to this I wonder?
Yarko
Graham, that’s great, to have the Genesis block calculator back in place. I’m going to do the same for the Practice Coin project. Eventually…
Tearo