Bitcoin Forum
April 26, 2024, 06:05:26 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: 1 2 3 [All]
  Print  
Author Topic: [ANN] Genesis Block Generator  (Read 30869 times)
Remember remember the 5th of November (OP)
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 21, 2013, 03:50:39 AM
Last edit: November 01, 2013, 11:16:35 PM by Remember remember the 5th of November
Merited by ABCbits (2), BlackHatCoiner (1)
 #1

Ok, thread title is a bit misleading, I haven't actually done the genesis block calculation part done. I'd like to also take a minute or two and explain to you that I aren't exactly a good coder, I started doing C in my early days of mining in 2011 and playing with cgminer and nonces and stuff. I refused to read a book on C, so everything I've learned about C is through trial&error, well OK I have not learned much so trial&error is how I get my results. The equivalent of this would be trying to drive a car as if you have 10 years behind the wheel without actually knowing how to.

So basically do not expect the best code, I could have done things in there that aren't efficient, or just plain simply wrong and that would be because I don't know how to do them in a different way.

The code is here http://pastebin.com/nhuuV7y9, pure C. No binaries for obvious reasons. The code relies on OpenSSL. Since you will need OpenSSL either way, as it is a Bitcoin dependency, I believe it won't be an issue.
*Implemented Genesis Block finder

Cons
  • Program assumes one input and one output. So trying to create a merkle hash like the one in Freicoin with multiple inputs and outputs is not possible with this program.
  • Program at the moment assumes 50 coins, but this can be changed in the code very easily.
  • This is probably the most important one. I can re-create the Bitcoin merkle hash with ease, but when I tried to test it with Litecoin's timestamp message, it failed. Something to do with Unicode. I will not lie, my understanding of Unicode and ASCII is even less than my understanding of C. Basically, try to avoid apostrophes,commas and other special characters. Someone more knowledgeable can patch this

Usage
Quote
program <pubkey> <timestamp> <nBits>

Example
Quote
programname 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" 486604799
Which will output
Quote
Coinbase: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f7 2206f6e206272696e6b206f66207365636f6e6420
6261696c6f757420666f722062616e6b73

PubkeyScript: 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce f38c4f35504e51ec112de5c384df7ba0b8d57
8a4c702b6bf11d5fac

Merkle Hash: 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a
Byteswapped: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b

The timestamp needs to be in quotes if it's longer than a word, because it will get treated as separate arguments than a whole string.

So yeah, more cons than pros, but if you like what I've done, please drop some reward to the address on my signature Smiley

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
1714154726
Hero Member
*
Offline Offline

Posts: 1714154726

View Profile Personal Message (Offline)

Ignore
1714154726
Reply with quote  #2

1714154726
Report to moderator
1714154726
Hero Member
*
Offline Offline

Posts: 1714154726

View Profile Personal Message (Offline)

Ignore
1714154726
Reply with quote  #2

1714154726
Report to moderator
Transactions must be included in a block to be properly completed. When you send a transaction, it is broadcast to miners. Miners can then optionally include it in their next blocks. Miners will be more inclined to include your transaction if it has a higher transaction fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714154726
Hero Member
*
Offline Offline

Posts: 1714154726

View Profile Personal Message (Offline)

Ignore
1714154726
Reply with quote  #2

1714154726
Report to moderator
chriswen
Hero Member
*****
Offline Offline

Activity: 756
Merit: 500


View Profile
April 21, 2013, 03:59:26 AM
 #2

Wow, it's been made.
scintill
Sr. Member
****
Offline Offline

Activity: 448
Merit: 252


View Profile WWW
April 21, 2013, 04:54:22 AM
 #3

Interesting, the Litecoin genesis block seems to have a Unicode "smart quote" (fancier apostrophe) encoded in UTF-8.  With my console configured for UTF-8 encoding, this seems to work to reproduce the LTC genesis tx:

Quote
./genesisgen 040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08 dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9 "NY Times 05/Oct/2011 Steve Jobs, Apple’s Visionary, Dies at 56" 486604799

