Bitcoin Forum
June 15, 2024, 03:42:12 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 »  All
  Print  
Author Topic: The genesis block is hurting my soul.. Please help [25 MegaCoin bounty]  (Read 11717 times)
CryptoMine (OP)
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
December 30, 2013, 04:55:50 PM
 #1

I am always one to Google/Search forums until I find the answer, but after 10 hours of trying, I have come to the forums to get an answer.

I am modifying the new Litecoin script (for educational reasons) here: https://github.com/litecoin-project/litecoin

For the life of me, I am unable to generate a genesis block, I keep getting:

Code:
main.cpp:2796: bool InitBlockIndex(): Assertion `hash == hashGenesisBlock' failed.

I check my debug.log file and get:

Code:
2013-12-30 04:03:26 84d3cf22c9d4a4cbda424fc0e5a7169f33780395039b3959fec424649d690d07
2013-12-30 04:03:26 f5ae71e26c74beacc88382716aced69cddf3dffff24f384e1808905e0188f68f
2013-12-30 04:03:26 b6580b90a6dd4b1169d76f034d408cdaa07f44e653bca4da0cd4216d8b22cc0d
2013-12-30 04:03:26 CBlock(hash=84d3cf22c9d4a4cbda424fc0e5a7169f33780395039b3959fec424649d690d07, input=0100000000000000000000000000000000000000000000000000000000000000000000000dcc228b6d21d40cdaa4bc53e6447fa0da8c404d036fd769114bdda6900b58b6f6028c4ef0ff0f1e00000000, PoW=7cf4e4a52ed1ba6569c2d9a9f50a8f1e4ac4c2064408de1e20c5292da185cd8c, ver=1, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=b6580b90a6dd4b1169d76f034d408cdaa07f44e653bca4da0cd4216d8b22cc0d, nTime=1317798646, nBits=1e0ffff0, nNonce=0, vtx=1)
2013-12-30 04:03:26   CTransaction(hash=b6580b90a6dd4b1169d76f034d408cdaa07f44e653bca4da0cd4216d8b22cc0d, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 04ffff001d01043a54686520477561726469616e20312f31322f3133204d6972616e6461204861727420486f7720746f2073757276697665204368726973746d6173)
    CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4)
  vMerkleTree: b6580b90a6dd4b1169d76f034d408cdaa07f44e653bca4da0cd4216d8b22cc0d

Which doesn't give me:

block.nTime = X
block.nNonce = X
block.GetHash = X

As mentioned https://bitcointalk.org/index.php?topic=189350.msg2035449#msg2035449 and many other forums I have visited in the past 10hrs

I am inserting the hashMerkleRoot, block.nTime and block.nBits in correctly (after generating the hashMerkleRoot from debug.log) but after I try to run the daemon (or testnet) I am getting that same error.

Any ideas?
elbandi
Hero Member
*****
Offline Offline

Activity: 525
Merit: 529


View Profile
December 30, 2013, 05:24:39 PM
 #2

Hi,

This is your genesis block hash:
Quote
2013-12-30 04:03:26 84d3cf22c9d4a4cbda424fc0e5a7169f33780395039b3959fec424649d690d07

Put that to this line:
Quote

This is your merkleroot:
Quote
2013-12-30 04:03:26 b6580b90a6dd4b1169d76f034d408cdaa07f44e653bca4da0cd4216d8b22cc0d

Put that to this line:
Quote

After if you get somethink like this:
Quote
CheckProofOfWork() : hash doesn't match nBits

This genesis block is not good, because doest fit for start difficulty.
need a new one. Put this source code before this line (block.print()):
Quote

run the app, this will "mine" a new genesis block (need lot of time!!) for you.
 if it's founded, modify your source: nNonce, nTime and the new hash (GetHash = XX) for genesis block hash.

you can remove the inserted code, and you have a new altcoin  Wink

(if you want a testnet genesis block, do the same and dont forget to start with -testnet, and modify the testnet nNonce, nTime and hash!)

Elbandi
CryptoMine (OP)
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
December 30, 2013, 05:34:06 PM
 #3

Thanks you! I've regained my sanity!

That worked perfectly! and I'm sure this will help other people too!!

Please PM me your MegaCoin Wallet ID and I will send you the bounty Smiley
Sharrow
Member
**
Offline Offline

Activity: 66
Merit: 10


View Profile
December 31, 2013, 07:46:54 PM
 #4

Thanks for this info too, dude.

I'm testing a coin (strictly for humanitarian issues) using different source code and the error was almost the same. From your info, it seems the genesis hash in debug.log was on a different line to the expected value. The main VPS server is working fine but the log file is busy so I'm expecting trouble soon.
Sharrow
Member
**
Offline Offline

Activity: 66
Merit: 10


View Profile
December 31, 2013, 09:37:56 PM
 #5

In response to my previous post, there seems to be something unusual in the genesis block that was shown in debug.log on my main Linux server. The hash shown in the log files doesn't seem to be the final genesis hash.

To cut a long story short, the debug.log showed what looked to be THE genesis hash but testcoind must've still been running in the background, creating the actual genesis hash, which no doubt I killed the process when recompiling the files.

Basically... if you come across this, make sure you leave your /whatevercoind to process its genesis hash uninterrupted. The only way if found out (the second time around) on the Linux VPS server was when trying to transfer the coin's directory using sudo cp testcoind /usr/bin/testcoind. The message saying "Text file busy" suggests that something is going on in the background. It's been running for 4 hours now; apparently it took 6 days on the Bitcoin creators original run  Shocked
roundrobin
Full Member
***
Offline Offline

Activity: 203
Merit: 100


View Profile
January 02, 2014, 05:20:16 AM
 #6

I too have been messing around with the Litecoin 0.8.6.1 sources for fun and insight, but I can't get litecoind to work after it has created a genesis block...

I start with an empty ~/.litecoin dir - no blocks, no chainstate, no database. I have set the start difficulty to ">> 24", nNonce to 0, nBits is the default 0x1e0ffff0, I have set nTime and written a timestamp message. I run litecoind to get the correct MerkleRoot for my timestamp message and then I enable the genesis block generation and start litecoind again, and it begins mining a genesis block which when done ends with this message:

Code:
litecoind: main.cpp:2833: bool InitBlockIndex(): Assertion `hash == hashGenesisBlock' failed.

