Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: spencerdupre on November 24, 2014, 04:32:29 PM



Title: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: spencerdupre on November 24, 2014, 04:32:29 PM
Has this ever happened to anyone else, or am I doing something wrong?  I have this details:

Timestamp: This is a test of the emergency broadcast system.
Unix time: 1416512906
Pubkey: 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f

I'm using GenesisH0, https://github.com/lhartikk/GenesisH0

It's trying all the nonces up to 4294967295 (the max of a 4 byte unsigned integer) and doesn't find a single one that produces a valid hash.


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: Quantum_Mechanics on November 24, 2014, 06:29:06 PM
I tryed to recreate a genesis block using https://github.com/lhartikk/GenesisH0 and got errors too.

Use this method instead:

- Set your unix time in main.cpp for both testnet and main net
- Set your timestamp
- Set your nonces to 0 in main.cpp
- Compile

You'll get an error:

Quote
Assertion failed...

-Then look in your roaming folder for debug.log (in a folder named as your coin), You'll find 3 lines at the end for exemple:

Quote
b1753ec3845a48ddc4618bc595af6dc89dac328cd48f9f8db178df5dd3b302fc Block hashed using the non-existent Merkel, based on the pzTimestamp from main.cpp
0000000000000000000000000000000000000000000000000000000000000000 Genesis block, no good because all the nNonces are set to 0 in main.cpp
2fc1b7ef46270c053711fbae934cf7f83378efd4b3e158079451d9c6c90e4700 Valid Merkel Hash, generated using the epoch time in main.cpp

- Take the Merkle Hash you got and put it in main.cpp

- Find the line in main.cpp with
Quote
if (false  && (block.GetHash() != hashGenesisBlock)) {

- Set it to true to mine the genesis block.

- Compile (as it will mine the genesis it will take some time and maybe look frozen, don't worry).

- After, (I think you'll get "assertion failded" again) back in your debug.log. You'll find a fresh nonce (block.nNonce) and your genesis block hash (block.GetHash).

- Put them both in main.cpp, don't forget to set 0x in front of the genesis hashes (both main and testnet).

- Set the line
Quote
if (true  && (block.GetHash() != hashGenesisBlock)) {
back to false

- Check if any checkpoints are set in checkpoints.cpp and if there is, change it with your genesis hash.

- Compile again

You're good ;)


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: spencerdupre on November 24, 2014, 10:10:37 PM
Thanks, I'm working on an automatic coin generator, so I need to automate the genesis mining process.  Compiling the source code and running it more than once is much more difficult than using a separate tool like GenesisH0.  GenesisH0 has produced multiple valid genesis hashes in my tests.  My question is, Is it more likely that GenesisH0 has a weird bug in this case, or that this specific timestamp simply has no valid hash?  Also, I can't find the string
Code:
if (false  && (block.GetHash() != hashGenesisBlock)) {
in the file main.cpp https://github.com/bitcoin/bitcoin/blob/1ee685f984bdeaac7468019c6e2cd4b7d3496aef/src/main.cpp


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: Quantum_Mechanics on November 24, 2014, 10:51:07 PM
Oh Ok, I thought you simply wanted clone an altcoin.

You can find
Code:
if (false  && (block.GetHash() != hashGenesisBlock)) {
in coins using scrypt, X11, X13 etc..

Sorry, I don't know much about GenesisH0..


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: iGotSpots on November 24, 2014, 11:00:01 PM
Thanks, I'm working on an automatic coin generator, so I need to automate the genesis mining process.  Compiling the source code and running it more than once is much more difficult than using a separate tool like GenesisH0.  GenesisH0 has produced multiple valid genesis hashes in my tests.  My question is, Is it more likely that GenesisH0 has a weird bug in this case, or that this specific timestamp simply has no valid hash?  Also, I can't find the string
Code:
if (false  && (block.GetHash() != hashGenesisBlock)) {
in the file main.cpp https://github.com/bitcoin/bitcoin/blob/1ee685f984bdeaac7468019c6e2cd4b7d3496aef/src/main.cpp

Without encouraging these types of sites directly, but still offering some assistance...

You are very much over complicating the problem here. I will give you one hint...take a look at all the tabs here and try to extrapolate what I am saying. It has nothing to do with genesis blocks, but just think about what the tabs at the top do after you get through the first screen that generates random shit

http://balls.blockexplorer.cc/paperwallet/


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: spencerdupre on November 25, 2014, 01:52:40 AM
@Quantum_Mechanics That's alright, thanks for offering help.

@iGotSpots  They generate addresses from a random seed?  Sorry, I don't follow.  The error I'm getting is:
struct.error: 'I' format requires 0 <= number <= 4294967295

Which means that it has tried all 4294967295 possible nonces and failed to find a valid hash. 


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: spencerdupre on November 25, 2014, 04:38:26 AM
I've confirmed that reducing the nTime by 1, to 1416512905, does successfully hash with nonce 1668111843.  It still seems that the original params are just an unlucky combination.


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: smeagol on November 27, 2015, 09:40:03 PM
Interesting - it seems as if bitcoin removed the debugging feature for genesis blocks in 0.8.6.  How can I get a genesis hash with a more recent bitcoin release?


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: Hazard on November 28, 2015, 05:59:47 PM
Interesting - it seems as if bitcoin removed the debugging feature for genesis blocks in 0.8.6.  How can I get a genesis hash with a more recent bitcoin release?
Pen and paper. :D


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: smeagol on November 29, 2015, 02:27:22 AM
Interesting - it seems as if bitcoin removed the debugging feature for genesis blocks in 0.8.6.  How can I get a genesis hash with a more recent bitcoin release?
Pen and paper. :D

Thanks!  Took 357000 tries but finally found the nonce!


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: cinnamon_carter on November 30, 2015, 04:15:17 AM
If you are having trouble with this hopefully you learned from the experiment.

I think the creation of the genesis block is about the easiest thing there is to running any coin  :D


Title: Re: Genesis Block, failed to find valid nonce, tried all possibilities in 4 bytes
Post by: smeagol on November 30, 2015, 11:41:14 PM
If you are having trouble with this hopefully you learned from the experiment.

I think the creation of the genesis block is about the easiest thing there is to running any coin  :D

Yup, just had to figure out how to print the results to the console.


Title: Genesis Block
Post by: tearodactyl on April 20, 2017, 08:50:32 PM
2014 methods no longer work.
2017 Bitcoin / Litecoin codebase update
http://practicecoin.com/index.php/2017/04/19/genesis-block/


Title: Re: Genesis Block
Post by: wsxdrfv on February 20, 2018, 01:03:39 PM
2014 methods no longer work.
2017 Bitcoin / Litecoin codebase update
http://practicecoin.com/index.php/2017/04/19/genesis-block/

Are there no updated version?

I searched a lot, haven't find any.