Ejemplo n.º 1
0
async def BitcoinInfo(btc, chat_id):
	'''
	информация про биткоин кошельке
	'''
	try:
		balance = str(blockcypher.satoshis_to_btc(
			blockcypher.get_total_balance(btc))) + " ₿"
		transactions_num = blockcypher.get_total_num_transactions(btc)
		total = blockcypher.get_address_details(btc)
		total_sent = str(blockcypher.satoshis_to_btc(total['total_sent'])) + " ₿"
		total_received = str(blockcypher.satoshis_to_btc(
			total['total_received'])) + " ₿"

		BTCPanel = aiogram.types.InlineKeyboardMarkup()
		btn = aiogram.types.InlineKeyboardButton('♻️ Список Транзакций', callback_data=f'gettrans {btc}')
		BTCPanel.add(btn)

		await bot.send_message(chat_id, f'''
🌐<i><b>BTC</b></i>: {btc}
├Баланс: <i>{balance} ₿</i>
├Количество транзакций: <i>{transactions_num}</i>
├Получено: <i>{total_received}</i>
├Переведено: <i>{total_sent}</i>
		''', parse_mode='html', disable_web_page_preview=False, reply_markup=BTCPanel)
	except Exception as e:
		
		await bot.send_message(chat_id, "По этому BTC адресу нет информации")
Ejemplo n.º 2
0
def int_to_address(number):
    number0 = number >> 192
    number1 = (number >> 128) & 0xffffffffffffffff
    number2 = (number >> 64) & 0xffffffffffffffff
    number3 = number & 0xffffffffffffffff

    private_key = hexlify(PACKER.pack(number0, number1, number2,
                                      number3)).decode("utf-8")
    #print(private_key)
    #last digit is at a hexadecimal format , #64 zeroes
    #print('Converting from: ' + str(int(private_key, 16)))

    compressed_key = base58_check_encode(b'\x80', unhexlify(private_key), True)
    #print('Private key: ' + compressed_key)

    # address
    x, y = str(g * int(private_key, 16)).split()
    len1 = len(x)
    len2 = len(y)
    if len1 != 64:
        z = 64 - len1
        x = '0' * z + x

    if len2 != 64:
        z = 64 - len2
        y = '0' * z + y
    compressed_public_key_with_out_prefix = x + y

    pk_prefix = '02'
    if not int(compressed_public_key_with_out_prefix[64:], 16) % 2 == 0:
        pk_prefix = '03'
    #print(str(compressed_public_key_with_out_prefix[:64]))
    compressed_public_key = pk_prefix + compressed_public_key_with_out_prefix[:
                                                                              64]

    #print('Public key: ' + compressed_public_key)
    #print('Bitcoin address: ' + pub_key_to_addr(compressed_public_key))

    try:
        total = blockcypher.get_total_balance(
            pub_key_to_addr(compressed_public_key))
        print(str(total))
    except:
        total = AddressBalance().action('btc',
                                        pub_key_to_addr(compressed_public_key))
        print(str(total))

    if 0 < total:
        print(pub_key_to_addr(compressed_public_key) + " : " + str(total))
        with open('btc.txt', "a") as m:
            m.write(
                'Converting from: ' + str(int(private_key, 16)) +
                '\nPrivate key: ' + compressed_key + '\nPublic key: ' +
                compressed_public_key + '\nBitcoin address: ' +
                pub_key_to_addr(compressed_public_key) +
                '\nBitcoin Balance: ' + total +
                '\n#####################################################################\n\n\n\n'
            )
    else:
        pass
def balance(publicKey1):
    try:
        total = blockcypher.get_total_balance('publicKey1')
        bitcoinBalance = int(
            total
        ) / 100000000  # because the library keeps giving satoshi results even though the docs dont say that
        time.sleep(0.35)
        print('Balance is ' + str(total) + '  Satoshis, or in Bitcoin: ' +
              str(bitcoinBalance) + ', in account: ' + publicKey1)

        if bitcoinBalance > 0.000000001:
            # Open a file with access mode 'a'
            file_object = open('wallets_output.txt',
                               'a')  # open a file to save results to
            L = [
                publicKey1, " ", bitcoinBalance
            ]  # the results will be the amount of bitcoin and the public hash of the wallet
            file_object.writelines(
                L
            )  # write the results to a new line (presumably not overwriting previous results!)
            file_object.close(
            )  # always close the file, for some reason important!
        else:
            print(
                ""
            )  # not sure WTF I'm doing here, just had to make the IF work
    except:
        print('Account is not found')