Coinbase: 04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732 c204170706c65e280997320566973696f6e6172792c2044696573206174203536

PubkeyScript: 41040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa 08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9ac

Merkle Hash: d9ced4ed1130f7b7faad9be25323ffafa33232a17c3edf6cfd97bee6bafbdd97
Byteswapped: 97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9

(Notice "Apple’s" as opposed to "Apple's")  This seems to correspond with the genesis tx at this block explorer.  Cool, thanks OP!

(Also, this timestsamp may work in bash without terminal settings: "`echo -en NY Times 05/Oct/2011 Steve Jobs, Apple\\\\xE2\\\\x80\\\\x99s Visionary, Dies at 56`")

1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
Remember remember the 5th of November (OP)
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 21, 2013, 05:07:41 AM
 #4

I am glad it works for you. But a lot of users, me included are on Windows.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
tacotime
Legendary
*
Offline Offline

Activity: 1484
Merit: 1005



View Profile
April 21, 2013, 05:10:42 AM
 #5

I am glad it works for you. But a lot of users, me included are on Windows.
http://www.evanjones.ca/unicode-in-c.html

But you can also just pass it as binary by converting it to hex reading from a UTF-8 file containing the string...

Code:
XMR: 44GBHzv6ZyQdJkjqZje6KLZ3xSyN1hBSFAnLP6EAqJtCRVzMzZmeXTC2AHKDS9aEDTRKmo6a6o9r9j86pYfhCWDkKjbtcns
Remember remember the 5th of November (OP)
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 21, 2013, 08:04:29 AM
 #6

I was able to implement the block hashing part, will clean it up and release later.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
Remember remember the 5th of November (OP)
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 22, 2013, 08:54:33 AM
 #7

I have updated the code with block hashing to find a genesis block. If you need to specify custom nonce and unixtime(to re-create a block from some chain), you will have to edit the source.

http://pastebin.com/nhuuV7y9

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
js2082
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 27, 2013, 02:30:10 AM
 #8

I tried your program with bitcoin's parameters:

Quote
$ gg 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f
4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/2009
 Chancellor on brink of second bailout for banks" 486604799

Coinbase: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63
656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616 e
6b73

PubkeyScript: 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61de
b649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac

Merkle Hash: 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a
Byteswapped: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
Generating block...
1054499 Hashes/s, Nonce 1279737097
Block found!
Hash: 000000000be5c9479ccf0a6a74134940650ca3690488d6a3604ea029b429f778
Nonce: 1279991239
Unix time: 1367026916

Why I don't get the same genesis hash as in the bitcoin program?

Quote
uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");

Do I look at the wrong place?
scintill
Sr. Member
****
Offline Offline

Activity: 448
Merit: 252


View Profile WWW
April 27, 2013, 03:54:54 AM
 #9

I tried your program with bitcoin's parameters:

Quote
$ gg 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f
4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/2009
 Chancellor on brink of second bailout for banks" 486604799
...

Why I don't get the same genesis hash as in the bitcoin program?

Quote
uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");

It looks like you've got a linebreak/space in the first argument.  I noticed this in OP's post too, if I double click the first argument it stops highlighting halfway through.  If I drag-select the whole thing and paste it somewhere, there's a space.  So, make sure you don't have any space between "bc3f" and "4cef".

1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
js2082
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 27, 2013, 06:42:06 AM
 #10

I retried, still the same, no space or line-break in between... it's weird why it is not match.
Remember remember the 5th of November (OP)
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 27, 2013, 06:46:26 AM
 #11

I tried your program with bitcoin's parameters:

Quote
$ gg 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f
4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/2009
 Chancellor on brink of second bailout for banks" 486604799
...

Why I don't get the same genesis hash as in the bitcoin program?

Quote
uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");

It looks like you've got a linebreak/space in the first argument.  I noticed this in OP's post too, if I double click the first argument it stops highlighting halfway through.  If I drag-select the whole thing and paste it somewhere, there's a space.  So, make sure you don't have any space between "bc3f" and "4cef".
It's because the nonce and unixtime are different.