In debug.log I see that I successfully mined a block, so I set the new nNonce and genesis block hash - both nTime and nBits stay the same for some reason - and then I start litecoind again but only this happens:

Code:
Error: Failed to read block
: Error initializing block database.

Do you want to build the block database now?

And if I start again:

Code:
Error: Failed to read block
Error: Failed to connect best block

The debug log reveals this:

Code:
2014-01-01 15:13:35 Opened LevelDB successfully
2014-01-01 15:13:35 LoadBlockIndexDB(): last block file = 0
2014-01-01 15:13:35 LoadBlockIndexDB(): last block file info: CBlockFileInfo(blocks=1, size=281, heights=
0...0, time=2014-01-01...2014-01-01)
2014-01-01 15:13:35 LoadBlockIndexDB(): transaction index disabled
2014-01-01 15:13:35 init message: Verifying blocks...
2014-01-01 15:13:35  block index              41ms
2014-01-01 15:13:35 init message: Loading wallet...
2014-01-01 15:13:35 nFileVersion = 80601
2014-01-01 15:13:35  wallet                  534ms
2014-01-01 15:13:35 ERROR: CheckProofOfWork() : nBits below minimum work
2014-01-01 15:13:35 ERROR: CBlock::ReadFromDisk() : errors in block header
2014-01-01 15:13:35 *** Failed to read block
2014-01-01 15:13:35 Error: Failed to read block

Anyone who had the same problem and managed to solve it?

   LTC: Lbha3tRmE75oHfF4SjSKpxVK2fY9PxrPUX         VTC: VguAuTdGRcQzihEgrJDYPYUuugGMMGFCNn
   FTC: 6fVWQ3eHhhgH1haqThQbxTFV8XjrqyuKY2          SOL: 8X6dLCY8MeZ6RNdBxzYQkd5kxWj8VVPJmL
DOGE: DMBQta9ME9cWnRPVXtEbi57CDk1uNpwzSh
elbandi
Hero Member
*****
Offline Offline

Activity: 525
Merit: 529


View Profile
January 02, 2014, 09:38:26 AM
 #7

empty ~/.litecoin dir!
roundrobin
Full Member
***
Offline Offline

Activity: 203
Merit: 100


View Profile
January 02, 2014, 12:36:38 PM
 #8

empty ~/.litecoin dir!

That gives the exact same results :/

