I've been trying to fork the cryptocurrency Clams for about a week now. All of my code is correct to the coin's specifications, but I've been stuck on the creation of the blockchain. The developers have removed the code involving the genesis block and there doesn't seem to be any way for me to generate the PoS genesis block. If anyone has any experience with PoS coins, I would appreciate any advice incredibly. Thank you.
Quick and dirty solution? Use their own initial hash.
how to To create a genesis block
Delete Both Main Merkle & Genesis Merkle (example)
Main genesis block
static const uint256 hashGenesisBlock("0x000004611c87517dfd29fe7f34bd6da2e1ad3d305ac12afe80a3229069390f68");
static const uint256 hashGenesisBlock("");
static const uint256 hashGenesisBlockTestNet("0x000004611c87517dfd29fe7f34bd6da2e1ad3d305ac12afe80a3229069390f68");
static const uint256 hashGenesisBlockTestNet("");
Change this to your Timestamp wanted
const char* pszTimestamp = "Blockchain.info Block #312427 2014-07-25 14:15:16";
Change these both to your Epoch Time wanted //Unixtime check google
txNew.nTime = 1406297716; (example) (example) block.nTime = 1406297716; (example) (example) (example)
Change these to 0
block.nNonce = !fTestNet ? 190271 : 190271; (example) (example) (example)
Change this to say true
if (false && (block.GetHash() != hashGenesisBlock))
if (true && (block.GetHash() != hashGenesisBlock))
Delete the Merkle root
assert(block.hashMerkleRoot == uint256("0xc9c8f6250a60dc79038b9ae68ff747488ac80d4a2db0b194cf49628495448d21"));
assert(block.hashMerkleRoot == uint256(""));
Now Compile the Wallet, and let it crash. as next you find on the debug file the Merkle Root/Hash replace it into the blank space from you step before. but make sure that you have to add to the beginning 0x just compare and undo the steps with the new infos.
Save the Main.cpp with the New
hashMerkleRoot added by you.
and recompile. then start again and let the wallet crash
one more time like before. visit again the debug log
and replace other infos.
you find in the debug
block.nNonce you remind that you remove that before.
and the Genesis/Block Hash .. you remind you delete this as first.
copy and paste into the free space inside the Main.h and add 0x on the beginning too.
That's it. Save all files and compile one more time. and you are a Coin Developer :-)
You can get original blockchain (curracy that you fork) and read genesis block. Then you can see what happens there and maybe you will find bug in the code faster.