Show Posts
|
Pages: [1] 2 3 »
|
1
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: April 08, 2024, 07:11:40 PM
|
I started my project few years ago, when puzzle-64 still had balance. I was away of this forum for a very long time.....
This is written in your readme: BINGO! (In the rare case of finding some private key with balance): Import the WIF into a fully synced Bitcoin Core node. If not sure how to do that, contact me by email (japeralsoler@gmail.com) attaching the 'found.txt' file.Do you think people are idiots? You even without a twinge of conscience ask to send a file with the found private key to your email!
|
|
|
2
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: March 21, 2024, 07:39:03 PM
|
Hello everyone.
I need a Python script that would check two text files, and if the text in the lines matches, then the script would write “Match found” and write the matching text to a new file. If there is no match, then it would write “No matches found.”
Can anyone help?
Something like this: def check_files(file1, file2, output_file): with open(file1, 'r') as f1, open(file2, 'r') as f2: lines1 = f1.readlines() lines2 = f2.readlines()
matches = [line for line in lines1 if line in lines2]
with open(output_file, 'w') as out: if matches: print("Match found") for match in matches: out.write(match) else: print("No matches found")
check_files('file1.txt', 'file2.txt', 'matches.txt')
Thank you! This is what I need!
|
|
|
5
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: October 27, 2023, 09:58:16 PM
|
What did you try? Did you try running as administrator? Sometimes I used to get that error, I don't know the exact reason, because it wasn't always happening. It just returns that error because your system doesn't allow the script to open the text file, maybe change your directory? Try like this if you are using windows, type in search box inside BTCPazzle folder, type cmd and hit enter, then type python test.py hit enter, this should fix it. [/quote] I tried everything. I ran it with administrator rights and changed the directory. Useless. Moreover, if you do not write the received data to a file, but simply display it on the screen, then the script works great.
|
|
|
6
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: October 27, 2023, 09:16:26 PM
|
subtract G 99 times from target, you will have 100 keys in total, then divide them all by 100, one of the results will definitely be the target/100. Then come here ask me what's next. But first I would need to test your script to see if it does what I said.😉
Hello, is this what you need? import secp256k1 as ice import bitcoin
target= "03633cbe3ec02b9401c5effa144c5b4d22f87940259634858fc7e59b1c09937852" print("Target:", target) Target_upub= ice.pub2upub(target)
for i in range (100): A= ice.scalar_multiplication(i) B= ice.point_subtraction(Target_upub, A) C= ice.to_cpub(B.hex()) D= bitcoin.divide(C, 100)
data = open("S-1.txt","a") data.write(str(i)+" = "+str(C)+"\n") data.close()
data = open("D-1.txt","a") data.write(str(i)+" = "+str(D)+"\n") data.close() Hello. Tell me how to remove this error? PermissionError: [Errno 13] Permission denied:No matter what I tried, it didn't work... C:\BTCPazzle>test.py Target: 0230210c23b1a047bc9bdbb13448e67deddc108946de6de639bcc75d47c0216b1b Traceback (most recent call last): File "C:\BTCPazzle>test.py", line 20, in <module> data = open("D-1000.txt","a") PermissionError: [Errno 13] Permission denied: "D-1000.txt"
|
|
|
7
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: October 12, 2023, 08:39:54 PM
|
I don't have any error on multiple machines. Make sure that is at least python3.9 installed. I changed the order of the code a bit. If there is still an error, something is wrong with python there. import sys import os import time import random import hashlib import gmpy2 from gmpy2 import mpz from functools import lru_cache import multiprocessing from multiprocessing import Pool, cpu_count
os.system("clear")
# Constants MODULO = gmpy2.mpz(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F) ORDER = gmpy2.mpz(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141) GX = gmpy2.mpz(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798) GY = gmpy2.mpz(0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8)
# Define Point class class Point: def __init__(self, x=0, y=0): self.x = x self.y = y
PG = Point(GX, GY) ZERO_POINT = Point(0, 0)
# Function to multiply a point by 2 def multiply_by_2(P, p=MODULO): c = gmpy2.f_mod(3 * P.x * P.x * gmpy2.powmod(2 * P.y, -1, p), p) R = Point() R.x = gmpy2.f_mod(c * c - 2 * P.x, p) R.y = gmpy2.f_mod(c * (P.x - R.x) - P.y, p) return R
# Function to add two points def add_points(P, Q, p=MODULO): dx = Q.x - P.x dy = Q.y - P.y c = gmpy2.f_mod(dy * gmpy2.invert(dx, p), p) R = Point() R.x = gmpy2.f_mod(c * c - P.x - Q.x, p) R.y = gmpy2.f_mod(c * (P.x - R.x) - P.y, p) return R
# Function to calculate Y-coordinate from X-coordinate @lru_cache(maxsize=None) def x_to_y(X, y_parity, p=MODULO): Y = gmpy2.mpz(3) tmp = gmpy2.mpz(1)
while Y > 0: if Y % 2 == 1: tmp = gmpy2.f_mod(tmp * X, p) Y >>= 1 X = gmpy2.f_mod(X * X, p)
X = gmpy2.f_mod(tmp + 7, p)
Y = gmpy2.f_div(gmpy2.add(p, 1), 4) tmp = gmpy2.mpz(1)
while Y > 0: if Y % 2 == 1: tmp = gmpy2.f_mod(tmp * X, p) Y >>= 1 X = gmpy2.f_mod(X * X, p)
Y = tmp
if Y % 2 != y_parity: Y = gmpy2.f_mod(-Y, p)
return Y
# Function to compute a table of points def compute_point_table(): points = [PG] for k in range(255): points.append(multiply_by_2(points[k])) return points
POINTS_TABLE = compute_point_table()
# Global event to signal all processes to stop STOP_EVENT = multiprocessing.Event()
# Function to check and compare points for potential solutions def check(P, Pindex, DP_rarity, A, Ak, B, Bk): check = gmpy2.f_mod(P.x, DP_rarity) if check == 0: message = f"\r[+] [Pindex]: {mpz(Pindex)}" messages = [] messages.append(message) output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output) sys.stdout.flush() A.append(mpz(P.x)) Ak.append(mpz(Pindex)) return comparator(A, Ak, B, Bk) else: return False
# Function to compare two sets of points and find a common point def comparator(A, Ak, B, Bk): global STOP_EVENT result = set(A).intersection(set(B))
if result: sol_kt = A.index(next(iter(result))) sol_kw = B.index(next(iter(result))) difference = Ak[sol_kt] - Bk[sol_kw] HEX = "%064x" % difference t = time.ctime() pid = os.getpid() # Get the process ID core_number = pid % cpu_count() # Calculate the CPU core number total_time = time.time() - starttime print(f"\033[32m[+] PUZZLE SOLVED: {t}, total time: {total_time:.2f} sec, Core: {core_number+1:02} \033[0m") print(f"\033[32m[+] WIF: \033[32m {HEX} \033[0m") with open("KEYFOUNDKEYFOUND.txt", "a") as file: file.write("\n\nSOLVED " + t) file.write(f"\nTotal Time: {total_time:.2f} sec") file.write("\nPrivate Key (decimal): " + str(difference)) file.write("\nPrivate Key (hex): " + HEX) file.write( "\n-------------------------------------------------------------------------------------------------------------------------------------\n" )
STOP_EVENT.set() # Set the stop event to signal all processes
# Memoization for point multiplication ECMULTIPLY_MEMO = {}
# Function to multiply a point by a scalar def ecmultiply(k, P=PG, p=MODULO): if k == 0: return ZERO_POINT elif k == 1: return P elif k % 2 == 0: if k in ECMULTIPLY_MEMO: return ECMULTIPLY_MEMO[k] else: result = ecmultiply(k // 2, multiply_by_2(P, p), p) ECMULTIPLY_MEMO[k] = result return result else: return add_points(P, ecmultiply((k - 1) // 2, multiply_by_2(P, p), p))
# Recursive function to multiply a point by a scalar def mulk(k, P=PG, p=MODULO): if k == 0: return ZERO_POINT elif k == 1: return P elif k % 2 == 0: return mulk(k // 2, multiply_by_2(P, p), p) else: return add_points(P, mulk((k - 1) // 2, multiply_by_2(P, p), p))
# Generate a list of powers of two for faster access @lru_cache(maxsize=None) def generate_powers_of_two(hop_modulo): return [mpz(1 << pw) for pw in range(hop_modulo)]
t = time.ctime() sys.stdout.write("\033[01;33m") sys.stdout.write(f"[+] [Kangaroo]: {t}" + "\n") sys.stdout.flush()
# Configuration for the puzzle puzzle = 130 compressed_public_key = "03633cbe3ec02b9401c5effa144c5b4d22f87940259634858fc7e59b1c09937852" # Puzzle 130 lower_range_limit = 2 ** (puzzle - 1) upper_range_limit = (2 ** puzzle) - 1 kangaroo_power = puzzle // 8 Nt = Nw = (2 ** kangaroo_power // puzzle) * puzzle + 8 DP_rarity = 8 * puzzle hop_modulo = (puzzle // 2) + 8
# Precompute powers of two for faster access powers_of_two = generate_powers_of_two(hop_modulo)
T, t, dt = [], [], [] W, w, dw = [], [], []
if len(compressed_public_key) == 66: X = mpz(compressed_public_key[2:66], 16) Y = x_to_y(X, mpz(compressed_public_key[:2]) - 2) else: print("[error] pubkey len(66/130) invalid!")
print(f"[+] [Puzzle]: {puzzle}") print(f"[+] [Lower range limit]: {lower_range_limit}") print(f"[+] [Upper range limit]: {upper_range_limit}") print("[+] [Xcoordinate]: %064x" % X) print("[+] [Ycoordinate]: %064x" % Y)
W0 = Point(X, Y) starttime = oldtime = time.time()
Hops = 0
# Worker function for point search def search_worker( Nt, Nw, puzzle, kangaroo_power, starttime, lower_range_limit, upper_range_limit ): global STOP_EVENT pid = os.getpid() core_number = pid % cpu_count() #Random seed Config #constant_prefix = b'' #back to no constant #constant_prefix = b'\xbc\x9b\x8cd\xfc\xa1?\xcf' #Puzzle 50 seed - 10-18s constant_prefix = b'\xbc\x9b\x8cd' prefix_length = len(constant_prefix) length = 8 ending_length = length - prefix_length ending_bytes = os.urandom(ending_length) random_bytes = constant_prefix + ending_bytes print(f"[+] [Core]: {core_number+1:02}, [Random seed]: {random_bytes}") random.seed(random_bytes) t = [ mpz( lower_range_limit + mpz(random.randint(0, upper_range_limit - lower_range_limit)) ) for _ in range(Nt) ] T = [mulk(ti) for ti in t] dt = [mpz(0) for _ in range(Nt)] w = [ mpz(random.randint(0, upper_range_limit - lower_range_limit)) for _ in range(Nt) ] W = [add_points(W0, mulk(wk)) for wk in w] dw = [mpz(0) for _ in range(Nw)]
Hops, Hops_old = 0, 0
oldtime = time.time() starttime = oldtime
while True: for k in range(Nt): Hops += 1 pw = T[k].x % hop_modulo dt[k] = powers_of_two[pw] solved = check(T[k], t[k], DP_rarity, T, t, W, w) if solved: STOP_EVENT.set() break t[k] = mpz(t[k]) + dt[k] # Use mpz here T[k] = add_points(POINTS_TABLE[pw], T[k])
for k in range(Nw): Hops += 1 pw = W[k].x % hop_modulo dw[k] = powers_of_two[pw] solved = check(W[k], w[k], DP_rarity, W, w, T, t) if solved: STOP_EVENT.set() break w[k] = mpz(w[k]) + dw[k] # Use mpz here W[k] = add_points(POINTS_TABLE[pw], W[k])
if STOP_EVENT.is_set(): break
# Main script if __name__ == "__main__": process_count = cpu_count() print(f"[+] [Using {process_count} CPU cores for parallel search]:")
# Create a pool of worker processes pool = Pool(process_count) results = pool.starmap( search_worker, [ ( Nt, Nw, puzzle, kangaroo_power, starttime, lower_range_limit, upper_range_limit, ) ] * process_count, ) pool.close() pool.join() Now it works. Thank you.
|
|
|
8
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: October 12, 2023, 07:02:12 PM
|
if you dont have '/dev/urandom' here is script without '/dev/urandom' import sys import os import time import random import hashlib import gmpy2 from gmpy2 import mpz from functools import lru_cache import multiprocessing from multiprocessing import Pool, cpu_count
# Constants MODULO = gmpy2.mpz(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F) ORDER = gmpy2.mpz(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141) GX = gmpy2.mpz(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798) GY = gmpy2.mpz(0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8)
# Define Point class class Point: def __init__(self, x=0, y=0): self.x = x self.y = y
PG = Point(GX, GY) ZERO_POINT = Point(0, 0)
# Function to multiply a point by 2 def multiply_by_2(P, p=MODULO): c = gmpy2.f_mod(3 * P.x * P.x * gmpy2.powmod(2 * P.y, -1, p), p) R = Point() R.x = gmpy2.f_mod(c * c - 2 * P.x, p) R.y = gmpy2.f_mod(c * (P.x - R.x) - P.y, p) return R
# Function to add two points def add_points(P, Q, p=MODULO): dx = Q.x - P.x dy = Q.y - P.y c = gmpy2.f_mod(dy * gmpy2.invert(dx, p), p) R = Point() R.x = gmpy2.f_mod(c * c - P.x - Q.x, p) R.y = gmpy2.f_mod(c * (P.x - R.x) - P.y, p) return R
# Function to calculate Y-coordinate from X-coordinate @lru_cache(maxsize=None) def x_to_y(X, y_parity, p=MODULO): Y = gmpy2.mpz(3) tmp = gmpy2.mpz(1)
while Y > 0: if Y % 2 == 1: tmp = gmpy2.f_mod(tmp * X, p) Y >>= 1 X = gmpy2.f_mod(X * X, p)
X = gmpy2.f_mod(tmp + 7, p)
Y = gmpy2.f_div(gmpy2.add(p, 1), 4) tmp = gmpy2.mpz(1)
while Y > 0: if Y % 2 == 1: tmp = gmpy2.f_mod(tmp * X, p) Y >>= 1 X = gmpy2.f_mod(X * X, p)
Y = tmp
if Y % 2 != y_parity: Y = gmpy2.f_mod(-Y, p)
return Y
# Function to compute a table of points def compute_point_table(): points = [PG] for k in range(255): points.append(multiply_by_2(points[k])) return points
POINTS_TABLE = compute_point_table()
# Global event to signal all processes to stop STOP_EVENT = multiprocessing.Event()
# Function to check and compare points for potential solutions def check(P, Pindex, DP_rarity, A, Ak, B, Bk): check = gmpy2.f_mod(P.x, DP_rarity) if check == 0: message = f"\r[+] [Pindex]: {mpz(Pindex)}" messages = [] messages.append(message) output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output) sys.stdout.flush() A.append(mpz(P.x)) Ak.append(mpz(Pindex)) return comparator(A, Ak, B, Bk) else: return False
# Function to compare two sets of points and find a common point def comparator(A, Ak, B, Bk): global STOP_EVENT result = set(A).intersection(set(B))
if result: sol_kt = A.index(next(iter(result))) sol_kw = B.index(next(iter(result))) difference = Ak[sol_kt] - Bk[sol_kw] HEX = "%064x" % difference t = time.ctime() pid = os.getpid() # Get the process ID core_number = pid % cpu_count() # Calculate the CPU core number total_time = time.time() - starttime print(f"\033[32m[+] PUZZLE SOLVED: {t}, total time: {total_time:.2f} sec, Core: {core_number+1:02} \033[0m") print(f"\033[32m[+] WIF: \033[32m {HEX} \033[0m") with open("KEYFOUNDKEYFOUND.txt", "a") as file: file.write("\n\nSOLVED " + t) file.write(f"\nTotal Time: {total_time:.2f} sec") file.write("\nPrivate Key (decimal): " + str(difference)) file.write("\nPrivate Key (hex): " + HEX) file.write( "\n-------------------------------------------------------------------------------------------------------------------------------------\n" )
STOP_EVENT.set() # Set the stop event to signal all processes
# Memoization for point multiplication ECMULTIPLY_MEMO = {}
# Function to multiply a point by a scalar def ecmultiply(k, P=PG, p=MODULO): if k == 0: return ZERO_POINT elif k == 1: return P elif k % 2 == 0: if k in ECMULTIPLY_MEMO: return ECMULTIPLY_MEMO[k] else: result = ecmultiply(k // 2, multiply_by_2(P, p), p) ECMULTIPLY_MEMO[k] = result return result else: return add_points(P, ecmultiply((k - 1) // 2, multiply_by_2(P, p), p))
# Recursive function to multiply a point by a scalar def mulk(k, P=PG, p=MODULO): if k == 0: return ZERO_POINT elif k == 1: return P elif k % 2 == 0: return mulk(k // 2, multiply_by_2(P, p), p) else: return add_points(P, mulk((k - 1) // 2, multiply_by_2(P, p), p))
# Generate a list of powers of two for faster access @lru_cache(maxsize=None) def generate_powers_of_two(hop_modulo): return [mpz(1 << pw) for pw in range(hop_modulo)]
# Worker function for point search def search_worker( Nt, Nw, puzzle, kangaroo_power, starttime, lower_range_limit, upper_range_limit ): global STOP_EVENT pid = os.getpid() core_number = pid % cpu_count() #Random seed Config #constant_prefix = b'' #back to no constant #constant_prefix = b'\xbc\x9b\x8cd\xfc\xa1?\xcf' #Puzzle 50 seed - 10-18s constant_prefix = b'\xbc\x9b\x8cd' prefix_length = len(constant_prefix) length = 8 ending_length = length - prefix_length ending_bytes = os.urandom(ending_length) random_bytes = constant_prefix + ending_bytes print(f"[+] [Core]: {core_number+1:02}, [Random seed]: {random_bytes}") random.seed(random_bytes) t = [ mpz( lower_range_limit + mpz(random.randint(0, upper_range_limit - lower_range_limit)) ) for _ in range(Nt) ] T = [mulk(ti) for ti in t] dt = [mpz(0) for _ in range(Nt)] w = [ mpz(random.randint(0, upper_range_limit - lower_range_limit)) for _ in range(Nt) ] W = [add_points(W0, mulk(wk)) for wk in w] dw = [mpz(0) for _ in range(Nw)]
Hops, Hops_old = 0, 0
oldtime = time.time() starttime = oldtime
while True: for k in range(Nt): Hops += 1 pw = T[k].x % hop_modulo dt[k] = powers_of_two[pw] solved = check(T[k], t[k], DP_rarity, T, t, W, w) if solved: STOP_EVENT.set() break t[k] = mpz(t[k]) + dt[k] # Use mpz here T[k] = add_points(POINTS_TABLE[pw], T[k])
for k in range(Nw): Hops += 1 pw = W[k].x % hop_modulo dw[k] = powers_of_two[pw] solved = check(W[k], w[k], DP_rarity, W, w, T, t) if solved: STOP_EVENT.set() break w[k] = mpz(w[k]) + dw[k] # Use mpz here W[k] = add_points(POINTS_TABLE[pw], W[k])
if STOP_EVENT.is_set(): break
# Main script if __name__ == "__main__": os.system("clear") t = time.ctime() sys.stdout.write("\033[01;33m") sys.stdout.write(f"[+] [Kangaroo]: {t}" + "\n") sys.stdout.flush()
# Configuration for the puzzle puzzle = 130 compressed_public_key = "03633cbe3ec02b9401c5effa144c5b4d22f87940259634858fc7e59b1c09937852" # Puzzle 130 lower_range_limit = 2 ** (puzzle - 1) upper_range_limit = (2 ** puzzle) - 1 kangaroo_power = puzzle // 8 Nt = Nw = (2 ** kangaroo_power // puzzle) * puzzle + 8 DP_rarity = 8 * puzzle hop_modulo = (puzzle // 2) + 8
# Precompute powers of two for faster access powers_of_two = generate_powers_of_two(hop_modulo)
T, t, dt = [], [], [] W, w, dw = [], [], []
if len(compressed_public_key) == 66: X = mpz(compressed_public_key[2:66], 16) Y = x_to_y(X, mpz(compressed_public_key[:2]) - 2) else: print("[error] pubkey len(66/130) invalid!")
print(f"[+] [Puzzle]: {puzzle}") print(f"[+] [Lower range limit]: {lower_range_limit}") print(f"[+] [Upper range limit]: {upper_range_limit}") print("[+] [Xcoordinate]: %064x" % X) print("[+] [Ycoordinate]: %064x" % Y)
W0 = Point(X, Y) starttime = oldtime = time.time()
Hops = 0
process_count = cpu_count() print(f"[+] [Using {process_count} CPU cores for parallel search]:")
# Create a pool of worker processes pool = Pool(process_count) results = pool.starmap( search_worker, [ ( Nt, Nw, puzzle, kangaroo_power, starttime, lower_range_limit, upper_range_limit, ) ] * process_count, ) pool.close() pool.join() Now this error. NameError: name 'W0' is not defined
|
|
|
9
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: October 11, 2023, 08:37:34 PM
|
PUZZLE SOLVED: Wed Oct 11 12:13:21 2023, total time: 13.47 sec - WIF: -0000000000000000000000000000000000000000000000000022bd43c2e9354
nice catching again nomachine, is this programmable for 120th and up Yes. It takes about 3 minutes to start solving Puzzle 130 on my 12 Core - but will start. Here is code for Puzzle130 import sys import os import time import random import hashlib import gmpy2 from gmpy2 import mpz from functools import lru_cache import multiprocessing from multiprocessing import Pool, cpu_count
# Constants MODULO = gmpy2.mpz(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F) ORDER = gmpy2.mpz(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141) GX = gmpy2.mpz(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798) GY = gmpy2.mpz(0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8)
# Define Point class class Point: def __init__(self, x=0, y=0): self.x = x self.y = y
PG = Point(GX, GY) ZERO_POINT = Point(0, 0)
# Function to multiply a point by 2 def multiply_by_2(P, p=MODULO): c = gmpy2.f_mod(3 * P.x * P.x * gmpy2.powmod(2 * P.y, -1, p), p) R = Point() R.x = gmpy2.f_mod(c * c - 2 * P.x, p) R.y = gmpy2.f_mod(c * (P.x - R.x) - P.y, p) return R
# Function to add two points def add_points(P, Q, p=MODULO): dx = Q.x - P.x dy = Q.y - P.y c = gmpy2.f_mod(dy * gmpy2.invert(dx, p), p) R = Point() R.x = gmpy2.f_mod(c * c - P.x - Q.x, p) R.y = gmpy2.f_mod(c * (P.x - R.x) - P.y, p) return R
# Function to calculate Y-coordinate from X-coordinate @lru_cache(maxsize=None) def x_to_y(X, y_parity, p=MODULO): Y = gmpy2.mpz(3) tmp = gmpy2.mpz(1)
while Y > 0: if Y % 2 == 1: tmp = gmpy2.f_mod(tmp * X, p) Y >>= 1 X = gmpy2.f_mod(X * X, p)
X = gmpy2.f_mod(tmp + 7, p)
Y = gmpy2.f_div(gmpy2.add(p, 1), 4) tmp = gmpy2.mpz(1)
while Y > 0: if Y % 2 == 1: tmp = gmpy2.f_mod(tmp * X, p) Y >>= 1 X = gmpy2.f_mod(X * X, p)
Y = tmp
if Y % 2 != y_parity: Y = gmpy2.f_mod(-Y, p)
return Y
# Function to compute a table of points def compute_point_table(): points = [PG] for k in range(255): points.append(multiply_by_2(points[k])) return points
POINTS_TABLE = compute_point_table()
# Global event to signal all processes to stop STOP_EVENT = multiprocessing.Event()
# Function to check and compare points for potential solutions def check(P, Pindex, DP_rarity, A, Ak, B, Bk): check = gmpy2.f_mod(P.x, DP_rarity) if check == 0: message = f"\r[+] [Pindex]: {mpz(Pindex)}" messages = [] messages.append(message) output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output) sys.stdout.flush() A.append(mpz(P.x)) Ak.append(mpz(Pindex)) return comparator(A, Ak, B, Bk) else: return False
# Function to compare two sets of points and find a common point def comparator(A, Ak, B, Bk): global STOP_EVENT result = set(A).intersection(set(B))
if result: sol_kt = A.index(next(iter(result))) sol_kw = B.index(next(iter(result))) difference = Ak[sol_kt] - Bk[sol_kw] HEX = "%064x" % difference t = time.ctime() pid = os.getpid() # Get the process ID core_number = pid % cpu_count() # Calculate the CPU core number total_time = time.time() - starttime print(f"\033[32m[+] PUZZLE SOLVED: {t}, total time: {total_time:.2f} sec, Core: {core_number+1:02} \033[0m") print(f"\033[32m[+] WIF: \033[32m {HEX} \033[0m") with open("KEYFOUNDKEYFOUND.txt", "a") as file: file.write("\n\nSOLVED " + t) file.write(f"\nTotal Time: {total_time:.2f} sec") file.write("\nPrivate Key (decimal): " + str(difference)) file.write("\nPrivate Key (hex): " + HEX) file.write( "\n-------------------------------------------------------------------------------------------------------------------------------------\n" )
STOP_EVENT.set() # Set the stop event to signal all processes
# Memoization for point multiplication ECMULTIPLY_MEMO = {}
# Function to multiply a point by a scalar def ecmultiply(k, P=PG, p=MODULO): if k == 0: return ZERO_POINT elif k == 1: return P elif k % 2 == 0: if k in ECMULTIPLY_MEMO: return ECMULTIPLY_MEMO[k] else: result = ecmultiply(k // 2, multiply_by_2(P, p), p) ECMULTIPLY_MEMO[k] = result return result else: return add_points(P, ecmultiply((k - 1) // 2, multiply_by_2(P, p), p))
# Recursive function to multiply a point by a scalar def mulk(k, P=PG, p=MODULO): if k == 0: return ZERO_POINT elif k == 1: return P elif k % 2 == 0: return mulk(k // 2, multiply_by_2(P, p), p) else: return add_points(P, mulk((k - 1) // 2, multiply_by_2(P, p), p))
# Generate a list of powers of two for faster access @lru_cache(maxsize=None) def generate_powers_of_two(hop_modulo): return [mpz(1 << pw) for pw in range(hop_modulo)]
# Worker function for point search def search_worker( Nt, Nw, puzzle, kangaroo_power, starttime, lower_range_limit, upper_range_limit ): global STOP_EVENT pid = os.getpid() core_number = pid % cpu_count() #Random seed Config #constant_prefix = b'' #back to no constant #constant_prefix = b'\xbc\x9b\x8cd\xfc\xa1?\xcf' #Puzzle 50 seed - 10-18s constant_prefix = b'\xbc\x9b' prefix_length = len(constant_prefix) length = 8 ending_length = length - prefix_length with open("/dev/urandom", "rb") as urandom_file: ending_bytes = urandom_file.read(ending_length) random_bytes = constant_prefix + ending_bytes print(f"[+] [Core]: {core_number+1:02}, [Random seed]: {random_bytes}") random.seed(random_bytes) t = [ mpz( lower_range_limit + mpz(random.randint(0, upper_range_limit - lower_range_limit)) ) for _ in range(Nt) ] T = [mulk(ti) for ti in t] dt = [mpz(0) for _ in range(Nt)] w = [ mpz(random.randint(0, upper_range_limit - lower_range_limit)) for _ in range(Nt) ] W = [add_points(W0, mulk(wk)) for wk in w] dw = [mpz(0) for _ in range(Nw)]
Hops, Hops_old = 0, 0
oldtime = time.time() starttime = oldtime
while True: for k in range(Nt): Hops += 1 pw = T[k].x % hop_modulo dt[k] = powers_of_two[pw] solved = check(T[k], t[k], DP_rarity, T, t, W, w) if solved: STOP_EVENT.set() break t[k] = mpz(t[k]) + dt[k] # Use mpz here T[k] = add_points(POINTS_TABLE[pw], T[k])
for k in range(Nw): Hops += 1 pw = W[k].x % hop_modulo dw[k] = powers_of_two[pw] solved = check(W[k], w[k], DP_rarity, W, w, T, t) if solved: STOP_EVENT.set() break w[k] = mpz(w[k]) + dw[k] # Use mpz here W[k] = add_points(POINTS_TABLE[pw], W[k])
if STOP_EVENT.is_set(): break
# Main script if __name__ == "__main__": os.system("clear") t = time.ctime() sys.stdout.write("\033[01;33m") sys.stdout.write(f"[+] [Kangaroo]: {t}" + "\n") sys.stdout.flush()
# Configuration for the puzzle puzzle = 130 compressed_public_key = "03633cbe3ec02b9401c5effa144c5b4d22f87940259634858fc7e59b1c09937852" # Puzzle 130 lower_range_limit = 2 ** (puzzle - 1) upper_range_limit = (2 ** puzzle) - 1 kangaroo_power = puzzle // 8 Nt = Nw = (2 ** kangaroo_power // puzzle) * puzzle + 8 DP_rarity = 8 * puzzle hop_modulo = (puzzle // 2) + 8
# Precompute powers of two for faster access powers_of_two = generate_powers_of_two(hop_modulo)
T, t, dt = [], [], [] W, w, dw = [], [], []
if len(compressed_public_key) == 66: X = mpz(compressed_public_key[2:66], 16) Y = x_to_y(X, mpz(compressed_public_key[:2]) - 2) else: print("[error] pubkey len(66/130) invalid!")
print(f"[+] [Puzzle]: {puzzle}") print(f"[+] [Lower range limit]: {lower_range_limit}") print(f"[+] [Upper range limit]: {upper_range_limit}") print("[+] [Xcoordinate]: %064x" % X) print("[+] [Ycoordinate]: %064x" % Y)
W0 = Point(X, Y) starttime = oldtime = time.time()
Hops = 0
process_count = cpu_count() print(f"[+] [Using {process_count} CPU cores for parallel search]:")
# Create a pool of worker processes pool = Pool(process_count) results = pool.starmap( search_worker, [ ( Nt, Nw, puzzle, kangaroo_power, starttime, lower_range_limit, upper_range_limit, ) ] * process_count, ) pool.close() pool.join() I put only 2 bytes as a constant - the rest will be randomized through all CPU cores, since we don't know what the seed for 130 is. . . constant_prefix = b'\xbc\x9b' constant_prefix = b'' is all random ON the smaller puzzles it is easy to guess what the seed is. You need to restart and restart app and you will find out which is the fastest seed by repetition. The script will show exactly which seed and which core hit the WIF. You can experiment with different ones as you like. FileNotFoundError: [Errno 2] No such file or directory: '/dev/urandom'
|
|
|
10
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: October 09, 2023, 09:26:37 PM
|
It doesn't matter what our target is, even or odd you just need to correctly guess the last 2 hex characters and then you can use the script I posted above to divide your key by 1024, but first you'd need to subtract n/4 from the result on 1024 - index. Try it yourself and you will see, even if we guess the last 2 chars incorrectly, there is a way to again calculate p/1024 no matter what. God willing I should be able to figure that out, it's complicated I know but once it's solved you realize how easy it was.
Spent a lot of time, but I haven't gotten the correct result. How come?, here put this on scalar_1 = 0x00000000000000000000000000000000003aab07a231499b94e9412cb6d34334 Scalar_2 = 0x0000000000000000000000000000000000000000000000000000000000000034 Start range = 1024, end range = 1025, the result is : 3fffffffffffffffffffffffffffffffaeabc5e46dbab46156d9d1f37f3b4521 Then subtract n/4 from above = 3fffffffffffffffffffffffffffffffaeabb739abd2280eeff497a3340d9050 Result = 0000000000000000000000000000000000000eaac1e88c5266e53a504b2db4d1 Multiplied by 1024 = 00000000000000000000000000000000003aab07a231499b94e9412cb6d34400
You are not supposed to get the exact result, but if you add and subtract to your target public key like adding 1k G, sub 1k G, and have those 2k keys saved, when you multiply by 1024 you should see a match. Bro, you've completely confused everyone here. Which script should I insert this data into???
|
|
|
11
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: October 07, 2023, 09:44:59 PM
|
the equation in my head can solve.....
It's called imagination. Not any more, as I just tested a few tricks, it works. Note that I'm not forcing anyone to believe me, I don't know who to trust that's it, therefore my only option is Satoshi/author of this challenge. I have been called delusional, scammer, liar etc, without these name callings I wouldn't be here right now. It's the fuel for my engine. Hi. Share in a personal what kind of tricks you do and how they work?
|
|
|
12
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: September 27, 2023, 03:42:40 PM
|
Look closely, I am working with artistic binary, not with base58, Ripemd160, decimal, or hexadecimal. and just print output in any format, If you have any output result even in any format, please show us. 100% of people are trying randomly even in 130 also, and I am also trying randomly, but with some logic. You are a master of mathematics, so you can solve 130 directly even with your mobile. All the best!
I don't know if this will help you in any way: 13zb1hQbWZ1a2xKWzTd4Wwm1JPUvMqG1f9 20000482560FB7F71 10 0000 0000 0000 0000 0100 1000 0010 0101 0110 0000 1111 1011 0111 1111 0111 0001 13zb1hQbWRtJwbYp2LoA2JVeBFnSgrf34F 20000508586CE7275 10 0000 0000 0000 0000 0101 0000 1000 0101 1000 0110 1100 1110 0111 0010 0111 0101 13zb1hQbWag5udkAQDnS4HJy8sb5o4uoov 200006E160DD67EE5 10 0000 0000 0000 0000 0110 1110 0001 0110 0000 1101 1101 0110 0111 1110 1110 0101 13zb1hQbWHZiXjDeN7iVDop52T3xYCF3G5 2000070B9014052ED 10 0000 0000 0000 0000 0111 0000 1011 1001 0000 0001 0100 0000 0101 0010 1110 1101 13zb1hQbW64hnLQnTFkQTU1Ed3tQoSqpFk 20000866E02263B6B 10 0000 0000 0000 0000 1000 0110 0110 1110 0000 0010 0010 0110 0011 1011 0110 1011
|
|
|
13
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: September 11, 2023, 02:16:42 PM
|
Can someone tell me why there is nothing in my output file even though the target is in the file this script is searching, it even says saved in matches.txt Here is the script import re
# List of target public keys target_public_keys = '0370e7c3d922008d9ccea410d560cd440a834a811a1ea74c2967637ca015a788a3'
# Regular expression pattern for matching public keys pattern = r"\b(" + "|".join(target_public_keys) + r")\b"
# Output file to log matches output_file = "matches.txt"
# List of files to search through files_to_search =[ "Finish-him-Jack-wins.txt"]
# Open the output file for writing with open(output_file, "w") as output: for filename in files_to_search: with open(filename, "r") as file: content = file.read() matches = re.findall(pattern, content) if matches: output.write(f"Matches found in {filename}:\n") for match in matches: output.write(match + "\n") output.write("\n")
print("Search completed. Matching public keys saved in", output_file) Appreciate any help. with open(output_file, "w") as output: instead of " w" put " a" P.S.: Tell me why you need this script? The pub can be found by regular file search)
|
|
|
14
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: September 11, 2023, 12:57:43 PM
|
import re
# List of target public keys target_public_keys = ['0370e7c3d922008d9ccea410d560cd440a834a811a1ea74c2967637ca015a788a3'] # as a list
# Regular expression pattern for matching public keys pattern = r"\b(" + "|".join(target_public_keys) + r")\b"
# Output file to log matches output_file = "matches.txt"
# List of files to search through files_to_search = ["Finish-him-Jack-wins.tx"]
# Open the output file for writing with open(output_file, "[b]a[/b]") as output:
for filename in files_to_search: with open(filename, "r") as file: content = file.read() matches = re.findall(pattern, content) if matches: output.write(f"Matches found in {filename}:\n") for match in matches: output.write(match + "\n") output.write("\n")
print("Search completed. Matching public keys saved in", output_file)
Error!!! with open(output_file, "[b]a[/b]") as output: ValueError: invalid mode: '[b]a[/b]'
|
|
|
15
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: September 03, 2023, 07:26:14 PM
|
Why do you want to apply to a number that is division of 3? 150/3= 50
I took the number 150 just as an example. For example Puzzle #65: target = 30568377312064202855 target_2 = 30568377312064202855+1 #= 30568377312064202856 t1= target/3 #= 10189459104021400951.666666666666667 t2= target_2/3 #= 10189459104021400952 r= t1+t2 # = 20378918208042801903.666666666666667 30568377312064202855 − 20378918208042801903.666666666666667 = 10189459104021400951.333333333333333 I cannot understand how this method will help in solving the puzzle if the "target" is unknown to us.
|
|
|
16
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: September 03, 2023, 06:02:44 PM
|
a mathematical curiosity that maybe could help the puzzle: all numbers even that respects this succession 4,10,16,22,28,34,40,46.....To infinity divided by 3 plus the sum of +1 to the same number divided by 3, results in an integer, odd number. target = 100 target_2 = 100+1 #= 101
t1= target//3 #= 33.333333333333336 t2= target_2//3 #= 33.666666666666664
r= t1+t2 # = 67 ---snipp--- t1 = t2 = 33 r will not result in 67 as you said, r=66 33.333333333333336+33.666666666666664 = 67 use 1 "/" symbol, 2 " //" is for rounding, sorry. even if you run the script it gives you like pk decimal=67 03df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f edit and if you subtract 100-67= 33 you would get the division of 100/3 rounded to 33. Unfortunately, this method does not work for all numbers: target = 150 target_2 = 150+1 #= 151 t1= target/3 #= 50 t2= target_2/3 #= 50.333333333333336 r= t1+t2 # = 100.333333333333336 150 − 100.333333333333336 = 49.666666666666664
|
|
|
17
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: September 03, 2023, 12:56:05 PM
|
hello.For private key 2 the x and y values of pubkey are
c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5 1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
i change generator points of elliptic curve to the values above. let us assume we want to bruteforce scan the puzzles 1 to 20. end range of puzzle20 is 0x100000 and normaly we would scan 1:100000 but as i changed G I divide the range by 2 therefore new reduced scan range is 0x1 to 0x80000
they keys found are: 4 26 70 101 A30 1498 649B
now we multiply by 2 and get correct prvkeys for seven puzzles 4 7 8 10 13 14 16
we miss thirteen keys and i understand that it didnt find them because they are and our scan used even.
someone please show what are the exact steps to find also rest keys within that range?
please show example with private key 4 for understanding
Please post the code so it's more clear what you're talking about.
|
|
|
18
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: August 31, 2023, 08:15:01 PM
|
import secp256k1 as ice
target_public_key = "023d62d9d64a7164a2ae6f0561f7e8317e69b4a1ee61048fe768a1316b39b1d3a7" target = ice.pub2upub(target_public_key) num = 100 # number of times. sustract= 1 #amount to subtract each time. sustract_pub= ice.scalar_multiplication(sustract) res= ice.point_loop_subtraction(num, target, sustract_pub) for t in range (num+1): h= res[t*65:t*65+65] data = open("data-base.txt","a") data.write(str(h.hex())+"\n") data.close() Is it possible to make it possible to specify an unlimited number in num? If set num = 1000000000 That throws an error: Traceback (most recent call last): File "D :\PubSub\PubSub.py", line 8, in <module> res= ice.point_loop_subtraction(num, target, sustract_pub).hex() File "D :\PubSub\secp256k1.py", line 504, in point_loop_subtraction res = _point_loop_subtraction(num, pubkey1_bytes, pubkey2_bytes) File "D :\PubSub\secp256k1.py", line 497, in _point_loop_subtraction res = (b'\x00') * (65 * num) MemoryError this may be because secp256k1 loop stores the result in memory first, and exceeds the capacity of your ram. choose a smaller amount and then change the target with the last pubkey in the database list (to continue from there). This is all clear. But we don't know what range our last key fell into, do we? Accordingly, we cannot know what amount and how many times it can be subtracted from it so as not to go into a minus. That's where the snag is. P.S.:Your script works great! Thank you very much! Update: If, when subtracting, it was immediately checked whether you "flew over" a certain public key (went into minus or not). Back then, all public-key puzzles could be solved within an hour. Can someone write such a script?
|
|
|
19
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: August 29, 2023, 07:58:56 PM
|
import secp256k1 as ice
target_public_key = "023d62d9d64a7164a2ae6f0561f7e8317e69b4a1ee61048fe768a1316b39b1d3a7" target = ice.pub2upub(target_public_key) num = 100 # number of times. sustract= 1 #amount to subtract each time. sustract_pub= ice.scalar_multiplication(sustract) res= ice.point_loop_subtraction(num, target, sustract_pub) for t in range (num+1): h= res[t*65:t*65+65] data = open("data-base.txt","a") data.write(str(h.hex())+"\n") data.close() Is it possible to make it possible to specify an unlimited number in num? If set num = 1000000000 That throws an error: Traceback (most recent call last): File "D :\PubSub\PubSub.py", line 8, in <module> res= ice.point_loop_subtraction(num, target, sustract_pub).hex() File "D :\PubSub\secp256k1.py", line 504, in point_loop_subtraction res = _point_loop_subtraction(num, pubkey1_bytes, pubkey2_bytes) File "D :\PubSub\secp256k1.py", line 497, in _point_loop_subtraction res = (b'\x00') * (65 * num) MemoryError
|
|
|
20
|
Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
|
on: August 27, 2023, 06:53:20 PM
|
Some elliptic curve magic ahead! Public key for 2^256 in secp256k1 : 03dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787 Private key : 000000000000000000000000000000014551231950b75fc4402da1732fc9bebf Public key divided by 2 : 02b23790a42be63e1b251ad6c94fdef07271ec0aada31db6c3e8bd32043f8be384 Private key : 2^255 8000000000000000000000000000000000000000000000000000000000000000 Now we add an even key to our 2^256 : Target Pub 034a4a6dc97ac7c8b8ad795dbebcb9dcff7290b68a5ef74e56ab5edde01bced775 Target Prv 0000000000000000000000000000000000000000000000000000000000008000 Result : pub 02c028224b2c45bd797143e8f32f025e24601ed85f27ef310d7d55020a192ddba5 Prv 000000000000000000000000000000014551231950b75fc4402da1732fca3ebf Divide by 2 , result : 0216ca7e1edb137684b4aa8a41fd0f8a89dcb773b9db807a9f3f864de2161735ff Now subtract pub 2^255 from above, result : 03111d6a45ac1fb90508907a7abcd6877649df662f3b3e2741302df6f78416824a Prv, also real half of our original target : 03111d6a45ac1fb90508907a7abcd6877649df662f3b3e2741302df6f78416824a , 0000000000000000000000000000000000000000000000000000000000004000 I just enjoy making a simple division difficult and twisted! 🤣, now chop chop start your brain's engine and do some calculation, large fractions could be solved by accounting for the above results, not telling you how. Dive deep and let your brain solve it.😉 It is a pity that such an operation will not work with an odd key))
|
|
|
|