What I did so far:
Change pszTimestamp to a sentence from newspaper
change block.nTime to current time
compile
run compiled source with -testnet -noirc
now u see some lines and a crash
b115383690ee67ebeef9a7e754342638cd7bbf488561998e6d1bc1ed367484f6 // Block derived from pszTimestamp
b8fa883689f099d3942ff73439d9f55d60a5e257b0d69a8f0f6ab4572ecff415 // Genesisblock (invalid cuz its already coded wrong)
bd58bf217abb76059de07dc519f6c3dcdf5b1a7bb9219a66d24205e08f3716f9 // MerkleRoot (Valid because its newly calculated
corresponding to code:
//// debug print
printf("%s\n", block.GetHash().ToString().c_str());
printf("%s\n", hashGenesisBlock.ToString().c_str());
printf("%s\n", block.hashMerkleRoot.ToString().c_str());
assert(block.hashMerkleRoot == uint256("0xbd58bf217abb76059de07dc519f6c3dcdf5b1a7bb9219a66d24205e08f3716f9"));
update main.cpp with the mentioned merkleroot (it crashed because of the last assert) and run again
you should have already changed the false to true in
// If genesis block hash does not match, then generate new genesis hash.
if (true && block.GetHash() != hashGenesisBlock)
so it will find a genesis block for your string
after a long time you get:
nonce 003C1000: hash = e8525d8ae8a74a33dbc4b06a64c97ced84dfd29628b3e9e4197c7030cc4a09d3 (target = 00000ffff0000000000000000000000000000000000000000000000000000000)
block.nTime = 1367704866
block.nNonce = 3939341
block.GetHash = fafdbfc957ea6867a0743ff80c4ae126c7dd9fa82057255228a4d58f6ccfdf33
CBlock(hash=fafdbfc957ea6867a074, PoW=000000b1398554a520b5, ver=1, hashPrevBlock=00000000000000000000, hashMerkleRoot=bd58bf217a, nTime=1367704866, nBits=1e0ffff0, nNonce=3939341, vtx=1)
CTransaction(hash=bd58bf217a, ver=1, vin.size=1, vout.size=1, nLockTime=0)
CTxIn(COutPoint(0000000000, -1), coinbase 04ffff001d01043741442e6e6c20342f352042657672696a64696e6773646167207a6f6e6e69672c20646161726e61206f6f6b207a6f6d657273207761726d)
CTxOut(error)
vMerkleTree: bd58bf217a
xx: main.cpp:2070: bool LoadBlockIndex(bool): Assertion `block.GetHash() == hashGenesisBlock' failed.
Aborted (core dumped)
Now you have the valid Genesisblock and nNonce:
block.nNonce = 3939341
block.GetHash = fafdbfc957ea6867a0743ff80c4ae126c7dd9fa82057255228a4d58f6ccfdf33
Update your code with these values and your ready to go!
Complied & got following error...
root@PC:~/Desktop/litecoin-master-0.8/src# ABCcoind -testnet -noirc -debug -debugnet
ABCcoind: main.cpp:2820: bool InitBlockIndex(): Assertion `block.hashMerkleRoot == uint256("0x")' failed.
Aborted (core dumped)
in Test folder "debug.log" file
2014-02-25 19:40:36 ABCcoin version v0.8.6.2-g85f303d-beta ()
2014-02-25 19:40:36 Using OpenSSL version OpenSSL 1.0.1e 11 Feb 2013
2014-02-25 19:40:36 Default data directory /home/user/.ABCcoin
2014-02-25 19:40:36 Using data directory /home/user/.ABCcoin
2014-02-25 19:40:36 Using at most 125 connections (1024 file descriptors available)
2014-02-25 19:40:36 Using 3 threads for script verification
2014-02-25 19:40:36 init message: Verifying wallet...
2014-02-25 19:40:36 dbenv.open LogDir=/home/user/.ABCcoin/database ErrorFile=/home/user/.ABCcoin/db.log
2014-02-25 19:40:36 Bound to [::]:2095
2014-02-25 19:40:36 Bound to 0.0.0.0:2095
2014-02-25 19:40:36 init message: Loading block index...
2014-02-25 19:40:36 Opening LevelDB in /home/user/.ABCcoin/blocks/index
2014-02-25 19:40:36 Opened LevelDB successfully
2014-02-25 19:40:36 Opening LevelDB in /home/user/.ABCcoin/chainstate
2014-02-25 19:40:36 Opened LevelDB successfully
2014-02-25 19:40:36 LoadBlockIndexDB(): last block file = 0
2014-02-25 19:40:36 LoadBlockIndexDB(): transaction index disabled
2014-02-25 19:40:36 Initializing databases...
2014-02-25 19:40:36 76f8df0283035323c583d14526d80fa06c22d8bfc0a4c564aa0e6549f4fbc4f5
2014-02-25 19:40:36 0000000000000000000000000000000000000000000000000000000000000000
2014-02-25 19:40:36 1eecade19537e2891642e0995c119941d4dcf384b60ae013fcadf7b97a8cd5a9
I even deleted Complied, change block.nTime, same output on screen & debug values also same. What could be wrong?