Post
Topic
Board Altcoin Discussion
Re: The genesis block is hurting my soul.. Please help [25 MegaCoin bounty]
by
Cryptokk
on 11/03/2014, 10:24:00 UTC
Hi,

didn't read all the thread. But this will help you with Litecoin clients:

(this work only if you already did the basis (=change your timestamp, ntime, ect...) and ready to mine your merkle/genesis.)

- Open main.cpp
- Go to "bool InitBlockIndex()"
- Search "block.print();"
- ABOVE, you copy this:

Code:
// This part was used to generate the genesis block.
// Uncomment to use it again.

// If genesis block hash does not match, then generate new genesis hash.
if (true && block.GetHash() != hashGenesisBlock)
{
printf("Searching for genesis block...\n");
// This will figure out a valid hash and Nonce if you're
// creating a different genesis block:
uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
uint256 thash;
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
loop
{
#if defined(USE_SSE2)
// Detection would work, but in cases where we KNOW it always has SSE2,
// it is faster to use directly than to use a function pointer or conditional.
#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
// Always SSE2: x86_64 or Intel MacOS X
scrypt_1024_1_1_256_sp_sse2(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
#else
// Detect SSE2: 32bit x86 Linux or Windows
scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
#endif
#else
// Generic scrypt
scrypt_1024_1_1_256_sp_generic(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
#endif
if (thash <= hashTarget)
break;
if ((block.nNonce & 0xFFF) == 0)
{
printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
}
++block.nNonce;
if (block.nNonce == 0)
{
printf("NONCE WRAPPED, incrementing time\n");
++block.nTime;
}
}
printf("block.nTime = %u \n", block.nTime);
printf("block.nNonce = %u \n", block.nNonce);
printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
}

This is a script that doing all the annoying job for you.
How to use it ?

- First you need to empty your merkleroot, genesis and nnonce (merkle = "0x", genesis="0x", nonce=0.
- Then you compil and start the client.
- The client will show an error but show the merkleroot.
- Now change you merkle root variable for your new one.
- Compil again and start again.
- Your client will try to mine your genesis block, this operation can be very fast as she can be very slow.
- After this, the client will show again an error but give you the genesis (gethash) and nonce.
- reopen your client script, change the genesis and nonce (and verify your ntime).
- REMOVE the script I gave you (or comment).
- Compil and enjoy Wink

I don't know if someone got the bounty, but i'm not looking after, just helping =)