Code Monkey home page Code Monkey logo

genesish0's Introduction

GenesisH0

A python script for creating the parameters required for a unique genesis block. SHA256/scrypt/X11/X13/X15.

Dependencies

sudo pip install scrypt construct==2.5.2

To create geneses based on X11 algorithm you will also need to install the xcoin-hash module. For X13 you will need the x13_hash module and for X15 the x15_hash module.

Examples

Create the original genesis hash found in Bitcoin

python genesis.py -z "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" -n 2083236893 -t 1231006505

Output:

algorithm: sha256
merkle hash: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
pszTimestamp: The Times 03/Jan/2009 Chancellor on brink of second bailout for banks
pubkey: 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f
time: 1231006505
bits: 0x1d00ffff
Searching for genesis hash..
genesis hash found!
nonce: 2083236893
genesis hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

Create the regtest genesis hash found in Bitcoin

python genesis.py -z "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" -n 2 -t 1296688602 -b 0x207fffff

Create the original genesis hash found in Litecoin

python genesis.py -a scrypt -z "NY Times 05/Oct/2011 Steve Jobs, Apple’s Visionary, Dies at 56" -p "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9" -t 1317972665 -n 2084524493

Create a unique genesis hash with custom pszTimestamp

python genesis.py -a scrypt -z "Time flies like an arrow. Fruit flies like a banana."

Create the original genesis hash found in DarkCoin. (requires xcoin-hash)

python genesis.py -a X11 -z "Wired 09/Jan/2014 The Grand Experiment Goes Live: Overstock.com Is Now Accepting Bitcoins" -t 1317972665 -p "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9" -n 28917698 -t 1390095618 -v 5000000000

Create the original genesis hash found in HiroCoin (requires xcoin-hash).

python genesis.py -a X11 -z "JapanToday 13/Mar/2014 Ways eyed to make planes easier to find in ocean" -p "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9" -n 1234746574 -t 1394723131 -v 40000000000

Options

Usage: genesis.py [options]

Options:
  -h, --help show this help message and exit
  -t TIME, --time=TIME  the (unix) time when the genesisblock is created
  -z TIMESTAMP, --timestamp=TIMESTAMP
     the pszTimestamp found in the coinbase of the genesisblock
  -n NONCE, --nonce=NONCE
     the first value of the nonce that will be incremented
     when searching the genesis hash
  -a ALGORITHM, --algorithm=ALGORITHM
     the PoW algorithm: [SHA256|scrypt|X11|X13|X15]
  -p PUBKEY, --pubkey=PUBKEY
     the pubkey found in the output script
  -v VALUE, --value=VALUE
     the value in coins for the output, full value (exp. in bitcoin 5000000000 - To get other coins value: Block Value * 100000000)
  -b BITS, --bits=BITS
     the target in compact representation, associated to a difficulty of 1

genesish0's People

Contributors

filipe3x avatar jojva avatar lhartikk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

genesish0's Issues

merkle hash -- mismatch?

I have a hashMerkelRoot from the first failed run of my client ("563d1a..."), but when I run GenesisH0 it displays a completely unrelated "merkle hash" ("d87298...") despite having the same pszTimestamp, and nTime.

I may be misunderstanding the relationship, if anyone can provide any insight.

ERROR

2017-08-10 00:31:33 Initializing databases... 2017-08-10 00:31:33 Pre-allocating up to position 0x1000000 in blk00000.dat 2017-08-10 00:31:33 - Load block from disk: 0.00ms [0.00s] 2017-08-10 00:31:33 ERROR: CheckBlock(): CheckTransaction of 6848078bf09a108b80259a321eefce41c894905e086ac16ad6d8b501a8e67aa8 failed with bad-cb-length (code 16) 2017-08-10 00:31:33 InvalidChainFound: invalid block=000000ead5fac071a771c1f10e0dd70ab5095b3ad148b82e31004f2f40949769 height=0 log2_work=20.000022 date=2017-08-07 23:59:59

Setup of GenesisH0 fails at pip install

Hi, this setup fails with a lot of errors thrown. Likely cause might be the scrypt version, as pip automatically fetches the 0.18.x version which might be incompatible with the construct 2.5.x version.

