Pages:
Author

Topic: [ANN] Genesis Block Generator (Read 30836 times)

newbie
Activity: 23
Merit: 0
July 18, 2023, 08:16:17 PM
#46
Does this also work for neoscrypt ?
newbie
Activity: 9
Merit: 0
April 29, 2021, 01: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.

member
Activity: 910
Merit: 14
Everyone join Blurt.blog & Steemit.com
October 23, 2020, 02:24:36 AM
#44
Glad to see things like this still happening.

I originally learned from LernCoin
jr. member
Activity: 32
Merit: 4
October 08, 2020, 11:25:15 PM
#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
newbie
Activity: 2
Merit: 0
September 29, 2018, 01: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] ""
$ ./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
member
Activity: 910
Merit: 14
Everyone join Blurt.blog & Steemit.com
August 25, 2018, 03:36:41 AM
#41
Ethereum Smart Contract pre-compiled
https://github.com/satansdeer/ethereum-token-tutorial
sr. member
Activity: 868
Merit: 250
Founder Nur1Labs
August 02, 2018, 09:51:10 AM
#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] ""
$ ./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
newbie
Activity: 85
Merit: 0
May 19, 2018, 02:32:48 AM
#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!
member
Activity: 61
Merit: 15
April 18, 2018, 04: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] ""
$ ./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
newbie
Activity: 4
Merit: 0
February 17, 2018, 05: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
member
Activity: 322
Merit: 54
Consensus is Constitution
February 11, 2018, 12: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!
full member
Activity: 235
Merit: 100
April 20, 2017, 04:51:48 PM
#35
2014 methods no longer work.
2017 Bitcoin / Litecoin codebase update
http://practicecoin.com/index.php/2017/04/19/genesis-block/
newbie
Activity: 17
Merit: 0
December 17, 2014, 09:59:17 PM
#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.
sr. member
Activity: 308
Merit: 250
Riecoin and Huntercoin to rule all!
May 03, 2014, 02: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.
sr. member
Activity: 280
Merit: 250
Bitnation Development Team Member
April 27, 2014, 06:29:13 PM
#32
Awesome work! Having a lot of fun playing with this.
sr. member
Activity: 470
Merit: 250
Better to have 100 friends than 100 rubles
February 18, 2014, 02: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.)

legendary
Activity: 1064
Merit: 1000
February 18, 2014, 01: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).
newbie
Activity: 5
Merit: 0
February 18, 2014, 01: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?
legendary
Activity: 1064
Merit: 1000
February 17, 2014, 06: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.
newbie
Activity: 5
Merit: 0
February 17, 2014, 02: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?
Pages:
Jump to: