Author

Topic: [Bounty $50] Help me modify code thats generates genesis block and nonce (Read 2299 times)

sr. member
Activity: 476
Merit: 250
In fact that's what all these altcoin tutorials are actually telling you to do.
full member
Activity: 235
Merit: 100
2014 methods no longer work.
2017 Bitcoin / Litecoin codebase update
http://practicecoin.com/index.php/2017/04/19/genesis-block/
member
Activity: 116
Merit: 10
Check this genesis block creation script for SHA256/Scrypt

https://github.com/lhartikk/GenesisH0
legendary
Activity: 2198
Merit: 1014
Franko is Freedom
that is the most magical part
hero member
Activity: 525
Merit: 531
hero member
Activity: 938
Merit: 1001
Holy fuck. If you can you can't figure this out, please don't make your own coin. When it breaks, you won't be able to fix it.

mike
full member
Activity: 280
Merit: 100
anyone can help me with similar problem ?

I have issue get my genesisblock too.

Will pay 0.3 BTC for the help
sr. member
Activity: 308
Merit: 250
Aside from the LTC 0.8.x branch not having GB creation code, the legacy code from all the clones doesn't work when cut and pasted. There is a very small modification needed to the scratchpad code to generate a working GB. I PM'd you.
full member
Activity: 140
Merit: 101
Quote
I have the same problem actually.
They changed the code a bit.
The section with
Code:
if(true && block.GetHash() != hashGenesisBlock)
is missing in the actual main.cpp of litecoin.
Think have to go through all GitHub changes to find out why and if the process to create genesis block was replaced.

Well you don't actually have to go through the github changes.  The reason is pretty obvious.  If the DB file becomes corrupted, the default action would be to generate a new block.  In fact that's what all these altcoin tutorials are actually telling you to do.  Change the text of the genesis block, change the nonce etc and you have a new expected value for the block.  When it goes to check the current genesis block against this hardcoded block, it realizes there is a problem, in essence it thinks the DB has become corrupted. 
This could cause problems.  So they removed the ability (since they didn't build it so you could fork the blockchain).

If I'm not mistaken this happened to all bitcoin pedigree cryptos about the time they moved off BDB and onto levelDB.  As those changes move downstream to the various alts (Litecoin is an altcoin too remember), people are seeing the wisdom of the idea.

The altcoin tutorials haven't quite caught up to this change yet.

To spin your own altcoin you're going to need to track down the info (it's contained in the link above) and add it back in.
My advice is that you remove it as soon as you generate your own block.  Otherwise you could have a bunch of problems later on down the road.

Once other step you should consider is to do the genesis block step twice.
The first time you generate it and get it going long enough to generate your own unique key.  Then go back, blow away your genesis block and change the scriptpubkey to your new key and generate a new genesis block to put back in.   Otherwise you're giving the Litecoin developers the key to spend your genesis block (at least I assume that key is from Litecooin).
full member
Activity: 140
Merit: 101
Here is something from StackExchange that explains what you need to do to get it to work.
http://stackoverflow.com/questions/20772606/how-to-create-a-genesis-block-of-my-altercoin

Hope that's helpful!
newbie
Activity: 50
Merit: 0
I thought I found it in LiteCoin but the true && part is missing?

Quote
I have the same problem actually.
They changed the code a bit.
The section with
Code:
if(true && block.GetHash() != hashGenesisBlock)
is missing in the actual main.cpp of litecoin.
Think have to go through all GitHub changes to find out why and if the process to create genesis block was replaced.
newbie
Activity: 5
Merit: 0
I have created an altcoin, based on litecoin 0.8 code.

NOTE: This post is similar to something posted by another user, but this is a new post, as I am having a similar problem generating a usable genesis block.

I've already modified the code and it compiles successfully and runs. However, I am getting fatal run-time errors.

Much of the seemingly relevant advice available on this site for generating a genesis block seems to be based on an obsolete branch of litecoin, so it may not be applicable.
 
In any case, these are the errors I'm getting in debug.log:

Code:
2013-12-26 19:08:39 CBlock(hash=132d04036cafebec545ba2cf4bf4a315a34c4ab45003f9b4586111eefaf33c16, input=01000000000000000000000000000000000000000000000000000000000000000000000020d4a427a866d0162dbe6b9d7459bdd67ec9631f8e322dcf5755ea310878bda48d7fbb52f0ff0f1e00000000, PoW=e8b3313f59ac0c1b6645838c72df2bf45930fcbe91218d0993dd5f26d4bb0112, ver=1, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=a4bd780831ea5557cf2d328e1f63c97ed6bd59749d6bbe2d16d066a827a4d420, nTime=1388019597, nBits=1e0ffff0, nNonce=0, vtx=1)
2013-12-26 19:08:39   CTransaction(hash=a4bd780831ea5557cf2d328e1f63c97ed6bd59749d6bbe2d16d066a827a4d420, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 04ffff001d01044c5d4e592054696d65732032342f4465632f3230313320416c616e20547572696e672c20456e69676d6120436f64652d427265616b657220616e6420436f6d70757465722050696f6e6565722c2057696e7320526f79616c20506172646f6e)
    CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4)
  vMerkleTree: a4bd780831ea5557cf2d328e1f63c97ed6bd59749d6bbe2d16d066a827a4d420
2013-12-26 19:08:39 Pre-allocating up to position 0x1000000 in blk00000.dat
2013-12-26 19:08:40 ERROR: CheckProofOfWork() : hash doesn't match nBits
2013-12-26 19:08:40 ERROR: CBlock::ReadFromDisk() : errors in block header
2013-12-26 19:08:40 *** Failed to read block
2013-12-26 19:08:40 Error: Failed to read block
2013-12-26 19:08:40 ERROR: LoadBlockIndex() : genesis block not accepted
2013-12-26 19:08:40 : Error initializing block database.

And I get the following output from the client:

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

Do you want to rebuild the block database now?

To collect the bounty I need you to:

1.) Get the client to successfully create a genesis block and then run without giving errors.
3.) Send me back the required code changes, so I can learn from my mistakes and see what I should have done.

Send me a private message if you accept this new challenge.

I'll provide you with a zip file with the full code in it.

I'll pay in BTC (or PayPal USD if you want)
Jump to: