import bitcoin
import requests
import random
class private_key:
def ilk_private_key(self):
liste_ilk_basamak=["8", "9", "A", "B", "C", "D", "E", "F"]
liste_son15_basamak = "0123456789ABCDEF"
private_key3_random = "".join(random.choice(liste_ilk_basamak) for _ in range(1)) + "".join(random.choice(liste_son15_basamak) for _ in range(15))
x = private_key3_random
private_key3_random = x
decoded_private_key3 = bitcoin.decode_privkey(private_key3_random, 'hex')
valid_private_key3 = 0 < decoded_private_key3 < bitcoin.N
print("Private Key3 (hex) is: ", private_key3_random)
print("Private Key3 (decimal) is: ", decoded_private_key3)
# Convert private key to WIF format
wif_encoded_private_key3 = bitcoin.encode_privkey(decoded_private_key3, 'wif')
print("Private Key3 (WIF) is: ", wif_encoded_private_key3)
# Add suffix "01" to indicate a compressed private key
compressed_private_key3 = private_key3_random + '01'
print("Private Key3 Compressed (hex) is: ", compressed_private_key3)
# Generate a WIF format from the compressed private key (WIF-compressed)
wif_compressed_private_key3 = bitcoin.encode_privkey(
bitcoin.decode_privkey(compressed_private_key3, 'hex'), 'wif')
print("Private Key3 (WIF-Compressed) is: ", wif_compressed_private_key3)
# Multiply the EC generator point G with the private key to get a public key point
public_key3 = bitcoin.multiply(bitcoin.G, decoded_private_key3)
print("Public Key3 (x,y) coordinates is:",public_key3)
# Encode as hex, prefix 04
hex_encoded_public_key3 = bitcoin.encode_pubkey(public_key3, 'hex')
print("Public Key3 (hex) is:", hex_encoded_public_key3)
# Compress public key, adjust prefix depending on whether y is even or odd
(public_key3_x, public_key3_y) = public_key3
if (public_key3_y % 2) == 0:
compressed_prefix3 = '02'
else:
compressed_prefix3 = '03'
hex_compressed_public_key3 = compressed_prefix3 + bitcoin.encode(public_key3_x, 16)
print("Compressed Public Key3 (hex) is:", hex_compressed_public_key3)
# Generate bitcoin address from public key
print("Bitcoin Address3 (b58check) is:", bitcoin.pubkey_to_address(public_key3))
# Generate compressed bitcoin address from compressed public key
print("Compressed Bitcoin Address3 (b58check) is:",
bitcoin.pubkey_to_address(hex_compressed_public_key3))
return private_key3_random
class save:
def toFile(text):
file = open("result.txt", "a+")
file.write(text)
file.close()
class check:
def balance(Adress):
try:
request = requests.get("https://blockstream.info/api/address/" + Adress)
ourJSON = request.json()
balance = dict(ourJSON['chain_stats'])['funded_txo_sum']
return balance
except:
return "Failed to establish a new connection"
print("=========================START BRUTE=========================")
i = 0
balance = float(0)
while True:
i += 1
try:
liste_ilk_basamak=["8", "9", "A", "B", "C", "D", "E", "F"]
liste_son15_basamak = "0123456789ABCDEF"
private_key3_random = "".join(random.choice(liste_ilk_basamak) for _ in range(1)) + "".join(random.choice(liste_son15_basamak) for _ in range(15))
decoded_private_key3 = bitcoin.decode_privkey(private_key3_random, 'hex')
public_key3 = bitcoin.multiply(bitcoin.G, decoded_private_key3)
(public_key3_x, public_key3_y) = public_key3
if (public_key3_y % 2) == 0:
compressed_prefix3 = '02'
else:
compressed_prefix3 = '03'
hex_compressed_public_key3 = compressed_prefix3 + bitcoin.encode(public_key3_x, 16)
Adress = bitcoin.pubkey_to_address(hex_compressed_public_key3)
balance = float(check.balance(bitcoin.pubkey_to_address(hex_compressed_public_key3)))
except:
print("Failed to establish a new connection")
res = "Count: %s | Address: %s | privateKey: %s | Balance: %s \n" % (i, Adress, private_key3_random, balance)
if balance > 0.1:
save.toFile(res)
print(res)
- When i run this code looks like no problem but suddenly crashed and it wrongly find same adress with different private keys.
- Also when i made exe with auto-py-to-exe. program did not run with "NameError Name 'Adress' is not defined.Failed to execute scrip.
But i defined error. İ am new here does anyone know how can i solve this problems ?
Aucun commentaire:
Enregistrer un commentaire