Wishing Bitcoin's Whitepaper a Happy 17th Anniversary!
Complete Beginner-Friendly Guide
This guide will walk you through the process of generating Bitcoin P2PKH addresses from mirrored whitepaper sentences. We provide two Python scripts:
Reads all sentences from a text file (Whitepaper_Sentences.txt), mirrors each sentence individually, and generates a P2PKH address for each one.
You can view (and copy) the "Whitepaper_Sentences.txt" file, or click the small 'download' button at the top to download it ready to go here.
A simplified version that focuses on Sentence 7: "A certain percentage of fraud is accepted as unavoidable." - Perfect for quick testing!
Win + R, type cmd, and press EnterCmd + Space, type terminal, and press EnterCtrl + Alt + TType the following command and press Enter:
python --version
Or try:
python3 --version
Python 3.8.0 or higher, you're good to go and can ignore installation step 2 ā Skip to step 3!
Visit the official Python website: https://www.python.org/downloads/
Download the latest version of Python 3 (Python 3.8 or higher recommended).
Open a new terminal and run:
python --version
These scripts require two external libraries: ecdsa and base58.
In your terminal, run the following command:
pip install ecdsa base58
Or if that doesn't work, try:
pip3 install ecdsa base58
Create a new folder on your computer called whitepaper_generator (or any name you prefer).
Ignore this step if using the 'Simple' script (Script 2)
Download the file: Whitepaper_Sentences.txt and place it in your project folder.
Alternatively: Create a new text file called Whitepaper_Sentences.txt in your project folder.
Paste your whitepaper sentences into this file (one or more sentences).
Reads sentences from Whitepaper_Sentences.txt, mirrors each sentence individually, generates a private key (WIF format) and P2PKH address for each sentence, and displays all results in the terminal.
Note: When creating .py files, it's important to ensure the "Save as Type" dropdown is set to 'All Files'
Create a new file using Notepad called Generate.py in your project folder and paste the following code:
# This Python Script mirrors each sentence from a file (Whitepaper_Sentences.txt). # The Script then generates a Private Key, converts to WIF and then to P2PKH addresses. # Each sentence is output in the Terminal for ease of readability. import hashlib import ecdsa import base58 import re def sha256(text): return hashlib.sha256(text.encode('utf-8')).digest() def private_key_from_text(text): """Deterministic private key from text""" return sha256(text) def wif_from_private_key(priv_key_bytes): extended_key = b'\x80' + priv_key_bytes checksum = hashlib.sha256(hashlib.sha256(extended_key).digest()).digest()[:4] wif = base58.b58encode(extended_key + checksum) return wif.decode() def pubkey_from_private_key(priv_key_bytes): sk = ecdsa.SigningKey.from_string(priv_key_bytes, curve=ecdsa.SECP256k1) vk = sk.get_verifying_key() compressed_pubkey = b'\x02' + vk.to_string()[:32] if vk.to_string()[63] % 2 == 0 else b'\x03' + vk.to_string()[:32] return compressed_pubkey def p2pkh_address(pubkey_bytes): ripemd160 = hashlib.new('ripemd160') ripemd160.update(hashlib.sha256(pubkey_bytes).digest()) hashed_pubkey = ripemd160.digest() extended = b'\x00' + hashed_pubkey checksum = hashlib.sha256(hashlib.sha256(extended).digest()).digest()[:4] address = base58.b58encode(extended + checksum) return address.decode() def split_sentences(text): """Split text into sentences using punctuation""" sentences = re.split(r'(?<=[.!?:])\s+', text) return [s.strip() for s in sentences if s.strip()] if __name__ == "__main__": # Read the paragraphs from base file file_name = "Whitepaper_Sentences.txt" try: with open(file_name, "r", encoding="utf-8") as f: paragraph = f.read() except FileNotFoundError: print(f"File '{file_name}' not found. Please create it and paste your paragraph(s) inside.") exit(1) # Split into sentences first sentences = split_sentences(paragraph) print("\n====================================================") print("š Whitepaper Sentence Address Generator Starting š") print("====================================================\n") for i, sentence in enumerate(sentences, start=1): mirrored = sentence[::-1] # Mirror each sentence individually. priv_key_bytes = private_key_from_text(mirrored) wif = wif_from_private_key(priv_key_bytes) pubkey = pubkey_from_private_key(priv_key_bytes) address = p2pkh_address(pubkey) print(f"\nš Sentence {i}: '{sentence}'") print(f"š Mirrored: '{mirrored}'") print(f"š Private Key (WIF): {wif}") print(f"š¦ P2PKH Address: {address}") print(f" ") print(f"====================================================")
(Easiest:) Right click in your project folder and select "Open in Terminal", then skip to step 2 and ignore the 'cd path/...' command below, or:
Open your terminal from any other directory and navigate to your project folder via:
cd path/to/your/whitepaper_generator_folder
python Generate.py
Or:
python3 Generate.py
A simplified version focusing on Sentence 7: "A certain percentage of fraud is accepted as unavoidable." This script has the sentence hardcoded, so no external text file is needed. Perfect for quick testing!
Create a new file called Simple.py in your project folder and paste the following code:
# Mirrors a sentence and generates a P2PKH address. import hashlib import ecdsa import base58 def p2pkh_from_text(text): # Deterministic private key from text priv_key = hashlib.sha256(text.encode('utf-8')).digest() # Generate compressed public key sk = ecdsa.SigningKey.from_string(priv_key, curve=ecdsa.SECP256k1) vk = sk.get_verifying_key() compressed_pubkey = b'\x02' + vk.to_string()[:32] if vk.to_string()[63] % 2 == 0 else b'\x03' + vk.to_string()[:32] # Generate P2PKH address hashed_pubkey = hashlib.new('ripemd160', hashlib.sha256(compressed_pubkey).digest()).digest() extended = b'\x00' + hashed_pubkey checksum = hashlib.sha256(hashlib.sha256(extended).digest()).digest()[:4] address = base58.b58encode(extended + checksum) return address.decode() if __name__ == "__main__": sentence = "A certain percentage of fraud is accepted as unavoidable." mirrored = sentence[::-1] address = p2pkh_from_text(mirrored) print(f"Original: {sentence}") print(f"Mirrored: {mirrored}") print(f"P2PKH Address: {address}")
(Easiest:) Right click in your project folder and select "Open in Terminal", then skip to step 2 and ignore the 'cd path/...' command below, or:
Open your terminal from any other directory and navigate to your project folder via:
cd path/to/your/whitepaper_generator_folder
python Simple.py
Or:
python3 Simple.py
Make sure Python is installed and added to your PATH. Try using python3 instead of python.
You need to install the dependencies: pip install ecdsa base58
Make sure the text file is in the same folder as your Python script and the filename is exactly Whitepaper_Sentences.txt.
Double-check that you copied the code correctly, including all indentation. Python is sensitive to indentation!
Whitepaper_Sentences.txt is downloaded and in the same project folder.Generate.py with the full script mentioned above."Open in Terminal"python Generate.pySimple.py with the simplified script above."Open in Terminal"python Simple.py