Post
Topic
Board Proje Geliştirme
Re: Bitcoin; Algoritma Üzerine Yöntemler
by
destansi
on 28/09/2019, 19:54:43 UTC
sorgulama kısmında bir hata vardı bu düzeltilmiş hali 23 marta takılmayın


import os
import bitcoin
import pickle
import multiprocessing



DATABASE = r'database/MAR_23_2019/'



xchoicesx = [2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16]

class aa:
    aaa = 0


def Generate_private_key_to_private_key():
   
     

    ln = xchoicesx[os.urandom(1)[0]]
    k = ""
    for i in range(0,ln):
        k += (('{:02x}'.format(os.urandom(1)[0]))+('{:02x}'.format(os.urandom(1)[0])))
    if len(k) <= 64:
        return (((64 - len(k)) * '0')+k)

   
def private_key_to_address(private_key):   
    aa.aaa += 1
    print(aa.aaa)
    return bitcoin.pubkey_to_address(bitcoin.compress(bitcoi[Suspicious link removed]ivkey_to_pubkey(private_key)))
    #return '19hHSppphwDn41JTrhEh1w3ToqdDjwWur4'
def private_key_to_address1(private_key):
    aa.aaa += 1
    print(aa.aaa)
    return bitcoin.pubkey_to_address(bitcoi[Suspicious link removed]ivkey_to_pubkey(private_key))
    #return '1Ae9uPuCVLv53ShvrYoUJHLcosmATy9v2h'               

def process(private_key, address, address1, database):
   
   
    if address in database[0] or \
       address in database[1] or \
       address in database[2] or \
       address in database[3]:
        with open('plutusc.txt', 'a') as file:
            file.write('hex private key: ' + str(private_key) + '\n' +
                       
                       'address: ' + str(address) + '\n' )
                       
    if address1 in database[0] or \
       address1 in database[1] or \
       address1 in database[2] or \
       address1 in database[3]:
        with open('plutusc.txt', 'a') as file:
            file.write('hex private key: ' + str(private_key) + '\n' +
                       
                       'address1: ' + str(address1) + '\n\n' )
                       
    #else:               
       
        #print(str(address))
       # print(str(address1))
        #with open('pluc.txt', 'a') as file:
            #file.write('hex private key: ' + str(private_key) + '\n' +
                       
                       #'address: ' + str(address) + '\n' +
                       #'address1: ' + str(address1) + '\n\n' )
                       


def main(database):
   
    while True:

        private_key = Generate_private_key_to_private_key()
        address = private_key_to_address(private_key)
        address1 = private_key_to_address1(private_key)                           
        if address != -1:
            process(private_key, address, address1, database)
                                                           
                                                           
   
if __name__ == '__main__':
   
    database = [set() for _ in range(4)]
    count = len(os.listdir(DATABASE))
    half = count // 2; quarter = half // 2
    for c, p in enumerate(os.listdir(DATABASE)):
        print('\rreading database: ' + str(c + 1) + '/' + str(count), end = ' ')
        with open(DATABASE + p, 'rb') as file:
            if c < half:
                if c < quarter: database[0] = database[0] | pickle.load(file)
                else: database[1] = database[1] | pickle.load(file)
            else:
                if c < half + quarter: database[2] = database[2] | pickle.load(file)
                else: database[3] = database[3] | pickle.load(file)
    print('DONE')
   
   
   
    for cpu in range(multiprocessing.cpu_count()):
        multiprocessing.Process(target = main, args = (database, )).start()