Bitcoin Forum
April 26, 2024, 03:47:33 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: The Genesis Block  (Read 11329 times)
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 26, 2013, 12:47:46 AM
 #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?

1714146453
Hero Member
*
Offline Offline

Posts: 1714146453

View Profile Personal Message (Offline)

Ignore
1714146453
Reply with quote  #2

1714146453
Report to moderator
1714146453
Hero Member
*
Offline Offline

Posts: 1714146453

View Profile Personal Message (Offline)

Ignore
1714146453
Reply with quote  #2

1714146453
Report to moderator
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 26, 2013, 05: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://bitcointalk.org/index.php?topic=181981.0 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.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 26, 2013, 11: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.

Peter Todd
Legendary
*
expert
Offline Offline

Activity: 1120
Merit: 1149


View Profile
April 26, 2013, 04:04:17 PM
 #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.

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 26, 2013, 05: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.

Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 26, 2013, 05: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.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 26, 2013, 05: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.)

grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 26, 2013, 06: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++.

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
Peter Todd
Legendary
*
expert
Offline Offline

Activity: 1120
Merit: 1149


View Profile
April 26, 2013, 07: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.

scintill
Sr. Member
****
Offline Offline

Activity: 448
Merit: 252


View Profile WWW
April 26, 2013, 09: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.

1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 26, 2013, 09:58:37 PM
 #11

I'm going to download the compiler from codeblocks.org and I'll try this stuff out, excited

markm
Legendary
*
Offline Offline

Activity: 2940
Merit: 1090



View Profile WWW
April 27, 2013, 07: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-

Browser-launched Crossfire client now online (select CrossCiv server for Galactic  Milieu)
Free website hosting with PHP, MySQL etc: http://hosting.knotwork.com/
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 27, 2013, 07: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.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
js2082
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 27, 2013, 06: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.
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 27, 2013, 08: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?

twobits
Sr. Member
****
Offline Offline

Activity: 574
Merit: 250



View Profile
April 28, 2013, 08: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

█████                █████      ███████             
█████                ███    █████████████       
█████                ██  █████████████████   
█████                █  ██████              ██████ 
█████                    ████                      ████ 
█████████████  █████                        ████
█████████████  █████                        ████
█████████████  █████                        ████
█████                    █████                             
█████                █  ██████              ███████
█████                ██  ███████████    █████ 
█████                ███    █████████    ████   
█████                █████      ███████    ██
███
███
███
███
███
███
███
███
███
HyperQuant.net
Platform for Professional Asset Management
███
███
███
███
███
███
███
███
███
WhitePaper
One-Pager
███
███
███
███
███
███
███
███
███
Telegram 
Facebook
Twitter
Medium
███
███
███
███
███
███
███
███
███
███
███
███
███
███
███
███
███
███
█████                █████      ███████             
█████                ███    █████████████       
█████                ██  █████████████████   
█████                █  ██████              ██████ 
█████                    ████                      ████ 
█████████████  █████                        ████
█████████████  █████                        ████
█████████████  █████                        ████
█████                    █████                             
█████                █  ██████              ███████
█████                ██  ███████████    █████ 
█████                ███    █████████    ████   
█████                █████      ███████    ██
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 28, 2013, 02:35:19 PM
 #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.

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!