Comments (1)
hi, I tried to use your library but have problems, can you check the codes and give examples to implement your lib instead of k1?
""" USAGE :
python3 address.py -a 1rSnXMr63jdCuegJFuidJqWxUPV7AtUf7 -b 24
python3 address.py -a 13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so -b 66 -r 2048 -c 6
"""from argparse import ArgumentParser import multiprocessing as MP from random import randint from secp256k1 import ( b58_decode as b58, privatekey_to_h160 as p2h, privatekey_loop_h160_sse as loop) import sys import time from multiprocessing import Value, Process, Event, Array import ctypes
parser = ArgumentParser(description='It splits the bit range and assigns a random number in each allocated range, searching backwards and forwards by -r.', epilog='') parser.add_argument("-a", "--address", help = "P2PKH Address", required=True) parser.add_argument("-b", "--bit", help = "Bit Range (20 - 256)", required=True) parser.add_argument("-r", "--range", help = "The number or range of steps to search for in the fragmented bit range. | Default : 16384") parser.add_argument("-c", "--cpu", help = "CPU Count | Default : 4") if len(sys.argv)==1: parser.print_help(), sys.exit(1) args = parser.parse_args() address, bit, RANGE, cpu_count = args.address, int(args.bit), int(args.range) if args.range else 16384, int(args.cpu) if args.cpu else 4 _ = 2**(bit-1) P = bytes.fromhex(b58(address)[2:-8])
def found(x): for i in range(RANGE): p, p = x + i, x - i T = p2h(0, True, p) + p2h(0, True, p) if P in T: V = hex(_p)[2:] if p2h(0, True, p) == P else hex(p) print('#'*30 + f'\nPrivate Key : {V}\n' + '#'*30) open('found.txt', 'a').write('#'*30 + f'\nPrivate Key : {V}\n' + '#'*30 + '\n') return True
last_key = Array('c', b'0' * 64)
def RUN(q, f, total_attempts, start_time, last_key): while not q.is_set(): M = randint(16, 64) B = _ // M S = [_ + (B * i) for i in range(M + 1)] R = randint(1, S[1] - S[0])
for I in range(M): K = S[I] + R with last_key.get_lock(): # Son anahtar değerini güncelle last_key.value = hex(K)[2:].encode('utf-8') T = loop(RANGE, 0, True, K) + loop(RANGE, 0, True, K - RANGE) with total_attempts.get_lock(): total_attempts.value += 2 * RANGE if P in T: found(K) f.set() return
if name == 'main': q, f = Event(), Event() total_attempts = Value(ctypes.c_ulonglong, 0) start_time = Value(ctypes.c_double, time.time())
processes = [] for i in range(cpu_count): p = Process(target=RUN, args=(q, f, total_attempts, start_time, last_key)) processes.append(p) p.start() try: while not f.is_set(): with total_attempts.get_lock(): elapsed_time = time.time() - start_time.value scan_rate = total_attempts.value / elapsed_time if elapsed_time > 0 else 0 print(f"\rTotal Time: {elapsed_time:.2f} s. Total Attempts: {total_attempts.value / 1_000_000:.2f} Mkeys. Attempts per Second: {scan_rate / 1_000_000:.2f} Mkeys/s. Last Key: {last_key.value.decode('utf-8')}", end='') time.sleep(1) finally: q.set() for p in processes: p.join()
use :
# from secp256k1 import (
# b58_decode as b58,
# privatekey_to_h160 as p2h,
# privatekey_loop_h160_sse as loop)
from secp256k2 import Contactor
cont = Contactor()
# for b58 decode
wif = cont.b58_decode("EXAMPLE")
# for loop RIPMD160 (h160)
h160 = cont.privatekey_loop_h160()
for more example can see here
from secp256k2.
Related Issues (2)
- contractor error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from secp256k2.