For bitcoin, it's unixtime = 1231006505 and nonce = 2083236893

I will have to rework the program a bit and start working with switches for better control and/or parsing the data from a file.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
js2082
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 27, 2013, 07:13:41 AM
 #12

OK got it. Nice, with these as initial value the genesis block come out immediately:

Quote
$ gg1 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3
f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/200
9 Chancellor on brink of second bailout for banks" 486604799

Coinbase: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63
656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616 e
6b73

PubkeyScript: 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61de
b649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac

Merkle Hash: 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a
Byteswapped: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
Generating block...

Block found!
Hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
Nonce: 2083236893
Unix time: 1231006505

Nice program!
c4n10
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250



View Profile
May 05, 2013, 08:39:14 PM
 #13

Little help please:

Code:
root@vps:~/0pticoin/src# gcc -o genesis_generator genesis_generator.c
/tmp/cchWzm3E.o: In function `main':
genesis_generator.c:(.text+0x95e): undefined reference to `SHA256'
genesis_generator.c:(.text+0x979): undefined reference to `SHA256'
genesis_generator.c:(.text+0xb73): undefined reference to `SHA256'
genesis_generator.c:(.text+0xb8e): undefined reference to `SHA256'
collect2: ld returned 1 exit status

Thanks!!!
Passion_ltc
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500


Crypti Community Manager


View Profile
May 05, 2013, 08:52:07 PM
 #14

How can I determine the first block as a checkpoint if I can't mine? Or can I mine without checkpoints?

cygnusxi
Sr. Member
****
Offline Offline

Activity: 397
Merit: 251


CureCoin Lead Dev


View Profile WWW
May 05, 2013, 09:04:31 PM
 #15

nice job. Ill need to add a hard drive to my pc to store all the new block chains that will be coming out  Grin

Fold Proteins, earn cryptos! CureCoin. https://bitcointalk.org/index.php?topic=603757 MergeFold with FoldingCoin https://bitcointalk.org/index.php?topic=781352.0
XertroV
Member
**
Offline Offline

Activity: 88
Merit: 12

Max Kaye


View Profile WWW
June 19, 2013, 06:05:20 AM
 #16

Little help please:

Code:
root@vps:~/0pticoin/src# gcc -o genesis_generator genesis_generator.c
/tmp/cchWzm3E.o: In function `main':
genesis_generator.c:(.text+0x95e): undefined reference to `SHA256'
genesis_generator.c:(.text+0x979): undefined reference to `SHA256'
genesis_generator.c:(.text+0xb73): undefined reference to `SHA256'
genesis_generator.c:(.text+0xb8e): undefined reference to `SHA256'
collect2: ld returned 1 exit status

Thanks!!!

For future reference, you need to include the libraries in the command:

Code:
gcc genesis_generator.c -o genesis_generator -lcrypto
Remember remember the 5th of November (OP)
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
November 01, 2013, 11:15:58 PM
 #17

Bumping this thread for anyone that might want to make MORE sha256 alt coins.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
int3ractivodular
Sr. Member
****
Offline Offline

Activity: 280
Merit: 250

TECHNOLOGY, BABY!


View Profile
November 02, 2013, 12:39:57 AM
 #18

Subbed
simbo
Full Member
***
Offline Offline

Activity: 165
Merit: 100


View Profile
December 10, 2013, 09:13:44 AM
 #19

hi,

I downloaded(link in 1st post) & compiled under windows(mingw) & try to get the genesis block. Unable to get:

Quote
Hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
Nonce: 2083236893
Unix time: 1231006505

Please advise. Thanks.

BattleTitans.io  ▼  Mobile PvP Arena of the Future  ▼  BattleTitans.io
The Most Promising ICO in October    [Join Now!]

▼  [FB]  ▬  [TW]  ▬  [TG]  ▬▬▬  [YU]  ▼
Remember remember the 5th of November (OP)
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
December 10, 2013, 09:17:25 AM
 #20

hi,

I downloaded(link in 1st post) & compiled under windows(mingw) & try to get the genesis block. Unable to get:

Quote
Hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
Nonce: 2083236893
Unix time: 1231006505