Ejemplo n.º 4
0
def print_path_info(address, path, coin_symbol, wif=None):

    assert path, path
    assert coin_symbol, coin_symbol
    assert address, address

    if wif:
        address_formatted = '%s/%s' % (address, wif)
    else:
        address_formatted = address

    if USER_ONLINE:
        addr_balance = get_total_balance(
                address=address,
                coin_symbol=coin_symbol,
                )

        with indent(2):
            puts(colored.green('%s (%s) - %s' % (
                path,
                address_formatted,
                format_crypto_units(
                    input_quantity=addr_balance,
                    input_type='satoshi',
                    output_type=UNIT_CHOICE,
                    coin_symbol=coin_symbol,
                    print_cs=True,
                    ),
                )))
    else:
        with indent(2):
            puts(colored.green('%s (%s)' % (
                path,
                address_formatted,
                )))
Ejemplo n.º 5
0
def findBTC():
    counter = 0
    i = 0
    while (counter == 0):  # number of key pairs to generate`

        priv_key = os.urandom(32)
        fullkey = '80' + binascii.hexlify(priv_key).decode()
        sha256a = hashlib.sha256(binascii.unhexlify(fullkey)).hexdigest()
        sha256b = hashlib.sha256(binascii.unhexlify(sha256a)).hexdigest()
        WIF = base58.b58encode(binascii.unhexlify(fullkey + sha256b[:8]))

        # get public key , uncompressed address starts with "1"
        sk = ecdsa.SigningKey.from_string(priv_key, curve=ecdsa.SECP256k1)
        vk = sk.get_verifying_key()
        publ_key = '04' + binascii.hexlify(vk.to_string()).decode()
        hash160 = ripemd160(
            hashlib.sha256(binascii.unhexlify(publ_key)).digest()).digest()
        publ_addr_a = b"\x00" + hash160
        checksum = hashlib.sha256(
            hashlib.sha256(publ_addr_a).digest()).digest()[:4]
        publ_addr_b = base58.b58encode(publ_addr_a + checksum)
        i = i + 1
        balance = blockcypher.get_total_balance(publ_addr_b.decode())
        print(balance)
        if (balance > 0):
            print('Private Key    ',
                  str(i) + ": " + WIF.decode(),
                  file=open("output.txt", "a"))
            print("Bitcoin Address",
                  str(i) + ": " + publ_addr_b.decode(),
                  file=open("output.txt", "a"))
Ejemplo n.º 6
0
def balance(addr):
    try:
        total = blockcypher.get_total_balance(addr)
        print('Balance is ' + str(total))
    except:
        total = AddressBalance().action('btc', addr)
        print('Balance is ' + str(total))
Ejemplo n.º 7
0
def balance(publicKey):
    try:
        total = blockcypher.get_total_balance(publicKey)
        bitcoinBalance = int(total) / 100000000
        print('Balance is ' + str(total) + ' Satoshis, or in Bitcoin: ' +
              str(bitcoinBalance) + ', in account: ' + publicKey)
    except:
        print('Account is not found, exiting...')
Ejemplo n.º 8
0
 async def get_balance(wallet_address, coin_symbol):
     try:
         satoshi_balance = blockcypher.get_total_balance(
             wallet_address, coin_symbol=coin_symbol)
         btc_balance = blockcypher.from_satoshis(satoshi_balance, 'btc')
     except AssertionError:  # wrong wallet_address
         btc_balance = None
     return btc_balance
Ejemplo n.º 9
0
def wallet_balance(wallet_address, coinname):

    balance = float(
        blockcypher.get_total_balance(
            wallet_address,
            coin_symbol=coinname.lower(),
            api_key='cc5441d1862a4463961abaf964cdfe84')) / 100000000
    return balance
