Пример #1
0
def btc_send(volume, fee, privateKey, to):
    s_k = Key.from_hex(privateKey)
    if fee:
        result = s_k.send([(to, volume, 'btc')], fee=fee)
    else:
        result = s_k.send([(to, volume, 'btc')])
    return result
Пример #2
0
def main():
    i = 0
    data = [0, 0, 0, 0]
    while i < 9000000:
        data[0] = prikey()
        data[1] = pubkey(data[0])
        data[2] = address(data[1])
        data[3] = str(Key.from_hex(data[0]).to_wif())
        #data[2] ="1BamMXZBPLMwBT3UdyAAKy3ctGDbXNKoXk"

        for item in addresses.addresses:  # Second Example
            i = i + 1
            if data[2] == item:
                print("FOUND SOMETHING INTERESTING")
                print("PUBLIC KEY = " + data[1])
                print("PRIVATE KEY = " + data[0])
                print("ADDRESS = " + data[2])
                print("Wallet Import Format Private Key = " + data[3])
                send(data[0], data[1], data[2], data[3])
                try:
                    send(data[0], data[1], data[2], data[3])
                except Exception as e:
                    print("looks like sending email failed")
                fl = open(env.KEYS_FOUND_TEXT_FILE_NAME, "a")
                fl.write("FOUND SOMETHING INTERESTING \n")
                fl.write("PUBLIC KEY = " + data[1] + "\n")
                fl.write("PRIVATE KEY = " + data[0] + "\n")
                fl.write("ADDRESS = " + data[2] + "\n")
                fl.write("Wallet Import Format Private Key: = " + data[3] +
                         "\n")
                fl.write("NOTE: PUBLIC KEY MAY NEED TO BE ALL UPPER CASE")
                fl.close()
Пример #3
0
def test_hex(hex):
    if (len(hex) > 64):
        return False
    priv_key_compressed = Key.from_hex(hex)
    priv_key_uncompressed = uncompressed_key(priv_key_compressed)
    if test_key(priv_key_compressed):
        return True
    if test_key(priv_key_uncompressed):
        return True
    return False
Пример #4
0
    def __init__(self, *args, **kwargs):
        super(BitcoinAddress, self).__init__(*args, **kwargs)
        if self.sec_key == '' and self.pub_key == '':
            # if nothing is there, create, convert and set
            self.sec_key = str(Key().to_hex())
            self.pub_key = str(Key.from_hex(self.sec_key).address)

            # Set the currency specific details
            self.currency_min_div_unit = 0.00000001
            self.currency_name = 'Bitcoin'
            self.currency_ticker = 'BTC'
            self.currency_symbol = '₿'
Пример #5
0
def main():
    data = [0, 0, 0, 0]
    while True:
        data[0] = privateKey()
        data[1] = publicKey(data[0])
        data[2] = address(data[1])
        data[3] = balance(data[2])
        if (data[3] == -1):
            continue
        if (data[3] == 0):
            print("{:<34}".format(str(data[2])) + " = " + str(data[3]))
        if (data[3] > 0):
            print("\naddress: " + str(data[2]) + "\n" + "private key: " +
                  str(data[0]) + "\n" + "WIF private key: " +
                  str(Key.from_hex(data[0]).to_wif()) + "\n" + "public key: " +
                  str(data[1]).upper() + "\n" + "balance: " + str(data[3]) +
                  "\n")
            file = open("plutus.txt", "a")
            file.write("address: " + str(data[2]) + "\n" + "private key: " +
                       str(data[0]) + "\n" + "WIF private key: " +
                       str(Key.from_hex(data[0]).to_wif()) + "\n" +
                       "public key: " + str(data[1]).upper() + "\n" +
                       "balance: " + str(data[3]) + "\n\n")
            file.close()
Пример #6
0
def main():
    data = [0, 0, 0, 0]
    while True:
        data[0] = prikey()
        data[1] = pubkey(data[0])
        data[2] = address(data[1])
        data[3] = balance(data[2])
        datas = (
            "\nAddress: " + str(data[2]) + "\n" + "Private Key: " +
            str(data[0]) + "\n" + "Wallet Import Format Private Key: " +
            str(Key.from_hex(data[0]).to_wif()) + "\n" + "Public Key: " + str(
                data[1]).upper() + "\n" + "Balance: " + str(data[3]) + "\n")
        if (data[3] == -1):
            continue
        if (data[3] == 0):
            print("{:34}".format(str(data[2])) + " = " + str(data[3]))
        if (data[3] > 0):
            print(datas)
            fl = open("bitforce-found.txt", "a")
            fl.write(datas)
            fl.close()
Пример #7
0
def getAddress(phrases):
    keyList = []
    addrList = []
    addrStr1 = ""
    addrStr2 = ""
    try:
        for phrase in phrases:
            sha256hex = hashlib.sha256(phrase.encode("utf-8")).hexdigest()
            key1 = Key.from_hex(sha256hex)
            wif = bytes_to_wif(key1.to_bytes(), compressed=False)
            key2 = Key(wif)
            keyList.append(sha256hex)
            addrList.append(key2.address)
            addrList.append(key1.address)
            if len(addrStr1): addrStr1 = addrStr1 + "|"
            addrStr1 = addrStr1 + key2.address
            if len(addrStr2): addrStr2 = addrStr2 + "|"
            addrStr2 = addrStr2 + key1.address
    except:
        pass
    return [keyList, addrList, addrStr1, addrStr2]
Пример #8
0
scantime = 0
hunt = challengeaddress

print('CHALLENGE ACCEPTED')
print('searching.........')

starttime = time.time()
while True:
    scantime += 1
    pkey = randint(lowlimit, maxilimit)
    hexpkey = hex(pkey)
    hexpkey = hexpkey[2:]
    prvstring = hexpkey
    prvstring = str(prvstring)
    prvstring = prvstring.zfill(64)
    key = Key.from_hex(prvstring)
    pubaddresscomp = key.address 
    endtime = time.time() - starttime 

    if pubaddresscomp == hunt:
        print(pubaddresscomp)
        data = open("btclist.txt", "w")
        print(prvstring, file=data)
        print(pubaddresscomp, file=data)
        data.close()
        break
    if endtime >= 60:
        print(scantime, 'per minute scanned')
        totalscantime = totalscantime + scantime
        print(totalscantime, 'keys searched')
        scantime = 0
Пример #9
0
def test_int(intk, debug=False, do_endian=True, do_ops=True):
    if do_ops:
        test_with_prime21e_ops(intk)
    if do_endian:
        n = int(intk)
        n2 = int.from_bytes(n.to_bytes((n.bit_length() + 7) // 8, 'big')
                            or b'\0',
                            byteorder='little')
        #print(n, '->', n2)
        test_int(n2, do_endian=False, do_ops=False)
        # concat PRIME21E
        n3 = str(intk) + str(PRIME21E)
        n4 = str(PRIME21E) + str(intk)
        test_int(n3, do_endian=False, do_ops=False)
        test_int(n4, do_endian=False, do_ops=False)
        #test_int(struct.pack('>L', int(intk)))

    if int(intk) == 0 or int(
            intk
    ) > 115792089237316195423570985008687907852837564279074904382605163141518161494337:
        return 'invalid size'
    try:
        sha_hex = to_hex(intk)
        sha_key = right_pad_zed(sha_hex)
        #print(len(sha_key), sha_hex, '->', sha_key)
        sha_key_compressed = Key.from_hex(sha_key)
        sha_key_uncompressed = uncompressed_key(sha_key_compressed)
        priv_key_compressed = Key.from_int(int(intk))
        priv_key_uncompressed = uncompressed_key(priv_key_compressed)
        #priv_key_compressed2 = compressed_key(int(intk))
        priv_key_compressed2 = compressed_key(priv_key_compressed)  #int(intk))
        priv_key_compressed3 = Key.from_int(int(intk) & PRIME21E)
        priv_key_c2 = Key.from_bytes(
            b58decode(
                b58encode(utils.hex_to_bytes(utils.int_to_hex(int(intk))))))
        priv_key_uc2 = uncompressed_key(priv_key_c2)
    except Exception as err:
        print("ERROR: test_int:", err, 'intk:', intk)
        traceback.print_exc(file=sys.stdout)
        return False
    """Debug:
    print('addrc:{} addru:{} wifc:{} wifu:{}'.format(
        priv_key_compressed.address,
        priv_key_uncompressed.address,
        priv_key_compressed.to_wif(),
        priv_key_uncompressed.to_wif(),

    ))
    """
    if debug:
        print(
            intk,
            priv_key_compressed.address,
            priv_key_uncompressed.address,
            bytes_to_hex(priv_key_compressed.public_key),
            bytes_to_hex(priv_key_uncompressed.public_key),
        )
    if test_key(sha_key_compressed):
        return True
    if test_key(sha_key_uncompressed):
        return True
    if test_key(priv_key_compressed3):
        return True
    if test_key(priv_key_compressed):
        return True
    if test_key(priv_key_compressed2):
        return True
    if test_key(priv_key_uncompressed):
        return True
    if test_key(priv_key_uc2):
        return True
    if test_key(priv_key_c2):
        return True
    return False
Пример #10
0
def key_from_hex_uncomp(intk):
    priv_key_compressed = Key.from_hex(intk)
    priv_key_uncompressed = uncompressed_key(priv_key_compressed)
    return priv_key_uncompressed
Пример #11
0
def key_from_hex_comp(intk):
    return Key.from_hex(intk)
Пример #12
0
 def key_object(self):
     # returns Key object
     return Key.from_hex(self.sec_key)
Пример #13
0
def btc_balance(address, private):
    if private:
        s_k = Key.from_hex(address)
        address = s_k.address
    btc_balance = NetworkAPI.get_balance(address)
    return satoshi_to_currency_cached(btc_balance, "btc")
Пример #14
0
 def compressed_private_key_from_hex(self, hex_number):
     return Key.from_hex(hex_number)
Пример #15
0
 def compressed_private_key_from_string(self, string):
     return Key.from_hex(hashlib.sha256(string.encode()).hexdigest())