Yo, I have been trying my luck on python to solve puzzle don't judge me as I am Salesforce developer
I am working on prefix incrementing that I think for it to work i should be extremely lucky does anyone know to increase speed or something :-
import hashlib
import base58
import ecdsa
addr=['12VVRNPi4SJqUTsp6FmqDqY5sGosDtysn4','1JTK7s9YVYywfm5XUH7RNhHJH1LshCaRFR','1PWo3JeB9jrGwfHDNpdGK54CRas7fsVzXU']
import random
def decimal_to_compressed_btc_ecdsa(private_key_int):
"""Fastest using ecdsa's C-optimized SECP256k1 implementation"""
# Convert to bytes
private_key_bytes = private_key_int.to_bytes(32, 'big')
# Generate compressed public key (C-optimized)
sk = ecdsa.SigningKey.from_string(private_key_bytes, curve=ecdsa.SECP256k1)
vk = sk.get_verifying_key()
compressed_pubkey = b'\x02' + vk.pubkey.point.x().to_bytes(32, 'big') if vk.pubkey.point.y() & 1 == 0 else b'\x03' + vk.pubkey.point.x().to_bytes(32, 'big')
# Hash and encode
sha256_hash = hashlib.sha256(compressed_pubkey).digest()
ripemd160 = hashlib.new('ripemd160')
ripemd160.update(sha256_hash)
pubkey_hash = ripemd160.digest()
payload = b'\x00' + pubkey_hash
checksum = hashlib.sha256(hashlib.sha256(payload).digest()).digest()[:4]
return base58.b58encode(payload + checksum).decode()
min=1180591620717411303424
#min=1180591620757415303424
start=1180
#start=2000
end=4722
end=9999
cc=0
k=random.randint(min,min*3)
while True:
cc=cc+1
if start>=end:
start=1180
# print(jcc)
k=9999999999999999999999-random.randint(100000000000000000,1000000000000000000)
k_str = str(k)
rest = k_str[4:] # Get last 6 digits
k = int(str(start) + rest) # Replace first 4 digits with start
if True:
# k=k-1
start = start+1
k=k
d=decimal_to_compressed_btc_ecdsa(k)
print(k,len(str(k)),d)
if d in addr:
print('yes')
print(k,d)
break
bugs
- `k_str[4:]` gets everything after first 4 chars, not last 6 digits. use `k_str[-6:]` if you want last 6
- tail set once per cycle, never changes. 8820 keys per random tail, not 8820 × random
- `end=9999` searches prefixes 2362-9999 which are above 2^71. valid prefixes: 1180 to 2361. 75% wasted
- `k = k` on line 59 does nothing
- wrap-around randint gives 9-heavy tails (subtracting from all-9s). all keys look like `1180999...`
- no checkpoint - crash = lose all progress
- `cc` counter incremented but never printed or used
speed
- pure python ecdsa: ~100 keys/s. need millions/s minimum
- string conversion every iteration (`str(k)`, `str(start)`) is slow
- base58 encode on every key is the bottleneck. check hash160 first, only base58 on match
- new SigningKey object every iteration - reuse or use coincurve
- single-threaded. use multiprocessing or a compiled scanner
- 2^70 keys at 100/s = 374 billion years. current CPU python cannot solve p71 with brute force unless you get lucky
replacements
- `ecdsa` → `coincurve` (50,000 keys/s vs 100)
- `base58` → inline only for matches, check hash160 first
- `random.randint` → `secrets.randbits(71)` for direct 71-bit generation
- string concat prefix method → just generate keys in [2^70, 2^71) directly
what actually works for 71-bit
- **KeyHunt** (albert0bsd) - CUDA address mode, range search
- **VanitySearch** (JeanLucPons) - CUDA, prefix matching, billions/sec
- **BitCrack** - OpenCL, AMD support
python CPU search will not finish. 71 bits needs GPU or a direct calculation of the key