Bitcoin Forum
July 08, 2024, 08:42:05 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Bounty $50] Help me modify code thats generates genesis block and nonce  (Read 2282 times)
petronius (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
December 26, 2013, 11:27:21 PM
 #1

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

Activity: 50
Merit: 0


View Profile
January 08, 2014, 11:48:54 AM
 #2

I thought I found it in LiteCoin but the true && part is missing?

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.
Nova!
Full Member
***
Offline Offline

Activity: 140
Merit: 101


View Profile
January 24, 2014, 01:50:10 PM
 #3

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!

Donate @ 1LE4D5ERPZ4tumNoYe5GMeB5p9CZ1xKb4V
Nova!
Full Member
***
Offline Offline

Activity: 140
Merit: 101


View Profile
January 24, 2014, 02:54:37 PM
 #4

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).

Donate @ 1LE4D5ERPZ4tumNoYe5GMeB5p9CZ1xKb4V
shakezula
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250



View Profile
January 24, 2014, 03:24:38 PM
 #5

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.
baokychen
Full Member
***
Offline Offline

Activity: 280
Merit: 100


View Profile
March 02, 2014, 04:16:26 AM
 #6

anyone can help me with similar problem ?

I have issue get my genesisblock too.

Will pay 0.3 BTC for the help
btc-mike
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1001



View Profile
March 02, 2014, 04:31:04 AM
 #7

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
elbandi
Hero Member
*****
Offline Offline

Activity: 525
Merit: 529


View Profile
March 02, 2014, 10:17:50 PM
 #8

I wrote a "tutorial":
https://bitcointalk.org/index.php?topic=391983.msg4223449#msg4223449
defaced
Legendary
*
Offline Offline

Activity: 2184
Merit: 1011


Franko is Freedom


View Profile WWW
March 02, 2014, 10:55:58 PM
 #9

that is the most magical part

Fortune Favors the Brave
Borderless CharityEXPANSEEXRAllergy FinderFranko Is Freedom
voileipa
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
March 14, 2014, 11:46:42 AM
 #10

Check this genesis block creation script for SHA256/Scrypt

https://github.com/lhartikk/GenesisH0
tearodactyl
Full Member
***
Offline Offline

Activity: 235
Merit: 100


View Profile
April 20, 2017, 09:28:32 PM
 #11

2014 methods no longer work.
2017 Bitcoin / Litecoin codebase update
http://practicecoin.com/index.php/2017/04/19/genesis-block/
Den_mike
Sr. Member
****
Offline Offline

Activity: 476
Merit: 250



View Profile
June 01, 2017, 07:00:08 AM
 #12

In fact that's what all these altcoin tutorials are actually telling you to do.
Pages: [1]
  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!