First it rebuilds the database, I see in the debug.log that it makes an accepted transaction to the blockchain, but then it fails reading/verifying the block.

debug.log:

Code:
...
2014-01-02 12:31:37 keypool added key 98, size=98
2014-01-02 12:31:37 keypool added key 99, size=99
2014-01-02 12:31:37 keypool added key 100, size=100
2014-01-02 12:31:37 keypool added key 101, size=101
2014-01-02 12:31:37 keypool reserve 1
2014-01-02 12:31:37 keypool keep 1
2014-01-02 12:31:37  wallet                 1266ms
2014-01-02 12:31:37 ERROR: CheckProofOfWork() : nBits below minimum work
2014-01-02 12:31:37 ERROR: CBlock::ReadFromDisk() : errors in block header
2014-01-02 12:31:37 *** Failed to read block
2014-01-02 12:31:37 Error: Failed to read block
2014-01-02 12:31:37 init message: Loading addresses...
2014-01-02 12:31:37 Loaded 0 addresses from peers.dat  0ms
2014-01-02 12:31:37 Error: Failed to connect best block

   LTC: Lbha3tRmE75oHfF4SjSKpxVK2fY9PxrPUX         VTC: VguAuTdGRcQzihEgrJDYPYUuugGMMGFCNn
   FTC: 6fVWQ3eHhhgH1haqThQbxTFV8XjrqyuKY2          SOL: 8X6dLCY8MeZ6RNdBxzYQkd5kxWj8VVPJmL
DOGE: DMBQta9ME9cWnRPVXtEbi57CDk1uNpwzSh
roundrobin
Full Member
***
Offline Offline

Activity: 203
Merit: 100


View Profile
January 02, 2014, 12:42:31 PM
 #9

I have found the problem. It does not like that I change the minimum network difficulty (bnProofOfWorkLimit). As soon as I restore it to the defauld ">> 20" (which is 1/4096), it works perfectly! I've tried to find where else the default value may be set and tested for verification, but I can't locate it. Any ideas?

   LTC: Lbha3tRmE75oHfF4SjSKpxVK2fY9PxrPUX         VTC: VguAuTdGRcQzihEgrJDYPYUuugGMMGFCNn
   FTC: 6fVWQ3eHhhgH1haqThQbxTFV8XjrqyuKY2          SOL: 8X6dLCY8MeZ6RNdBxzYQkd5kxWj8VVPJmL
DOGE: DMBQta9ME9cWnRPVXtEbi57CDk1uNpwzSh
nocoin
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
January 02, 2014, 12:45:19 PM
 #10

I have found the problem. It does not like that I change the minimum network difficulty (bnProofOfWorkLimit). I've tried to find where else the default value of ">> 20" (1/4096) may be set and tested for verification, but I can't locate it. Any ideas?
(geneses)block.nBits
https://en.bitcoin.it/wiki/Difficulty
elbandi
Hero Member
*****
Offline Offline

Activity: 525
Merit: 529


View Profile
January 02, 2014, 12:58:50 PM
 #11

I have found the problem. It does not like that I change the minimum network difficulty (bnProofOfWorkLimit). As soon as I restore it to the defauld ">> 20" (which is 1/4096), it works perfectly! I've tried to find where else the default value may be set and tested for verification, but I can't locate it. Any ideas?
ah, if you increase the minimum network difficulty, you have to calculate the right nBits for genesis block.
maybe you can try this:
Code:
printf("min nBit:  %08x\n", bnProofOfWorkLimit.GetCompact());
after this:
Code:
        printf("%s\n", hash.ToString().c_str());
        printf("%s\n", hashGenesisBlock.ToString().c_str());
        printf("%s\n", block.hashMerkleRoot.ToString().c_str());
this will print a hex value, set this to block.nBits.

and gen a new GenesisBlock hash.
roundrobin
Full Member
***
Offline Offline

Activity: 203
Merit: 100


View Profile
January 02, 2014, 01:52:59 PM
 #12

Thank you for the help. Now waiting for a block to be found with the new settings...

   LTC: Lbha3tRmE75oHfF4SjSKpxVK2fY9PxrPUX         VTC: VguAuTdGRcQzihEgrJDYPYUuugGMMGFCNn
   FTC: 6fVWQ3eHhhgH1haqThQbxTFV8XjrqyuKY2          SOL: 8X6dLCY8MeZ6RNdBxzYQkd5kxWj8VVPJmL
DOGE: DMBQta9ME9cWnRPVXtEbi57CDk1uNpwzSh
roundrobin
Full Member
***
Offline Offline

Activity: 203
Merit: 100


View Profile
January 02, 2014, 02:56:05 PM
 #13

Block found - and everything is working with the new difficulty! The only thing that confuses me is that "getinfo" reports 0 blocks and 0 balance, but perhaps the genesis block in the wallet is not accounted for?

Again, thanks for the help elbandi and nocoin!

   LTC: Lbha3tRmE75oHfF4SjSKpxVK2fY9PxrPUX         VTC: VguAuTdGRcQzihEgrJDYPYUuugGMMGFCNn
   FTC: 6fVWQ3eHhhgH1haqThQbxTFV8XjrqyuKY2          SOL: 8X6dLCY8MeZ6RNdBxzYQkd5kxWj8VVPJmL
DOGE: DMBQta9ME9cWnRPVXtEbi57CDk1uNpwzSh
roundrobin
Full Member
***
Offline Offline

Activity: 203
Merit: 100


View Profile
January 02, 2014, 09:20:32 PM
 #14

Things are working now. Multiple nodes up, communicating with eachother. Is it normal that every block I mine solo comes from a unique random address?

   LTC: Lbha3tRmE75oHfF4SjSKpxVK2fY9PxrPUX         VTC: VguAuTdGRcQzihEgrJDYPYUuugGMMGFCNn
   FTC: 6fVWQ3eHhhgH1haqThQbxTFV8XjrqyuKY2          SOL: 8X6dLCY8MeZ6RNdBxzYQkd5kxWj8VVPJmL
DOGE: DMBQta9ME9cWnRPVXtEbi57CDk1uNpwzSh
Stygian0708
Member
**
Offline Offline

Activity: 84
Merit: 10


View Profile
March 11, 2014, 05:40:01 AM
 #15

I am having one hell of a time, I have tried everything in this guide and it still does not work here are the issues I am having after making the changes

Code:
cnz@cryptopirates:~/testing/Denarius/DenariusCoin/src$ ./DenariusCoind -reindex
DenariusCoin server starting
cnz@cryptopirates:~/testing/Denarius/DenariusCoin/src$ Error: Failed to read block
cnz@cryptopirates:~/testing/Denarius/DenariusCoin/src$

I look in the debug log and there's this info

