├── README.md └── btcFinder.py /README.md: -------------------------------------------------------------------------------- 1 | # bitcoinFinder 2 | This created for only test and to study 3 | 4 | Checking all bitcoin address and if balance is not zero saving in file bitcoin address and private key 5 | -------------------------------------------------------------------------------- /btcFinder.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import requests 4 | import hashlib 5 | from hashlib import sha256 6 | from ecdsa import SigningKey, SECP256k1 7 | 8 | 9 | class address: 10 | P = 2 ** 256 - 2 ** 32 - 2 ** 9 - 2 ** 8 - 2 ** 7 - 2 ** 6 - 2 ** 4 - 1 11 | G = (0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 12 | 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8) 13 | B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" 14 | 15 | def ripemd160(x): 16 | d = hashlib.new("ripemd160") 17 | d.update(x) 18 | return d 19 | 20 | def point_add(p, q): 21 | xp, yp = p 22 | xq, yq = q 23 | 24 | if p == q: 25 | l = pow(2 * yp % address.P, address.P - 2, address.P) * (3 * xp * xp) % address.P 26 | else: 27 | l = pow(xq - xp, address.P - 2, address.P) * (yq - yp) % address.P 28 | 29 | xr = (l ** 2 - xp - xq) % address.P 30 | yr = (l * xp - l * xr - yp) % address.P 31 | 32 | return xr, yr 33 | 34 | def point_mul(p, d): 35 | n = p 36 | q = None 37 | 38 | for i in range(256): 39 | if d & (1 << i): 40 | if q is None: 41 | q = n 42 | else: 43 | q = address.point_add(q, n) 44 | 45 | n = address.point_add(n, n) 46 | 47 | return q 48 | 49 | def point_bytes(p): 50 | x, y = p 51 | 52 | return b"\x04" + x.to_bytes(32, "big") + y.to_bytes(32, "big") 53 | 54 | def b58_encode(d): 55 | out = "" 56 | p = 0 57 | x = 0 58 | 59 | while d[0] == 0: 60 | out += "1" 61 | d = d[1:] 62 | 63 | for i, v in enumerate(d[::-1]): 64 | x += v * (256 ** i) 65 | 66 | while x > 58 ** (p + 1): 67 | p += 1 68 | 69 | while p >= 0: 70 | a, x = divmod(x, 58 ** p) 71 | out += address.B58[a] 72 | p -= 1 73 | 74 | return out 75 | 76 | def make_address(privkey): 77 | q = address.point_mul(address.G, int.from_bytes(privkey, "big")) 78 | hash160 = address.ripemd160(sha256(address.point_bytes(q)).digest()).digest() 79 | addr = b"\x00" + hash160 80 | checksum = sha256(sha256(addr).digest()).digest()[:4] 81 | addr += checksum 82 | 83 | wif = b"\x80" + privkey 84 | checksum = sha256(sha256(wif).digest()).digest()[:4] 85 | wif += checksum 86 | addr = address.b58_encode(addr) 87 | wif = address.b58_encode(wif) 88 | 89 | return addr, wif 90 | 91 | 92 | class save: 93 | def toFile(text): 94 | file = open("result.txt", "a+") 95 | file.write(text) 96 | file.close() 97 | 98 | 99 | class check: 100 | def balance(address): 101 | try: 102 | request = requests.get("https://chain.api.btc.com/v3/address/" + address) 103 | response = request.json() 104 | balance = response['data']['balance'] 105 | return balance 106 | except: 107 | return "Failed to establish a new connection" 108 | 109 | 110 | print("=========================START BRUTE=========================") 111 | 112 | i = 0 113 | balance = float(0) 114 | 115 | while True: 116 | 117 | i += 1 118 | sk = SigningKey.generate(curve=SECP256k1) 119 | vk = sk.get_verifying_key() 120 | addr, wif = address.make_address(sk.to_string()) 121 | 122 | try: 123 | balance = float(check.balance(addr)) 124 | except: 125 | print("Failed to establish a new connection") 126 | 127 | res = "Count: %s | Address: %s | privateKey: %s | Balance: %s \n" % (i, addr, wif, balance) 128 | if balance > 0: 129 | save.toFile(res) 130 | 131 | print(res) 132 | --------------------------------------------------------------------------------