Skip to content

Instantly share code, notes, and snippets.

@donpdonp
Created June 16, 2023 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donpdonp/163a6bdc7a89afacfc1f75bce7446a13 to your computer and use it in GitHub Desktop.
Save donpdonp/163a6bdc7a89afacfc1f75bce7446a13 to your computer and use it in GitHub Desktop.
bitcoin public key suffix builder/search
# June 2023
# Core I5-8250 thinkpad: 350 keys/second
import os
import sys
import importlib.util
from datetime import datetime
if importlib.util.find_spec('bitcoin') is None:
print("bitcoin module not found. please install https://pypi.org/project/bitcoin/")
sys.exit()
import bitcoin
if len(sys.argv) != 2:
print("Please give a target suffix.")
exit()
addr = ""
count = 0
start = timestamp = datetime.now()
target = sys.argv[1]
target_len = len(target)
print ("finding pubkey ending in", target)
while addr[-target_len:].lower() != target.lower():
bytes = os.urandom(32)
addr = bitcoin.privtoaddr(bytes)
count += 1
if count % 1000 == 0:
now = datetime.now()
duration = now - timestamp
print(1000/duration.total_seconds(), " keys per second. last tested address", addr)
timestamp = now
print("found in", datetime.now() - start)
print("PUBKEY:", addr)
print("privkey bytes:", bytes.hex())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment