Author

Topic: The Genesis Block (Read 11355 times)

member
Activity: 84
Merit: 10
April 28, 2013, 09:35:19 AM
#17
That's a good idea, I still want to finish this particular code edit and compile to learn the steps to do so I just keep getting on confused on which genesis block variables I need to generate and how

I've had some say just change it and the software will figure it out, others say I need to run a script but what do I alter in the script so I don't end up with the same block as another coin. Also the hashing the time stamp I'm still trying to get my head around. If I can figure this out I should be ok, I just don't want to
Make any changes here till I get it so I don't break anything.
sr. member
Activity: 574
Merit: 250
April 28, 2013, 03:06:21 AM
#16


Where I am really confused is sort of the why of all this, like why is this done this way?

Simple it was never the intent of the code to support different chains.

Multicoin was a code fork awhile back that changed this to some extent.  It was capable of running the different alt coins available at the time just by changing the configurations you used it with, not not recompiling.  You could thus use it to pretty easily make a different coin by just creating a new config file.

https://github.com/twobits/MultiCoin-2bit
member
Activity: 84
Merit: 10
April 27, 2013, 03:45:52 PM
#15
Remember the 5th of November: is this the version of your script that works with Scrypt now? http://pastebin.com/nhuuV7y9

also I'm starting to piece together the steps, but is there an articles somewhere that explains the whole logic of this process, I think I get the idea which is...

- Run a script to general Genesis Block/Merkel Hash

- Code the results into the clients code

- Mine the Genesis Block

Where I am really confused is sort of the why of all this, like why is this done this way?
member
Activity: 70
Merit: 10
April 27, 2013, 01:30:39 PM
#14
It doesn't matter I think, once you computed the genesis block and just enter the time and nonce and it will find it next time immediately. Just the take some time initially to find the corresponding nonce.
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
April 27, 2013, 02:45:36 AM
#13
Back when I was making genesis blocks for oodles of altcoins for the Galactic Milieu project, it used to be that when the program crapped out saying the genesis block hash was wrong, it would show the current genesis block's hash (the hash it claimed was wrong).

Back then there was, near the top of main.cpp, a definition of what the expected genesis block was to be. That is what it was comparing to the actual hash of the actual genesis block we had coded in ourselves for our new coin.

So, we'd take the current hash the error complained about and plug it in as the expected hash to compare against.

So basically you run it once to find out what your actual new genes block's hash actually is, then code that in as the correct genesis block hash to expect and run again.

Of course since nowadays you want a nice high difficulty as initial difficulty, it could take many hours or days or weeks to actually compute a genesis block hash that is actually difficult enough to match the starting difficulty of the coin, but that is just a matter of pointing enough hashing power at it and waiting for however long it takes.

-MarkM-

Does it even matter what the initial difficulty of the genesis block is? I mean, since you can change the code you can really control what happens and whatnot.
legendary
Activity: 2940
Merit: 1090
April 27, 2013, 02:29:55 AM
#12
Back when I was making genesis blocks for oodles of altcoins for the Galactic Milieu project, it used to be that when the program crapped out saying the genesis block hash was wrong, it would show the current genesis block's hash (the hash it claimed was wrong).

Back then there was, near the top of main.cpp, a definition of what the expected genesis block was to be. That is what it was comparing to the actual hash of the actual genesis block we had coded in ourselves for our new coin.

So, we'd take the current hash the error complained about and plug it in as the expected hash to compare against.

So basically you run it once to find out what your actual new genes block's hash actually is, then code that in as the correct genesis block hash to expect and run again.

Of course since nowadays you want a nice high difficulty as initial difficulty, it could take many hours or days or weeks to actually compute a genesis block hash that is actually difficult enough to match the starting difficulty of the coin, but that is just a matter of pointing enough hashing power at it and waiting for however long it takes.

-MarkM-
member
Activity: 84
Merit: 10
April 26, 2013, 04:58:37 PM
#11
I'm going to download the compiler from codeblocks.org and I'll try this stuff out, excited
sr. member
Activity: 448
Merit: 254
April 26, 2013, 04:57:10 PM
#10
Good to hear.

In addition to everyone else's responses, take a look at contrib/pyminer in the Bitcoin-QT repository. It's a Python implementation of a miner - possibly easier to understand than a C implementation. Changing it to mine a genesis block rather than mine shares would be educational.

Additionally I would suggest the stepping-stones of hardcoding a "live" genesis block's information, getting that all to hash together correctly, then replacing the hardcoded parts gradually, and finally adding mining if you would like.  It is of course up to you and depends on what existing resources you can find, how much you want to do "from scratch", and what languages/libraries you are familiar with.
legendary
Activity: 1120
Merit: 1164
April 26, 2013, 02:00:03 PM
#9
I get that, and I am doing this for fun, I'm not really working on the idea that I'll actually compete with any of the main altcoins... I just really want to do it to see what's involved. Now that's out of the way, any advice to point me in the right direction.