The script doesn't work with Python 3.x as well

Script Crashes after 7 hours of mining.

Hello.
I'm using this script to mine a sha256 genesis block but after 7 hours of mining it crashes with this error.
Note: The script actually works if i start it without any parameters(by doing so i presume i mine satoshi's genesis block and it works )

bits: 0x1d00ffff
Searching for genesis hash..
179738.0 hash/s, estimate: 6.6 hTraceback (most recent call last):
  File "genesis.py", line 203, in <module>
    main()
  File "genesis.py", line 20, in main
    genesis_hash, nonce = generate_hash(block_header, algorithm, options.nonce, options.bits)
  File "genesis.py", line 140, in generate_hash
    data_block = data_block[0:len(data_block) - 4] + struct.pack('<I', nonce)
struct.error: 'I' format requires 0 <= number <= 4294967295

How to generate genesis block for the test net?

Is there a special flag or option I need to include when generating a genesis block for the testnet?

I am receiving invalid errors at compile time, any help would be really appreciated guys :)
Thanks

command line in Example failed

python genesis.py -a scrypt -z "NY Times 05/Oct/2011 Steve Jobs, Apple’s Visionary, Dies at 56" -p "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9" -t 1317972665 -n 2084524493

04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536
Traceback (most recent call last):
File "genesis.py", line 203, in
main()
File "genesis.py", line 15, in main
tx = create_transaction(input_script, output_script,options)
File "genesis.py", line 74, in create_transaction
Bytes("version", 4),
TypeError: init() takes exactly 2 arguments (3 given)

Not working with hirocoin (or almost any X11 coin)

Hey
I tested your python script with DarkCoin and works perfectly, however, when I test with other X11 coins it never works.

python genesis.py -a X11 -z "JapanToday 13/Mar/2014 Ways eyed to make planes easier to find in ocean" -p "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9" -n 1234746574 -t 1394723131

It should give the following hash: 000002ba782d377ee807487d2171c47348821e89ba0a59ade6776e02f53054f1
See: https://github.com/HiroSatou/Hirocoin/blob/master-0.8.6/src/main.cpp#L35

too slow?

hi, i did run this command

$ python genesis.py -a scrypt -z "Time flies like an arrow. Fruit flies like a banana."

she said

============

$ python genesis.py -a scrypt -z "Time flies like an arrow. Fruit flies like a banana."
04ffff001d01043454696d6520666c696573206c696b6520616e206172726f772e20467275697420666c696573206c696b6520612062616e616e612e
algorithm: scrypt
merkle hash: 52b2455696516c14fde6fb8bf13891f34a49b339b99aa863942e5cd54db71fc1
pszTimestamp: Time flies like an arrow. Fruit flies like a banana.
pubkey: 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f
time: 1522333235
bits: 0x1e0ffff0
Searching for genesis hash..

=============

how long i have to wait?

many thanks!

Unable to recreate PIVX Genesis Hash

Hi I'm trying to get familiar with the PIVX codebase but when trying to re-create the PIVX genesis hash i can't seen to find the same result.

python genesis.py -z "U.S. News & World Report Jan 28 2016 With His Absence, Trump Dominates Another Debate" -p "04c10e83b2703ccf322f7dbd62dd5855ac7c10bd055814ce121ba32607d573b8810c02c0582aed05b4deb9c4b77b26d92428c61256cd42774babea0a073b2ed0c9" -n 2402015 -t 1454124731 -b "0x1e0ffff0" -a X11 -v 25000000000

returns
genesis hash: 0000033448b9dd0bb0e3793cf11841a752554af9d1a2bd082567d0736af5f037

But i am expecting this has to be returned 0x0000041e482b9b9691d98eefb48473405c0b8ec31b76df3797c74a78680ef818

What am i missing?

Scrypt Gen Hash

Does it usually take a while to generate the genesis hash? If so close this issue. Should consider getting a forum of some sort. I can make a section for you.

SHA 256 MERKLE ROOT problem.

Hello,

When i try to run my coin-qt i'l get this error.