Please advise. Thanks.

You need to preset the UNIX time variable and nonce to match the ones there, otherwise it will find a different one.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
simbo
Full Member
***
Offline Offline

Activity: 165
Merit: 100


View Profile
December 10, 2013, 09:23:09 AM
Last edit: December 10, 2013, 02:33:40 PM by simbo
 #21

From:

Code:
uint32_t startNonce = 0;
uint32_t unixtime = 0;

to:

Code:
uint32_t startNonce = 0;
uint32_t unixtime = 1231006505;

?

Thanks.

Ok. Got it! Thanks.

BattleTitans.io  ▼  Mobile PvP Arena of the Future  ▼  BattleTitans.io
The Most Promising ICO in October    [Join Now!]

▼  [FB]  ▬  [TW]  ▬  [TG]  ▬▬▬  [YU]  ▼
Remember remember the 5th of November (OP)
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
December 10, 2013, 08:13:39 PM
 #22

If you want to get the exact same genesis block as Bitcoin, you might as well just set the nonce as well, no point in waiting minutes.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
GreatBug
Sr. Member
****
Offline Offline

Activity: 629
Merit: 252



View Profile
December 11, 2013, 08:34:27 PM
 #23

I've tried, and I got a 9 digit nonce, and bitcoind is unable to validate and ERRORs on boot and looks like an invalid genesis block in the .dat

any thoughts?
widewave
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
January 01, 2014, 02:03:45 PM
 #24

Perfect!
But I can't open your link of code.
Please put your code on github.
Thanks!
Cassey
Sr. Member
****
Offline Offline

Activity: 470
Merit: 250

Better to have 100 friends than 100 rubles


View Profile
January 21, 2014, 03:58:09 AM
 #25

Remember -