Good to hear.

In addition to everyone else's responses, take a look at contrib/pyminer in the Bitcoin-QT repository. It's a Python implementation of a miner - possibly easier to understand than a C implementation. Changing it to mine a genesis block rather than mine shares would be educational.
legendary
Activity: 2058
Merit: 1452
April 26, 2013, 01:26:32 PM
#8
awesome, do I use the same script you linked to above, and how do I run the program, do I have to take it into a compiler or is there an executable?

(I'm learning a lot of this as I go along, but I'm determined to learn it so be patient with me, I realize how stupid my questions probably sound.)
he says it's in C, so you'll need gcc, mingw or visual c++.
member
Activity: 84
Merit: 10
April 26, 2013, 12:50:19 PM
#7
awesome, do I use the same script you linked to above, and how do I run the program, do I have to take it into a compiler or is there an executable?

(I'm learning a lot of this as I go along, but I'm determined to learn it so be patient with me, I realize how stupid my questions probably sound.)
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
April 26, 2013, 12:19:59 PM
#6
Thanks for the thread, still kind of confused but ill keep working at it, if anyone else has any insight on how to create a LTC genesis block it would be much appreciated.

I know I'm being rude here, but if you need to ask for help creating a genesis block for your alt-coin, you have no business creating an alt-coin.

If you just want to have fun and learn how crypto-currencies work, that's fine. Just recognize that you are a long way from being competent enough to be doing this seriously.

I get that, and I am doing this for fun, I'm not really working on the idea that I'll actually compete with any of the main altcoins... I just really want to do it to see what's involved. Now that's out of the way, any advice to point me in the right direction.
Well, I modified my genesis block generator to work with scrypt, I am able to create the PoW hash for scrypt and the merkle hash correctly, just not sure how to get the other hash, the genesis block hash. Apparently they are two different things.

EDIT:After reading up on scrypt, I think I figured out how to do it.
member
Activity: 84
Merit: 10
April 26, 2013, 12:08:52 PM
#5
Thanks for the thread, still kind of confused but ill keep working at it, if anyone else has any insight on how to create a LTC genesis block it would be much appreciated.

I know I'm being rude here, but if you need to ask for help creating a genesis block for your alt-coin, you have no business creating an alt-coin.

If you just want to have fun and learn how crypto-currencies work, that's fine. Just recognize that you are a long way from being competent enough to be doing this seriously.

I get that, and I am doing this for fun, I'm not really working on the idea that I'll actually compete with any of the main altcoins... I just really want to do it to see what's involved. Now that's out of the way, any advice to point me in the right direction.
legendary
Activity: 1120
Merit: 1164
April 26, 2013, 11:04:17 AM
#4
Thanks for the thread, still kind of confused but ill keep working at it, if anyone else has any insight on how to create a LTC genesis block it would be much appreciated.

I know I'm being rude here, but if you need to ask for help creating a genesis block for your alt-coin, you have no business creating an alt-coin.

If you just want to have fun and learn how crypto-currencies work, that's fine. Just recognize that you are a long way from being competent enough to be doing this seriously.
member
Activity: 84
Merit: 10
April 26, 2013, 06:19:01 AM
#3
Thank you very much!

I know there's more to change that's just the first instance I ran into where this is an issue.

Thanks for the thread, still kind of confused but ill keep working at it, if anyone else has any insight on how to create a LTC genesis block it would be much appreciated.
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
April 26, 2013, 12:23:41 AM
#2
The genesis block creation is not as simple as changing the letters to be anything.

I have written a Genesis block creator in C, but it won't work for scrypt i.e Litecoin based cryptos. https://bitcointalksearch.org/topic/ann-genesis-block-generator-181981 however it will give you an insight on how it's done.
It's also not just a matter of changing "uint256 hashGenesisBlock("0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2");" there are many more things that need to be edited.
member
Activity: 84
Merit: 10
April 25, 2013, 07:47:46 PM
#1
I'm editing the SmallChange Source code and here is how it looks like:

-uint256 hashGenesisBlock("0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2");
-static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // Litecoin: starting difficulty is 1 / 2^12
+uint256 hashGenesisBlock("0x384b060671f4a93948e9c168216dadb0ca2fbc54aa11c86b0345b6af1c59b2f5");
+static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // starting difficulty is 1 / 2^12

I'm assuming I should change the genesis block, but how do I know what to put there, can I change it to anything?
Jump to: