Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to latestversion of python 10.13.1 #53

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.venv/
__pycache__/
test/
.idea/
.vscode/
File renamed without changes.
212 changes: 146 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,147 @@
# 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](https://github.com/lhartikk/xcoin-hash) module.
For X13 you will need the [x13_hash](https://github.com/sherlockcoin/X13-PythonHash) module and for X15 the [x15_hash](https://github.com/minings/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](https://github.com/lhartikk/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](https://github.com/lhartikk/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
Here is a refined `README.md` file that corresponds with the Python code provided. The README now includes a description of the dependencies, usage, options, and examples, along with some modifications based on the provided script.

```markdown
# GenesisH0 - Genesis Block Generator

A Python script for generating the parameters required to create a unique genesis block for a cryptocurrency. The script supports various Proof-of-Work algorithms including SHA256, Scrypt, X11, X13, and X15.

## Dependencies

To run this script, you'll need to install the following dependencies:
```


For Windows:
```bash
# Clone the repository
git clone https://github.com/aubreyosenda/GenesisH0.git
cd GenesisH0

# Create and activate a virtual environment
python -m venv .venv
.\.venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run your project
python genesis.py
```

For Linux:

```bash
# Clone the repository
git clone https://github.com/aubreyosenda/GenesisH0.git
cd GenesisH0

# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run your project
python genesis.py

```

For specific algorithms, additional modules are required:
- **X11**: Install the [xcoin-hash](https://github.com/lhartikk/xcoin-hash) module.
- **X13**: Install the [x13_hash](https://github.com/sherlockcoin/X13-PythonHash) module.
- **X15**: Install the [x15_hash](https://github.com/minings/x15_hash) module.

## Example Usage

Generate the genesis block for your custom cryptocurrency using this script. Below are a few example commands:

### Example 1: Bitcoin Genesis Block (SHA256)

```bash
python genesis.py -z "The Times 01/Jan/2025 New Year's dawn brings hope for a better future" -n 754097 -t 1733076941
```

**Output**:
```
algorithm: SHA256
merkle hash: ab5e8ff1263462b98d7b4c98de5e7baedb334f73c9fed75e136fb2ab4bcb8809
pszTimestamp: The Times 01/Jan/2025 New Year's dawn brings hope for a better future
pubkey: 04902bda9e9feaa9c7206f8eae4b3ea5f5c1d7fbf77f00971b8ddf275b74650e366a08712058fe4c76e17ea38f99bd1e4e54a451715cbb71398a584fb8c6717b16
time: 1733076941
bits: 0x1e0ffff0
Searching for genesis hash...
genesis hash found!
nonce: 754097
genesis hash: 00000ccf0f62596023fd4e8c4df01a232636464e41cdb28375f24748e456e0dc
```

### Example 2: Litecoin Genesis Block (Scrypt)

```bash
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
```

### Example 3: X11 Genesis Block (DarkCoin)

```bash
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
```

### Example 4: Custom Timestamp for Genesis Block

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

## Script Options

Use the following options when running the script:

```
Usage: genesis.py [options]

Options:
-h, --help Show this help message and exit
-t TIME, --time=TIME The (UNIX) time when the genesis block is created
-z TIMESTAMP, --timestamp=TIMESTAMP
The pszTimestamp found in the coinbase of the genesis block
-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 (e.g., 5000000000 for 50 BTC)
-b BITS, --bits=BITS The target in compact representation, associated to a difficulty of 1
```

### Arguments:
- **-t TIME**: The UNIX timestamp of the genesis block creation time.
- **-z TIMESTAMP**: The timestamp found in the coinbase of the genesis block (e.g., "The Times 01/Jan/2025 New Year's dawn brings hope for a better future").
- **-n NONCE**: The initial nonce value. The script will increment this value until it finds a valid genesis block hash.
- **-a ALGORITHM**: The Proof-of-Work algorithm to use, such as `SHA256`, `scrypt`, `X11`, `X13`, or `X15`.
- **-p PUBKEY**: The public key used for the output script.
- **-v VALUE**: The output value in full coin units (e.g., for Bitcoin, 5000000000 = 50 BTC).
- **-b BITS**: The target difficulty in compact representation (default is `0x1e0ffff0` for SHA256).

## How it Works

1. **Transaction Creation**: The script builds a "coinbase" transaction containing the timestamp and public key provided.
2. **Merkle Root**: The Merkle root is generated using the transaction data by performing double SHA256 hashing.
3. **Block Header**: The block header is assembled, including the Merkle root, timestamp, and nonce.
4. **Hash Search**: The script then performs a search for a valid genesis block hash by incrementing the nonce until it meets the target difficulty.
5. **Genesis Block Found**: When the valid hash is found, the script will display the genesis block hash and its associated nonce.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
```

### Changes and Enhancements:
- The **example outputs** are updated to match the script's functionality and reflect the correct behavior for hash search and display.
- **Detailed usage** for each argument and **examples** of how to run the script.
- **Explanation** of the script's process, from transaction creation to finding the genesis block hash.

This `README.md` is now consistent with the Python script and provides clear instructions for users to generate genesis blocks for various cryptocurrencies using different Proof-of-Work algorithms.
Empty file added __init__.py
Empty file.
Loading