Code:
2014-03-11 05:37:22 DenariusCoin version v0.8.6.2-g85f303d (2014-03-10 23:46:35 -0500)
2014-03-11 05:37:22 Using OpenSSL version OpenSSL 1.0.1 14 Mar 2012
2014-03-11 05:37:22 Default data directory /home/cnz/.denariuscoin
2014-03-11 05:37:22 Using data directory /home/cnz/.denariuscoin
2014-03-11 05:37:22 Using at most 125 connections (1024 file descriptors available)
2014-03-11 05:37:22 Using 4 threads for script verification
2014-03-11 05:37:22 init message: Verifying wallet...
2014-03-11 05:37:22 dbenv.open LogDir=/home/cnz/.denariuscoin/database ErrorFile=/home/cnz/.denariuscoin/db.log
2014-03-11 05:37:22 Bound to [::]:60666
2014-03-11 05:37:22 Bound to 0.0.0.0:60666
2014-03-11 05:37:22 init message: Loading block index...
2014-03-11 05:37:22 Wiping LevelDB in /home/cnz/.denariuscoin/blocks/index
2014-03-11 05:37:22 Opening LevelDB in /home/cnz/.denariuscoin/blocks/index
2014-03-11 05:37:22 Opened LevelDB successfully
2014-03-11 05:37:22 Wiping LevelDB in /home/cnz/.denariuscoin/chainstate
2014-03-11 05:37:22 Opening LevelDB in /home/cnz/.denariuscoin/chainstate
2014-03-11 05:37:22 Opened LevelDB successfully
2014-03-11 05:37:22 Initializing databases...
2014-03-11 05:37:22 init message: Verifying blocks...
2014-03-11 05:37:22  block index              53ms
2014-03-11 05:37:22 init message: Loading wallet...
2014-03-11 05:37:23 nFileVersion = 80602
2014-03-11 05:37:23  wallet                 1144ms
2014-03-11 05:37:23 init message: Loading addresses...
2014-03-11 05:37:23 Loaded 0 addresses from peers.dat  1ms
2014-03-11 05:37:23 mapBlockIndex.size() = 0
2014-03-11 05:37:23 nBestHeight = 0
2014-03-11 05:37:23 setKeyPool.size() = 100
2014-03-11 05:37:23 mapWallet.size() = 0
2014-03-11 05:37:23 mapAddressBook.size() = 1
2014-03-11 05:37:23 Reindexing block file blk00000.dat...
2014-03-11 05:37:23 net thread start
2014-03-11 05:37:23 dnsseed thread start
2014-03-11 05:37:23 Loading addresses from DNS seeds (could take a while)
2014-03-11 05:37:23 opencon thread start
2014-03-11 05:37:23 addcon thread start
2014-03-11 05:37:23 trying connection 64.39.227.156:43706 lastseen=359587.8hrs
2014-03-11 05:37:23 connect() failed after select(): Connection refused
2014-03-11 05:37:23 msghand thread start
2014-03-11 05:37:23 dumpaddr thread start
2014-03-11 05:37:23 init message: Done loading
2014-03-11 05:37:23 ERROR: CheckProofOfWork() : hash doesn't match nBits
2014-03-11 05:37:23 ERROR: CheckBlock() : proof of work failed
2014-03-11 05:37:23 ERROR: ProcessBlock() : CheckBlock FAILED
2014-03-11 05:37:23 Unable to open file /home/cnz/.denariuscoin/blocks/blk00001.dat
2014-03-11 05:37:23 Reindexing finished
2014-03-11 05:37:23 Initializing databases...
2014-03-11 05:37:23 14d111fc6f3909764a2891ef4d48f0e4f1a2a01c3532df36115899f9e68ad521
2014-03-11 05:37:23 14d111fc6f3909764a2891ef4d48f0e4f1a2a01c3532df36115899f9e68ad521
2014-03-11 05:37:23 12a320fe62f0a510c17cbfa587ca5e4a3812a8d6e7d2a9f748cfa91ae5d3b386
2014-03-11 05:37:23 min nBit:  1e0fffff
2014-03-11 05:37:23 CBlock(hash=14d111fc6f3909764a2891ef4d48f0e4f1a2a01c3532df36115899f9e68ad521, input=01000000000000000000000000000000000000000000000000000000000000000000000086b3d3e51aa9cf48f7a9d2e7d6a812384a5eca87a5bf7cc110a5f062fe20a312b9aa8e4effff0f1ecd513f7c, PoW=46a5474200e21b7f4d0fa281c8dd10be396bcbc3c75fa5b6d7537bea945ab0e3, ver=1, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=12a320fe62f0a510c17cbfa587ca5e4a3812a8d6e7d2a9f748cfa91ae5d3b386, nTime=1317972665, nBits=1e0fffff, nNonce=2084524493, vtx=1)
2014-03-11 05:37:23   CTransaction(hash=12a320fe62f0a510c17cbfa587ca5e4a3812a8d6e7d2a9f748cfa91ae5d3b386, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 04ffff001d0104244d617263682031302c2032303134202d2050726f6f66206f66206e6f207072656d696e65)
    CTxOut(error)
  vMerkleTree: 12a320fe62f0a510c17cbfa587ca5e4a3812a8d6e7d2a9f748cfa91ae5d3b386
2014-03-11 05:37:23 Pre-allocating up to position 0x1000000 in blk00000.dat
2014-03-11 05:37:23 ERROR: CheckProofOfWork() : hash doesn't match nBits
2014-03-11 05:37:23 ERROR: CBlock::ReadFromDisk() : errors in block header
2014-03-11 05:37:23 *** Failed to read block
2014-03-11 05:37:23 Error: Failed to read block
2014-03-11 05:37:23 ERROR: LoadBlockIndex() : genesis block not accepted
2014-03-11 05:37:23 Shutdown : In progress...
2014-03-11 05:37:23 opencon thread interrupt
2014-03-11 05:37:23 addcon thread interrupt
2014-03-11 05:37:23 msghand thread interrupt
2014-03-11 05:37:23 dumpaddr thread stop
2014-03-11 05:37:23 net thread interrupt
2014-03-11 05:37:23 Flush(false)
2014-03-11 05:37:23 wallet.dat refcount=0
2014-03-11 05:37:23 wallet.dat checkpoint
2014-03-11 05:37:23 wallet.dat detach
2014-03-11 05:37:23 wallet.dat closed
2014-03-11 05:37:23 DBFlush(false) ended              33ms
2014-03-11 05:37:23 StopNode()
2014-03-11 05:37:23 Flushed 0 addresses to peers.dat  3ms
2014-03-11 05:37:23 Committing 0 changed transactions to coin database...
2014-03-11 05:37:23 Flush(true)
2014-03-11 05:37:23 wallet.dat refcount=0
2014-03-11 05:37:23 wallet.dat checkpoint
2014-03-11 05:37:23 wallet.dat detach
2014-03-11 05:37:23 wallet.dat closed
2014-03-11 05:37:23 DBFlush(true) ended               2ms
2014-03-11 05:37:23 Shutdown : done