In this thread (https://bitcointalk.org/index.php?topic=187888.0) you mentioned to Alex figuring out how to do this for Scrypt based hashes.  Did you ever post that code?

Like Alex, I'm just fooling around, but would like to make a "CPU Only" coin, perhaps modifying the litecoin fork to require even more memory per thread (512mb per thread???).

Anyhow, would love to grab your Scrypted based code if you have it available.  Did get your SHA256 one running.

Thanks,

Cassey

Cassey
simbo
Full Member
***
Offline Offline

Activity: 165
Merit: 100


View Profile
January 21, 2014, 06:42:29 AM
 #26

Remember -

In this thread (https://bitcointalk.org/index.php?topic=187888.0) you mentioned to Alex figuring out how to do this for Scrypt based hashes.  Did you ever post that code?

Like Alex, I'm just fooling around, but would like to make a "CPU Only" coin, perhaps modifying the litecoin fork to require even more memory per thread (512mb per thread???).

Anyhow, would love to grab your Scrypted based code if you have it available.  Did get your SHA256 one running.

Thanks,

Cassey

If you are looking to make "CPU only" coins, seriously, this thread is not the right place. Btw, when you are able to change the hashing, generating genesis block will not be a problem. Cheesy

BattleTitans.io  ▼  Mobile PvP Arena of the Future  ▼  BattleTitans.io
The Most Promising ICO in October    [Join Now!]

▼  [FB]  ▬  [TW]  ▬  [TG]  ▬▬▬  [YU]  ▼
TinFury
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
February 17, 2014, 06:40:16 PM
 #27

I'm still a bit confused. If I were creating a new coin and needed a new pubkey where would that come from? Is this a random ECDSA public key?
btcdrak
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000


View Profile
February 17, 2014, 10:18:22 PM
 #28

I'm still a bit confused. If I were creating a new coin and needed a new pubkey where would that come from? Is this a random ECDSA public key?

I am sorry, but if you dont know the answer to this question, you should not be even thinking of creating a new coin.
TinFury
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
February 18, 2014, 05:49:51 PM
 #29

I'm still a bit confused. If I were creating a new coin and needed a new pubkey where would that come from? Is this a random ECDSA public key?

I am sorry, but if you dont know the answer to this question, you should not be even thinking of creating a new coin.


You know... .I go to fix my car.... I ask the mechanic... hey how does a catalytic converter work? I don't understand what is does or what it is. He doesn't come back with a reply like yours....... Are you seriously being a dick or impersonating a dick?
btcdrak
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000


View Profile
February 18, 2014, 05:56:58 PM
 #30

I'm still a bit confused. If I were creating a new coin and needed a new pubkey where would that come from? Is this a random ECDSA public key?

I am sorry, but if you dont know the answer to this question, you should not be even thinking of creating a new coin.


You know... .I go to fix my car.... I ask the mechanic... hey how does a catalytic converter work? I don't understand what is does or what it is. He doesn't come back with a reply like yours....... Are you seriously being a dick or impersonating a dick?

But you don't have the ability to try and make your own car (and endanger others), that is where your analogy breaks down. Copy pasting a coin is too easy, except for some fiddly details. So again, if you dont know what you are doing, leave it. If you cant work it out yourself, then more indication you are out of your depth.

And just in case my analogy is not fitting - you might ask your surgeon how he'll do the operation on you, but you would not try the operation yourself (and again risk harming others).
Cassey
Sr. Member
****
Offline Offline

Activity: 470
Merit: 250

Better to have 100 friends than 100 rubles


View Profile
February 18, 2014, 06:17:26 PM
 #31

Perhaps a bit blunt, but the point is valid.  Creating a coin is NOT for the faint of heart - I know I just launched one last week.  Probably put in 32+ hours and more likely 60+ (it was a blurry several weeks) making slow incremental progress followed by long periods of frustrations.   Yes, getting your genesis key build is a highlight, but there are dozens of other things to consider, like which difficulty algorithm your going to use to try and thwart the raiders, or at least make healing after them go smoother.  Are you going to have a support website?  How about a support forum? Where are you going to announce?  Can you get all the various QT wallets built?  Do you know any pool operators?  Will you be setting up a twitter account?  Are you comfortable with using github?  How many coins, it any will you pre-mine?  If you don't pre-mine are you willing to lose control of your coin?  How often will you add checkpoint records?  Which coin are you cloning from and why?  Do you understand the math behind it all and why you don't want a 10 second block time?  etc.

People can not hand hold you through all of that.  Plan on spending a LOT of time on Google and not just looking at page one results.

If your not comfortable with that, take the original response to heart.

Doing the name change is the easy part.  (Mind you, I still find old references occasionally after a good dozen grep scans, like when a friend tried building the Mac QT wallet for me.)


Cassey
n00bnoxious
Sr. Member
****
Offline Offline

Activity: 280
Merit: 250

Bitnation Development Team Member


View Profile
April 27, 2014, 10:29:13 PM
 #32

Awesome work! Having a lot of fun playing with this.
northranger79510
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250

Riecoin and Huntercoin to rule all!


View Profile
May 03, 2014, 06:07:47 PM
 #33

Hi, compiled your first post and got the following:

./genesis 040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08 dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9 "NY Times 05/Oct/2011 Steve Jobs, Apple’s Visionary, Dies at 56" 486604799

Invalid public key length! 040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08

Please advise.

Huntercoin: H9kttkrQidiQMG9NibmTgjgCKqWJMAkAXD
Riecoin: Like us on https://www.facebook.com/TheRiecoinCommunity
newguy211
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
December 18, 2014, 01:59:17 AM
Last edit: December 19, 2014, 02:02:11 AM by newguy211
 #34

For anyone else who missed this on the first page, the compile line is:
gcc genesis_generator.c -o genesis_generator -lcrypto

I'm still a bit confused. If I were creating a new coin and needed a new pubkey where would that come from? Is this a random ECDSA public key?

I am sorry, but if you dont know the answer to this question, you should not be even thinking of creating a new coin.

The way I understand it, Bitcoin creats an address by generating a random number which corresponds to a single ECDSA public key / private key pair.  The public key is determined into a bitcoin address through some hashing and then encoding.  So there are many ECDSA pairs are saved in each wallet, one for each address.
tearodactyl
Full Member
***
Offline Offline

Activity: 235
Merit: 100


View Profile
April 20, 2017, 08:51:48 PM
 #35

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

Activity: 322
Merit: 54

Consensus is Constitution


View Profile
February 11, 2018, 04:18:17 PM
 #36

Can anyone modify this to allow for yescrypt algorithm?  Here is the yescrypt miner:

https://github.com/JayDDee/cpuminer-opt/tree/master/algo/yescrypt

Substantial bitcoin donations will come your way if you can!

mafalate
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
February 17, 2018, 09:21:56 PM
 #37

So this is my first post ahah, but where does the pubkeyscript go on the new version of bitcoin? Need this for studying purposes
hushan
Member
**
Offline Offline

Activity: 61
Merit: 15


View Profile
April 18, 2018, 08:16:02 AM
 #38

Thanks, it works great for me. I have made small changes to improve it, see https://github.com/liveblockchain/genesisgen

1. Gets invalid result when the timestamp string is longer than 76 bytes, as it has to use `OP_PUSHDATA1(0x4c)` as prefix of the data.

Code:
if (timestamp_len > 76) {
transaction->scriptSig[scriptSig_pos++] = 0x4c;
}

2. Add command line arguments for nonce and unixtime for quick poc test.

Code:
Usage: ./genesis [options] <pubkey> "<timestamp>" <nBits> <startNonce> <unixtime>
$ ./genesis 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" 486604799 2083236893 1231006505
    nBits: 0x1d00ffff
    startNonce: 2083236893
    unixtime: 1231006505

    Coinbase: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

    PubkeyScript: 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac

    Merkle Hash: 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a
    Byteswapped: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
    Generating block...

    Block found!
    Hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
    Nonce: 2083236893
    Unix time: 1231006505

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
lokiverloren
Newbie
*
Offline Offline

Activity: 85
Merit: 0


View Profile
May 19, 2018, 06:32:48 AM
Last edit: May 20, 2018, 06:42:15 AM by lokiverloren
 #39

I made a port of this code into Golang for those who are interested. There is an error in the source of the miner at the end of the OP in that it doesn't correctly adjust the difficulty target search (it searches for only 4 zeroes at the big end instead of what nBits specifies, though this is the same as the minimum difficulty). I have fixed this, and it is precise to the bit. Possibly I could have made my job easier by converting the difficulty to big.Int and also the hash but the way I have written it correctly checks - I suspect that it would be equal or greater overhead to have to use the bytes to big.Int converter anyway.

https://github.com/calibrae-project/spawn/blob/e00ddd6ca93e1f96f69b75fd3b8536d98b45deb8/tools/genesis/create/creategenesis.go

It does take quite a long time to compute the hash. On my i5-7600 running on one core it takes between 30 and 60 minutes. Of course the solver I have written isn't going to win any awards but a CPU is not the right device to compute hashes on anyway as a sole task. I guess it might be a good opportunity for me to learn about how to write goroutines and split the task amongst all the cores of the cpu by dividing the nonce-space and on my machine that would drop the time to find the right nonce by a quarter.

After thinking about it and reading about goroutines I figured out that parallelising such a search was very simple and as my routine grabs the current time at the end of the nonce number space and I have set them to start one second apart, this should dramatically improve the time it takes for my genesis generator to finish. Especially if you are running this on a machine with 8 or more cores.

Here is the updated version with parallel execution of the search:

https://github.com/calibrae-project/spawn/blob/94977557fcf0ae653e5c1a0c831a42ff0240b905/tools/genesis/create/creategenesis.go

UPDATE:

I still had some things wrong and decided to set it to default to generating a random public key if no input was given. This now correctly targets the difficulty, the solutions generally have 3 bytes zero at the big end.

https://github.com/calibrae-project/spawn/blob/f682a9d7aa43a764682dec77cd6a50a0c6049537/tools/genesis/create/creategenesis.go

It pops out the solution so fast it's almost pointless that it fans out use all your CPU threads to perform the search.

Enjoy!
nur1labs
Sr. Member
****
Offline Offline

Activity: 868
Merit: 250


Founder Nur1Labs


View Profile WWW
August 02, 2018, 01:51:10 PM
 #40

Thanks, it works great for me. I have made small changes to improve it, see https://github.com/liveblockchain/genesisgen

1. Gets invalid result when the timestamp string is longer than 76 bytes, as it has to use `OP_PUSHDATA1(0x4c)` as prefix of the data.

Code:
if (timestamp_len > 76) {
transaction->scriptSig[scriptSig_pos++] = 0x4c;
}

2. Add command line arguments for nonce and unixtime for quick poc test.

Code:
Usage: ./genesis [options] <pubkey> "<timestamp>" <nBits> <startNonce> <unixtime>
$ ./genesis 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" 486604799 2083236893 1231006505
    nBits: 0x1d00ffff
    startNonce: 2083236893
    unixtime: 1231006505

    Coinbase: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

    PubkeyScript: 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac

    Merkle Hash: 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a
    Byteswapped: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
    Generating block...

    Block found!
    Hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
    Nonce: 2083236893
    Unix time: 1231006505

didn't work for peercoin  Roll Eyes

==MuBdI BlockStream Platform - Future Blockchain Platform==
==Open Hire Developer Using Our Services==
Tokenista
Member
**
Offline Offline

Activity: 910
Merit: 14

Everyone join Blurt.blog & Steemit.com


View Profile
August 25, 2018, 07:36:41 AM
 #41

Ethereum Smart Contract pre-compiled
https://github.com/satansdeer/ethereum-token-tutorial
harishbp
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
September 29, 2018, 05:59:03 AM
 #42

Hello,

I am using the below code to generate genesis block. I got the Coinbase, PubkeyScript, Merkle Hash, Byteswapped. However, it is stuck at Generating block... . The Hashes/s and Nonce keep changing. I thought it will just take a few mins to generate the first block. But, generally, how much time does it take to generate the first block? Am I missing something? Should I have changed something in code to generate the first block faster?

Waiting for your reply.

Regards,
Harish

Thanks, it works great for me. I have made small changes to improve it, see https://github.com/liveblockchain/genesisgen

1. Gets invalid result when the timestamp string is longer than 76 bytes, as it has to use `OP_PUSHDATA1(0x4c)` as prefix of the data.

Code:
if (timestamp_len > 76) {
transaction->scriptSig[scriptSig_pos++] = 0x4c;
}

2. Add command line arguments for nonce and unixtime for quick poc test.

Code:
Usage: ./genesis [options] <pubkey> "<timestamp>" <nBits> <startNonce> <unixtime>
$ ./genesis 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" 486604799 2083236893 1231006505
    nBits: 0x1d00ffff
    startNonce: 2083236893
    unixtime: 1231006505

    Coinbase: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

    PubkeyScript: 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac

    Merkle Hash: 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a
    Byteswapped: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
    Generating block...

    Block found!
    Hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
    Nonce: 2083236893
    Unix time: 1231006505
bitcoinforktech
Jr. Member
*
Offline Offline

Activity: 32
Merit: 4


View Profile WWW
October 09, 2020, 03:25:15 AM
 #43

Updated for Blake hashing.

Also demonstrates changing the hashing algorithm for genesis block creation and the block reward.

https://github.com/bitcoinforktech/genesis-block-generator
Tokenista
Member
**
Offline Offline

Activity: 910
Merit: 14

Everyone join Blurt.blog & Steemit.com


View Profile
October 23, 2020, 06:24:36 AM
 #44

Glad to see things like this still happening.

I originally learned from LernCoin
gcrypto
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
April 29, 2021, 05:29:24 PM
 #45

Should this work for pivx clone?

Have tried to use it for a pivx clone that has been running for about 3 years now. Expected that the actual genesis hash of the running chain would be the output after I've input all the required fields, but instead it outputs a different genesis block hash, as well as a different merkle, to what is in the chain/code.

SikkieNL
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
July 19, 2023, 12:16:17 AM
 #46

Does this also work for neoscrypt ?
Pages: 1 2 3 [All]
  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!