Terminal :

Code:

./rhinoxcoin-qt
rhinoxcoin-qt: src/main.cpp:2802: bool InitBlockIndex(): Assertion `block.hashMerkleRoot == uint256("0xc3e530365aa74d32d5115aab6feb707ce72d82ee72b8693b213751b5e4ceaf7e")' failed.
Aborted (core dumped)

Debug log :

Code:

2018-04-24 11:29:57 Rhinoxcoin version v0.8.6.0-g9d11aba4c477-beta ()
2018-04-24 11:29:57 Using OpenSSL version OpenSSL 1.0.2g  1 Mar 2016
2018-04-24 11:29:57 Default data directory /home/dave/.rhinoxcoin
2018-04-24 11:29:57 Using data directory /home/dave/.rhinoxcoin
2018-04-24 11:29:57 Using at most 125 connections (1024 file descriptors available)
2018-04-24 11:29:57 Using 4 threads for script verification
2018-04-24 11:29:57 init message: Verifying wallet...
2018-04-24 11:29:57 dbenv.open LogDir=/home/dave/.rhinoxcoin/database ErrorFile=/home/dave/.rhinoxcoin/db.log
2018-04-24 11:29:57 Bound to [::]:2333
2018-04-24 11:29:57 Bound to 0.0.0.0:2333
2018-04-24 11:29:57 init message: Loading block index...
2018-04-24 11:29:57 Opening LevelDB in /home/dave/.rhinoxcoin/blocks/index
2018-04-24 11:29:57 Opened LevelDB successfully
2018-04-24 11:29:57 Opening LevelDB in /home/dave/.rhinoxcoin/chainstate
2018-04-24 11:29:57 Opened LevelDB successfully
2018-04-24 11:29:57 LoadBlockIndexDB(): last block file = 0
2018-04-24 11:29:57 LoadBlockIndexDB(): transaction index disabled
2018-04-24 11:29:57 Initializing databases...
2018-04-24 11:29:57 a7ad3499136bfb1d2cfbfb94ad8e1d28b447ea8b29bb40076cdf82572e224d39
2018-04-24 11:29:57 00000000a92bc246551b51a7b3794903d926cd3eeac2bc235eb243da88041d95
2018-04-24 11:29:57 55fb2cea67523e56269a3ab7c6d2db681e7c920421f324068658044bf13706f1

I have created a genenis hash for the main net and test net using the script but cannot get it to work..

Using the following data :

Scriptpubkey: 041c412c1c519b891fe3c6e23a31c99c76a61a1d76740aa7e44cef513b53bf8ab07f230db005313eb6e7328b4da569eafa36c33013d54c8677cc75db7667937a56
PSZTIMESTAMP : NY TIMES 23 APRIL 2018Avengers the Most Lucrative Movie Franchise Ever Is Wrapping Up Why
ALGORITHM : SHA256 
EPOCH TIME : auto
Code:
MAIN NET :
 
GENESISHASH: 00000000a92bc246551b51a7b3794903d926cd3eeac2bc235eb243da88041d95
TIME : 1524508661
NONCE : 1189467988
MERKLE : c3e530365aa74d32d5115aab6feb707ce72d82ee72b8693b213751b5e4ceaf7e
 

TEST NET :

GENESISHASH: 000000005794bc41eaabeaff7ae7ff99c632add8066f92d7a3c252ceb9e0c2af
TIME : 1524559326
NONCE:  1706123325
MERKLE : c3e530365aa74d32d5115aab6feb707ce72d82ee72b8693b213751b5e4ceaf7e

It seems that something is wrong with the merkle root, any solutions , or am i doing something wrong here ?

Greetings Dave.

not match: nounce, pubkey

Dear lhartikk,

Thanks so much for nice script! However I would something to ask.

I did:

python genesis.py -a scrypt -z "cryptozeny" -p "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9" -t 1317972665 -n 2084524493 -b 0x1e0ffff0 -v 5000000000

Then I got:

04ffff001d01040a63727970746f7a656e79 (NOT MATCH!)
algorithm: 	scrypt
merkle hash: 	fcb36080a092ef7db301b9ca554e7de168c65a8bb7b713a27c25ba13b4889775
pszTimestamp: 	cryptozeny
pubkey: 	040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9
time: 		1317972665
bits: 		0x1e0ffff0
Searching for genesis hash..
genesis hash found!
nonce: 		2084696154 (NOT MATCH!)
genesis hash: 	e0b5406c6382fbba62d8137f3fedba205c1eed8f83137b675e84c1b5356e379f

pubkey:

040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9

is changed to

04ffff001d01040a63727970746f7a656e79

nounce:

2084524493 is changed to 2084696154

Why not match? Anyway Thanks!

Decred Support

Hello! GenesisH0 gets support for generate genesis to Decred clone?

Not enough arguments

This is the error it gives me for Python 2.711

I installed construct via pip, and scrypt via pip and everything seemed to install fine. However this is the error i get.

Bytes("version", 4),
TypeError: init() takes exactly 2 arguments (3 given)

Scrypt genesis not accepted by Litecoin daemon

Hi
thank you for this project!

I've made a Litecoin fork to test the genesis generated with your code :
https://github.com/pinkvoid/litecoin

I've replace the main network values with the ones generated here :
https://github.com/pinkvoid/litecoin/commit/50b97d5902efc81b64fadf1114c090fd281a4600

Genesis output from genesis.py :

04ffff001d01040474657374
algorithm: scrypt
merkle hash: 48e018418349a81c127028f492dc203fb30f095c602876b98bf923e6def2152a
pszTimestamp: test
pubkey:  04252FC5FFBF8AA6555D6FAECAEC892D08DA0101C52E0E13EECC90E21A804BC09D7AC7FB23AEA93A0A5AA3AD8E3C676C543041106D810C0E9A9BD6BBB20EBF3822
time: 1602132284
bits: 0x1e0ffff0
Searching for genesis hash..
genesis hash found!
nonce: 594464
genesis hash: 2ede31b0e694796ccfa3c7f10231b211d40b604938eb66faa61976de9b249354

When launching the daemon the following error appears :

./src/litecoind
litecoind: chainparams.cpp:119: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0x2ede31b0e694796ccfa3c7f10231b211d40b604938eb66faa61976de9b249354")' failed.

and when dumping the calculated hashGenesisBlock with std::cout << genesis.ToString();

CBlock(hash=645d633ab5de9b10d7ccf9ec8d7dee4382be34f2b6d283fdaeea61c012a00840,  ver=0x00000001,  hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000,  hashMerkleRoot=083ecb76845e08af9cde397ae24f90f35e4f62eeba2d2ce1ea2558a61de5cab6,  nTime=1602132284, nBits=1e0ffff0, nNonce=594464, vtx=1)
    CTransaction(hash=083ecb7684, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000, 4294967295), coinbase 04ffff001d01040474657374)
    CScriptWitness()
    CTxOut(nValue=50.00000000, scriptPubKey=0c04ffff001d01040474657374ac)

which shows a different caculated genesis hash and merkle root hash.

Any hints on how to find out why genesis.py's output isn't considered as valid in this case?

Thanks!

Error in X11

Hello, how is everything?
When I try to generate no X11 algorithm this appears, how can I solve it?

image

Support for Scrypt-n

Could work "out-of-the-box" but would still need an example use case in Readme.md

value for POS coin

Hello,

where is the -v VALUE in the pos coins code??

txNew.vout[0].SetEmpty(); ???

this no longer works - for litecoin scrypt fork

this just doesn't work. you will waste your time and regret it.
if you're reading the issues, you've already decided the generator doesn;t work.
I tried to fork litecoin and i used this generator and it doesn't like the results being added to the chainparams file.
also, the instructions are very vague and pretty much so poorly written that no one can understand what to do with the instructions.
there are people on the internet who have failed so badly with this generator that they stopped trying to fork litecoin into an altcoin and went with another coin.

Find faster the genesis hash for SHA256

-Currently takes a couple of hours (average >4h)
-Figure out how to find sha256 hashes faster :)
-No dependencies to C libraries or any other non-python libraries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.