Ejemplo n.º 10
0
 def check_service_payed(self, payment_id):
     payment = Payment.objects.get(id=payment_id)
     payed = blockcypher.get_total_balance(payment.wallet, 'btc')
     if payed == payment.post.cost:
         payment.status = 'payed'
         return {'status': 'success'}
     else:
         return {'status': 'failed', 'reason': 'not enough has been payed'}
Ejemplo n.º 11
0
def login():

    # Please change the sleeping times, if your internet speed is high otherwise you it will waste your time, my internet
    #connection is really slow that's why i add some more sleep time.

    PWD = password()
    PP = passphrasegen()
    EMAIL = emailm()

    options = webdriver.ChromeOptions()
    options.binary_location = "E:/C/Cx86/Google/Chrome/Application/chrome.exe"
    options.add_experimental_option("detach", True)
    chrome_driver_binary = "chromedriver.exe"
    #global driver
    driver = webdriver.Chrome(chrome_driver_binary, chrome_options=options)

    driver.get("https://login.blockchain.com/en/#/recover")
    time.sleep(5)
    elem = driver.find_element_by_name("mnemonic")
    elem.send_keys(PP)
    elem = driver.find_element_by_css_selector(".sc-bdVaJa.iOqSrY").click()
    elem = driver.find_element_by_name("email")
    elem.send_keys(EMAIL)
    elem = driver.find_element_by_name("password")
    elem.send_keys(PWD)
    elem = driver.find_element_by_name("confirmationPassword")
    elem.send_keys(PWD)
    elem = driver.find_element_by_css_selector(".sc-bdVaJa.iOqSrY").click()
    time.sleep(40)
    elem = driver.find_element_by_css_selector(".sc-bdVaJa.RwQbC").click()
    time.sleep(10)
    elem = driver.find_element_by_xpath("//span[text()='Request']").click()
    elem = driver.find_element_by_css_selector('.sc-htpNat.gHBYSC').click()
    address = pyperclip.paste()

    #Checking the Balance

    try:
        total = blockcypher.get_total_balance(address)
    except:
        total = AddressBalance().action('btc', address)

    if 0 < total:
        os.system(r'cls')
        print(" [+]     Account is Cracked      [+]\n\n")
        print("Address         : " + address)
        print("Address Balance : " + str(total))
        print("Passphrase      : " + PP)
        print("Email           : " + EMAIL)
        print("Password        : " + PWD)
    else:
        driver.close()
def has_btc_address_positive_balance(addr: str) -> bool:
    try:
        res = coinaddrvalidator.validate("btc", addr).valid
        if res == True:
            balance = blockcypher.get_total_balance(addr)
            if balance > 0:
                return True
            else:
                return False
        else:
            return False
    except Exception as e:
        return False
Ejemplo n.º 13
0
def get_balance(wallet_type, address, contract_address=None, api_key=None):
    """Get the balance of a single wallet."""

    value = 0
    if wallet_type == 'ETH':
        account = Account(address=address, api_key=api_key)
        value += float(account.get_balance()) / 1000000000000000000
    elif wallet_type == 'EOS':
        api = Tokens(contract_address=contract_address, api_key=api_key)
        value += float(api.get_token_balance(address=address)) / 1000000000000000000
    elif wallet_type == 'XRB':
        # hardcoded for now...
        value = 10.179600
    else:
        value += blockcypher.get_total_balance(address, coin_symbol=wallet_type.lower()) / 100000000
    
    return value
Ejemplo n.º 14
0
    def CheckWallets(self):
        print('%s  ---- Start WalletAddressChecker.CheckWallets ----' %
              (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
        timer = Timer()
        timer.start()

        recent_data = {}
        dataFromDB = dict(self.dba.getWalletsTable())

        # Получить обновление балансов по проверяемым кошелькам
        for address, title in self.wallets.items():
            balance = blockcypher.get_total_balance(address)
            recent_data[address] = (title,
                                    blockcypher.from_satoshis(balance, 'btc'))

        isChange = 0
        text = ""
        for key, value in recent_data.items():
            walletTitle = value[0]
            balance = value[1]
            if dataFromDB.get(key) == None:
                isChange = 1
                continue
            if dataFromDB.get(key) > balance:
                isChange = 1
                text = '\n'.join([
                    text,
                    "С адреса {0:s} {1:s} отправлено {2:.8f} BTC ".format(
                        key, walletTitle, balance - dataFromDB[key])
                ])
            elif dataFromDB.get(key) < balance:
                isChange = 1
                text = '\n'.join([
                    text, "Адрес {0:s} {1:s} получил {2:.8f} BTC".format(
                        key, walletTitle, balance - dataFromDB[key])
                ])

        if isChange > 0:
            self.dba.refreshWalletsTable([(k, v[0], v[1])
                                          for k, v in recent_data.items()])
            self.messageSender.sendMessage(text)

        print(
            '----End process WalletAddressChecker.CheckWallets. Time is %s ----'
            % timer.stop())
Ejemplo n.º 15
0
def ping_address(publicAddress):
    global pk
    global wif
    global publicKey
    """
	sends Request to a Block Explorer	
	Use blockcypher Python package to fetch unlimited balances...
	"""

    balance = blockcypher.get_total_balance(publicAddress)
    print balance

    # "WifKey", "HexKey", "PublicAddress", "PublicKey", "Balance"
    #Comment out this line if you wish to NOT record blank keys
    logging.info('' + time.strftime("%m-%d-%y %H:%M:%S") + ',' + wif + ',' +
                 publicAddress)

    if float(balance) > 0.00000000:
        logging.info('' + time.strftime("%m-%d-%y %H:%M:%S") + ',' + wif +
                     ',' + publicAddress + ' ,balance ' + balance)

        print "Congratulations...alert the world cause you just made some sort of history friend!"
Ejemplo n.º 16
0
def address_current_balance(pub_key, ticker):
    key = str(pub_key)
    cur_bal = blockcypher.get_total_balance(key, ticker)
    bal = blockcypher.from_satoshis(cur_bal, 'btc')
    return bal
Ejemplo n.º 17
0
        priv_key = os.urandom(32)
        fullkey = '80' + binascii.hexlify(priv_key).decode()
        sha256a = hashlib.sha256(binascii.unhexlify(fullkey)).hexdigest()
        sha256b = hashlib.sha256(binascii.unhexlify(sha256a)).hexdigest()
        WIF = base58.b58encode(binascii.unhexlify(fullkey+sha256b[:8]))
        
        # get public key , uncompressed address starts with "1"
        sk = ecdsa.SigningKey.from_string(priv_key, curve=ecdsa.SECP256k1)
        vk = sk.get_verifying_key()
        publ_key = '04' + binascii.hexlify(vk.to_string()).decode()
        hash160 = self.ripemd160(hashlib.sha256(binascii.unhexlify(publ_key)).digest()).digest()
        publ_addr_a = b"\x00" + hash160
        checksum = hashlib.sha256(hashlib.sha256(publ_addr_a).digest()).digest()[:4]
        publ_addr_b = base58.b58encode(publ_addr_a + checksum)
        return (WIF.decode(), publ_addr_b.decode())

counter = 0

while(True):
    addr = BitcoinAddress()
    balance = 0
    try:
        balance = blockcypher.get_total_balance(addr.publicKey)
    except:
        print("API limitation exceeded")
    if(balance != 0):
        print(balance, addr.publicKey, addr.privateKey)
    if(counter % 1000 == 0):
        print('Queries: ', counter)
    counter += 1
    time.sleep(18) # wait 18 seconds --> 200 requests per hour, limit of blockcypher API
Ejemplo n.º 18
0
def balance(walletaddress):
    '''returns the wallet's balance in btcs'''
    satoshis_val = get_total_balance(walletaddress)
    balance = convert_to_btc(satoshis_val)
    return balance
def int_to_address(number):
    number0 = number >> 192
    number1 = (number >> 128) & 0xffffffffffffffff
    number2 = (number >> 64) & 0xffffffffffffffff
    number3 = number & 0xffffffffffffffff

    private_key = hexlify(PACKER.pack(number0, number1, number2,
                                      number3)).decode("utf-8")

    ###############################################
    print('Converting from: ' + str(int(private_key, 16)))
    ###############################################

    compressed_key = base58_check_encode(b'\x80', unhexlify(private_key), True)

    ###############################################
    print('Private key    : ' + compressed_key)
    ###############################################

    # address
    x, y = str(g * int(private_key, 16)).split()
    len1 = len(x)
    len2 = len(y)
    if len1 != 64:
        z = 64 - len1
        x = '0' * z + x

    if len2 != 64:
        z = 64 - len2
        y = '0' * z + y
    compressed_public_key_with_out_prefix = x + y
    pk_prefix = '02'
    if not int(compressed_public_key_with_out_prefix[64:], 16) % 2 == 0:
        pk_prefix = '03'
    compressed_public_key = pk_prefix + compressed_public_key_with_out_prefix[:
                                                                              64]

    ###############################################

    print('Public key     : ' + compressed_public_key)
    ###############################################

    ###############################################
    print('Bitcoin address: ' + pub_key_to_addr(compressed_public_key))
    try:
        total = blockcypher.get_total_balance(
            pub_key_to_addr(compressed_public_key))
    except:
        total = AddressBalance().action('btc',
                                        pub_key_to_addr(compressed_public_key))

    total_fiat = satoshi.to_fiat(int(total))
    #r = requests.get("https://blockchain.infor/rawaddr/{}".format(pub_key_to_addr(compressed_public_key)))
    tr = Request('https://blockchain.info/q/getreceivedbyaddress/' +
                 pub_key_to_addr(compressed_public_key))
    total_received = str(urlopen(tr).read())
    trr = total_received[2:][:-1]
    total_fiat_received = satoshi.to_fiat(int(trr))

    ts = Request("https://blockchain.info/q/getsentbyaddress/" +
                 pub_key_to_addr(compressed_public_key))
    total_sent = str(urlopen(ts).read())
    tsr = total_sent[2:][:-1]
    total_fiat_sent = satoshi.to_fiat(int(tsr))
    #print('$'+str(s))
    print("Total Sent     : " + str(tsr) + " || $" + str(total_fiat_sent))
    print("Total Received : " + str(trr) + " || $" + str(total_fiat_received))
    print("Final Balance  : " + str(total) + " || $" + str(total_fiat) + '\n')
    #stotal = blockcypher.from_satoshis(total, 'btc')
    with open('walletb.txt', "a") as f:
        f.write(
            'Converting from: ' + str(int(private_key, 16)) +
            '\nPrivate key: ' + compressed_key + '\nPublic key: ' +
            compressed_public_key + '\nBitcoin address: ' +
            pub_key_to_addr(compressed_public_key) + '\nFianl Balance: ' +
            str(total) + "\nTotal Received : " + str(trr) + " || $" +
            str(total_fiat_received) + "\nTotal Sent     : " + str(tsr) +
            " || $" + str(total_fiat_sent) +
            '\n#####################################################################\n\n\n\n'
        )

    if 0 < total:
        print(pub_key_to_addr(compressed_public_key) + " : " + total)
        with open('wallet_with_money.txt', "a") as m:
            m.write(
                'Converting from: ' + str(int(private_key, 16)) +
                '\nPrivate key: ' + compressed_key + '\nPublic key: ' +
                compressed_public_key + '\nBitcoin address: ' +
                pub_key_to_addr(compressed_public_key) +
                '\nBitcoin Balance: ' + str(total) +
                '\n#####################################################################\n\n\n\n'
            )
    else:
        pass
Ejemplo n.º 20
0
def litecoin_balance(litecoin_public_key):
    litecoin_public_key = str(litecoin_public_key)
    sat_balance = blockcypher.get_total_balance(litecoin_public_key, 'ltc')
    ltc_balance = blockcypher.from_satoshis(sat_balance, 'btc')
    return ltc_balance
Ejemplo n.º 21
0
def dash_balance(dash_public_key):
    dash_public_key = str(dash_public_key)
    sat_balance = blockcypher.get_total_balance(dash_public_key, 'dash')
    dash_balance = blockcypher.from_satoshis(sat_balance, 'btc')
    return dash_balance
Ejemplo n.º 22
0
def bitcoin_balance(bitcoin_public_key):
    bitcoin_public_key = str(bitcoin_public_key)
    sat_balance = blockcypher.get_total_balance(bitcoin_public_key)
    btc_balance = blockcypher.from_satoshis(sat_balance, 'btc')
    return btc_balance
Ejemplo n.º 23
0
def bala(address):
    return blockcypher.get_total_balance(address)