any help would be greatly appreciated
Cryptokk
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile WWW
March 11, 2014, 10:24:00 AM
 #16

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 =)
madhatr
Newbie
*
Offline Offline

Activity: 35
Merit: 0


View Profile
April 03, 2014, 10:19:40 PM
 #17

I too have been messing around with the Litecoin 0.8.6.1 sources for fun and insight, but I can't get litecoind to work after it has created a genesis block...

I start with an empty ~/.litecoin dir - no blocks, no chainstate, no database. I have set the start difficulty to ">> 24", nNonce to 0, nBits is the default 0x1e0ffff0, I have set nTime and written a timestamp message. I run litecoind to get the correct MerkleRoot for my timestamp message and then I enable the genesis block generation and start litecoind again, and it begins mining a genesis block which when done ends with this message:

Code:
litecoind: main.cpp:2833: bool InitBlockIndex(): Assertion `hash == hashGenesisBlock' failed.

In debug.log I see that I successfully mined a block, so I set the new nNonce and genesis block hash - both nTime and nBits stay the same for some reason - and then I start litecoind again but only this happens:

Code:
Error: Failed to read block
: Error initializing block database.

Do you want to build the block database now?

And if I start again:

Code:
Error: Failed to read block
Error: Failed to connect best block

The debug log reveals this:

Code:
2014-01-01 15:13:35 Opened LevelDB successfully
2014-01-01 15:13:35 LoadBlockIndexDB(): last block file = 0
2014-01-01 15:13:35 LoadBlockIndexDB(): last block file info: CBlockFileInfo(blocks=1, size=281, heights=
0...0, time=2014-01-01...2014-01-01)
2014-01-01 15:13:35 LoadBlockIndexDB(): transaction index disabled
2014-01-01 15:13:35 init message: Verifying blocks...
2014-01-01 15:13:35  block index              41ms
2014-01-01 15:13:35 init message: Loading wallet...
2014-01-01 15:13:35 nFileVersion = 80601
2014-01-01 15:13:35  wallet                  534ms
2014-01-01 15:13:35 ERROR: CheckProofOfWork() : nBits below minimum work
2014-01-01 15:13:35 ERROR: CBlock::ReadFromDisk() : errors in block header
2014-01-01 15:13:35 *** Failed to read block
2014-01-01 15:13:35 Error: Failed to read block

Anyone who had the same problem and managed to solve it?


I have this identical problem right now but i have not changed the starting diff.     I will empty my ./coin folder and start the daemon and it searches for genesis block(thanks to the added code) but always ends with
Code:
bool InitBlockIndex(): Assertion `hash == hashGenesisBlock' failed.
Aborted
softron
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile
April 04, 2014, 04:20:49 PM
 #18

Nice guide

satoru
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
April 10, 2014, 07:10:49 PM
 #19


Using bitcoin-sCrypt as source. I changed the usual. testnet works fine. find a  gen block no errors. switch to mainnet, everything looks fine, but when i try to mine mainnet it shows 0 hashrate and doesnt start mining?
YarkoL
Legendary
*
Offline Offline

Activity: 996
Merit: 1013


View Profile
April 11, 2014, 02:10:35 PM
 #20


Using bitcoin-sCrypt as source. I changed the usual. testnet works fine. find a  gen block no errors. switch to mainnet, everything looks fine, but when i try to mine mainnet it shows 0 hashrate and doesnt start mining?

Check your debug.log and see if it's connected to a peer.


“God does not play dice"
Pages: [1] 2 3 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!