Please leave personal issue lets fight on our basic issue like hex, Bit, Bytes, WIF , Hash160 using the compressed hash160 which is f6f5431d25bbf7b12e8add9af5e3475c44a0a5b8 is i think more wise thing as a target it will deduct a few load on our device as my pc is core i3 it helped me if you find it good opetion here is my code
import ecdsa
from ecdsa import SECP256k1
import hashlib
import time
import random
import os
from datetime import datetime
start_hex = "794B37D30000000000"
end_hex = "794B37D3FFFFFFFFFF"
target_hash160 = "f6f5431d25bbf7b12e8add9af5e3475c44a0a5b8".lower()
start_int = int(start_hex, 16)
end_int = int(end_hex, 16)
range_size = end_int - start_int
desktop = os.path.join(os.path.expanduser("~"), "Desktop")
output_file = os.path.join(desktop, "found_keys.txt")
def hex_to_compressed_hash160(hex_value):
priv_key = hex_value.to_bytes(32, byteorder='big')
sk = ecdsa.SigningKey.from_string(priv_key, curve=SECP256k1)
vk = sk.get_verifying_key()
if vk.pubkey.point.y() & 1:
pub_key_compressed = bytes([0x03]) + vk.pubkey.point.x().to_bytes(32, byteorder='big')
else:
pub_key_compressed = bytes([0x02]) + vk.pubkey.point.x().to_bytes(32, byteorder='big')
sha256 = hashlib.sha256(pub_key_compressed).digest()
ripemd160 = hashlib.new('ripemd160')
ripemd160.update(sha256)
hash160 = ripemd160.hexdigest()
return pub_key_compressed.hex(), hash160
def save_found_key(private_hex, pub_key, hash160, keys_checked, elapsed_time):
with open(output_file, "a") as f:
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
f.write("\n" + "="*70 + "\n")
f.write(f"BITCOIN PRIVATE KEY FOUND - {timestamp}\n")
f.write("="*70 + "\n")
f.write(f"Private Key (HEX): {private_hex}\n")
f.write(f"Private Key (DEC): {int(private_hex, 16)}\n")
f.write(f"Compressed Public Key: {pub_key}\n")
f.write(f"Hash160: {hash160}\n")
f.write("\nAdditional Info:\n")
f.write(f"Total Keys Checked: {keys_checked:,}\n")
f.write(f"Search Time: {elapsed_time:.2f} seconds\n")
f.write(f"Speed: {keys_checked/elapsed_time:,.0f} keys/sec\n")
f.write("="*70 + "\n\n")
def print_match_info(keys_checked, current_hex, elapsed_time, pub_key, hash160, match_len):
print("\n" + "-"*70)
print(f"New best partial match found:")
print(f"Matching characters: {match_len}")
print(f"Private Key: {current_hex}")
print(f"Public Key: {pub_key[:20]}...{pub_key[-20:]}")
print(f"Hash160: {hash160}")
print(f"Total Keys Checked: {keys_checked:,}")
print(f"Elapsed Time: {elapsed_time:.2f} seconds")
print(f"Speed: {keys_checked/elapsed_time:,.0f} keys/sec")
print("-"*70 + "\n")
with open(output_file, "w") as f:
f.write("Bitcoin Private Key Search Log\n")
f.write(f"Start Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
f.write(f"Search Range: {start_hex} to {end_hex}\n")
f.write(f"Target Hash160: {target_hash160}\n")
f.write("="*70 + "\n\n")
best_match_len = 0
best_match_private = ""
best_match_hash160 = ""
start_time = time.time()
keys_checked = 0
last_pub_key = ""
last_hash160 = ""
current_hex = ""
# Main loop
print(f"\n{' BITCOIN PRIVATE KEY SCANNER ':=^70}")
print(f"{'Random Search Mode':^70}")
print(f"{'='*70}")
print(f"Search Range: {start_hex} to {end_hex}")
print(f"Target Hash160: {target_hash160}")
print(f"Output File: {output_file}")
print(f"{'='*70}\n")
try:
while True:
random_int = random.randint(start_int, end_int)
current_hex = format(random_int, 'x').zfill(len(start_hex))
pub_key_compressed, hash160 = hex_to_compressed_hash160(random_int)
keys_checked += 1
last_pub_key = pub_key_compressed
last_hash160 = hash160
match_len = len(os.path.commonprefix([hash160, target_hash160]))
if match_len == 40:
elapsed = time.time() - start_time
print("\n" + "!"*70)
print(f"!!! MATCH FOUND AFTER {keys_checked:,} KEYS !!!")
print(f"Private Key: {current_hex}")
print(f"Public Key: {pub_key_compressed}")
print(f"Hash160: {hash160}")
print(f"Elapsed Time: {elapsed:.2f} seconds")
print(f"Speed: {keys_checked/elapsed:,.0f} keys/sec")
print("!"*70)
save_found_key(current_hex, pub_key_compressed, hash160, keys_checked, elapsed)
break
elif match_len >= 5 and match_len > best_match_len:
best_match_len = match_len
best_match_private = current_hex
best_match_hash160 = hash160
elapsed = time.time() - start_time
print_match_info(keys_checked, current_hex, elapsed, pub_key_compressed, hash160, match_len)
except KeyboardInterrupt:
elapsed = time.time() - start_time
print("\n\n" + "-"*70)
print(f"SCAN INTERRUPTED BY USER")
print(f"Total Keys Checked: {keys_checked:,}")
print(f"Elapsed Time: {elapsed:.2f} seconds")
print(f"Last Private Key: {current_hex}")
if best_match_len >= 5:
print(f"Best Partial Match Found:")
print(f"Matching Characters: {best_match_len}")
print(f"Private Key: {best_match_private}")
print(f"Hash160: {best_match_hash160}")
else:
print("No partial match of 5 or more characters found.")
print("-"*70)
elapsed = time.time() - start_time
print("\n\n" + "="*70)
print("SCAN COMPLETE - FINAL STATISTICS")
print("="*70)
print(f"Total Keys Checked: {keys_checked:,}")
print(f"Total Time: {elapsed:.2f} seconds")
print(f"Average Speed: {keys_checked/elapsed:,.0f} keys/sec")
print(f"Last Private Key: {current_hex}")
print(f"Last Public Key: {last_pub_key[:20]}...{last_pub_key[-20:]}")
print(f"Last Hash160: {last_hash160}")
print("="*70) use the Hex you need on start_hex and end_hex also you can modify the target hash160
If this helps buy me a coffee by sending some $ on my BTC address 16qw4VqkxSSfKzguDyVzM68jsWw71yEgP4