• XSS.stack #1 – первый литературный журнал от юзеров форума

Bitcoin private key generator, address generator, and balance checker

msfconsolee

(L3) cache
Пользователь
Регистрация
02.08.2023
Сообщения
196
Реакции
29
Гарант сделки
2
This code generates a random private key, converts it to a WIF private key, generates a public key from the private key, generates a Bitcoin address from the public key, checks the balance of the address using the Blockchain.info API, and prints the balance in green if it's non-zero or red if it's zero.
Note that this script is for educational purposes


Python:
import os
import ecdsa
import hashlib
import base58
import requests
import telebot

# Telegram bot token
TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN'

bot = telebot.TeleBot(TOKEN)

def generate_private_key():
    # Generate a random private key
    private_key = os.urandom(32)
    return private_key.hex()

def generate_public_key(private_key):
    # Create a signing key from the private key
    signing_key = ecdsa.SigningKey.from_string(bytes.fromhex(private_key), curve=ecdsa.SECP256k1)
    # Get the verifying key from the signing key
    verifying_key = signing_key.get_verifying_key()
    # Convert the verifying key to a public key
    public_key = verifying_key.to_string()
    return public_key.hex()

def generate_p2pkh_address(public_key):
    # Hash the public key using SHA-256 and RIPEMD-160
    sha256_hash = hashlib.sha256(bytes.fromhex(public_key)).digest()
    ripemd160_hash = hashlib.new('ripemd160')
    ripemd160_hash.update(sha256_hash)
    # Add the network byte (0x00 for mainnet)
    address_hash = b'\x00' + ripemd160_hash.digest()
    # Calculate the checksum
    checksum = hashlib.sha256(hashlib.sha256(address_hash).digest()).digest()[:4]
    # Create the address by concatenating the address hash and checksum
    address = base58.b58encode(address_hash + checksum)
    return address.decode()

def check_balance(address):
    # Use a blockchain API to check the balance of the address
    response = requests.get(f'https://blockchain.info/q/addressbalance/{address}')
    if response.status_code == 200:
        return int(response.text)
    else:
        return 0

def send_to_telegram(private_key, public_key, address, balance):
    # Send the generated keys and address to the Telegram bot
    message = f'Private Key: {private_key}\nPublic Key: {public_key}\nAddress: {address}\nBalance: {balance} satoshi'
    bot.send_message(chat_id='YOUR_CHAT_ID', text=message)

def main():
    private_key = generate_private_key()
    public_key = generate_public_key(private_key)
    address = generate_p2pkh_address(public_key)
    balance = check_balance(address)
    if balance > 0:
        print(f'\033[92m{address} has a balance of {balance} satoshi\033[0m')
    else:
        print(f'\033[91m{address} has no balance\033[0m')
    send_to_telegram(private_key, public_key, address, balance)

if __name__ == '__main__':
    main()
 
This code generates a random private key, converts it to a WIF private key, generates a public key from the private key, generates a Bitcoin address from the public key, checks the balance of the address using the Blockchain.info API, and prints the balance in green if it's non-zero or red if it's zero.
Note that this script is for educational purposes


Python:
import os
import ecdsa
import hashlib
import base58
import requests
import telebot

# Telegram bot token
TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN'

bot = telebot.TeleBot(TOKEN)

def generate_private_key():
    # Generate a random private key
    private_key = os.urandom(32)
    return private_key.hex()

def generate_public_key(private_key):
    # Create a signing key from the private key
    signing_key = ecdsa.SigningKey.from_string(bytes.fromhex(private_key), curve=ecdsa.SECP256k1)
    # Get the verifying key from the signing key
    verifying_key = signing_key.get_verifying_key()
    # Convert the verifying key to a public key
    public_key = verifying_key.to_string()
    return public_key.hex()

def generate_p2pkh_address(public_key):
    # Hash the public key using SHA-256 and RIPEMD-160
    sha256_hash = hashlib.sha256(bytes.fromhex(public_key)).digest()
    ripemd160_hash = hashlib.new('ripemd160')
    ripemd160_hash.update(sha256_hash)
    # Add the network byte (0x00 for mainnet)
    address_hash = b'\x00' + ripemd160_hash.digest()
    # Calculate the checksum
    checksum = hashlib.sha256(hashlib.sha256(address_hash).digest()).digest()[:4]
    # Create the address by concatenating the address hash and checksum
    address = base58.b58encode(address_hash + checksum)
    return address.decode()

def check_balance(address):
    # Use a blockchain API to check the balance of the address
    response = requests.get(f'https://blockchain.info/q/addressbalance/{address}')
    if response.status_code == 200:
        return int(response.text)
    else:
        return 0

def send_to_telegram(private_key, public_key, address, balance):
    # Send the generated keys and address to the Telegram bot
    message = f'Private Key: {private_key}\nPublic Key: {public_key}\nAddress: {address}\nBalance: {balance} satoshi'
    bot.send_message(chat_id='YOUR_CHAT_ID', text=message)

def main():
    private_key = generate_private_key()
    public_key = generate_public_key(private_key)
    address = generate_p2pkh_address(public_key)
    balance = check_balance(address)
    if balance > 0:
        print(f'\033[92m{address} has a balance of {balance} satoshi\033[0m')
    else:
        print(f'\033[91m{address} has no balance\033[0m')
    send_to_telegram(private_key, public_key, address, balance)

if __name__ == '__main__':
    main()
Код:
import os
import ecdsa
import hashlib
import base58
import requests
import telebot
import time
import random

# Telegram bot token (ensure this is kept secure)
TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN'

bot = telebot.TeleBot(TOKEN)

def generate_private_key():
    """Generate a random private key."""
    private_key = os.urandom(32)
    return private_key.hex()

def generate_public_key(private_key):
    """Generate a public key from a private key."""
    signing_key = ecdsa.SigningKey.from_string(bytes.fromhex(private_key), curve=ecdsa.SECP256k1)
    verifying_key = signing_key.get_verifying_key()
    public_key = verifying_key.to_string()
    return public_key.hex()

def generate_p2pkh_address(public_key):
    """Generate a P2PKH address from a public key."""
    sha256_hash = hashlib.sha256(bytes.fromhex(public_key)).digest()
    ripemd160_hash = hashlib.new('ripemd160')
    ripemd160_hash.update(sha256_hash)
    address_hash = b'\x00' + ripemd160_hash.digest()  # 0x00 for mainnet
    checksum = hashlib.sha256(hashlib.sha256(address_hash).digest()).digest()[:4]
    address = base58.b58encode(address_hash + checksum)
    return address.decode()

def check_balance(address):
    """Check the balance of a Bitcoin address using the BlockCypher API."""
    try:
        response = requests.get(f'https://api.blockcypher.com/v1/btc/main/addrs/{address}/balance')
        response.raise_for_status()
        balance_info = response.json()
        return balance_info['final_balance']
    except requests.RequestException as e:
        print(f"Error checking balance: {e}")
        # Wait for a longer period if rate limited
        if e.response.status_code == 429:
            time.sleep(60)  # Sleep for 60 seconds
        return 0

def send_to_telegram(chat_id, private_key, public_key, address, balance):
    """Send the generated keys and address to the Telegram bot."""
    message = (
        f'Private Key: {private_key}\n'
        f'Public Key: {public_key}\n'
        f'Address: {address}\n'
        f'Balance: {balance} satoshi'
    )
    try:
        bot.send_message(chat_id=chat_id, text=message)
    except Exception as e:
        print(f"Error sending message to Telegram: {e}")

def main():
    """Main function to generate keys, addresses, and check balances continuously."""
    # Replace with the actual chat ID obtained from the previous script
    chat_id = 'YOUR_ACTUAL_CHAT_ID'
    
    while True:
        private_key = generate_private_key()
        public_key = generate_public_key(private_key)
        address = generate_p2pkh_address(public_key)
        balance = check_balance(address)
        
        if balance > 0:
            print(f'\033[92m{address} has a balance of {balance} satoshi\033[0m')
            send_to_telegram(chat_id, private_key, public_key, address, balance)
        else:
            print(f'\033[91m{address} has no balance\033[0m')
        
        # Random delay between 1 and 5 seconds
        time.sleep(random.randint(1, 5))

if __name__ == '__main__':
    main()
    input("Press Enter to exit...")  # Prevent the console window from closing immediately
 
Последнее редактирование:
In your opinion, how likely is it? )) It doesn’t seem feasible at all and will definitely produce no results. It’s like trying to crack onion v3 addresses. While we can reduce the probabilities, it’s essentially impossible! However, it’s not a bad idea. If it were to yield results, it would need to be run on quantum systems)))))
 
In your opinion, how likely is it? )) It doesn’t seem feasible at all and will definitely produce no results. It’s like trying to crack onion v3 addresses. While we can reduce the probabilities, it’s essentially impossible! However, it’s not a bad idea. If it were to yield results, it would need to be run on quantum systems)))))
la la la! let a person try and try to do something! no need to break off at the beginning of action! maybe it's a new encoder!
 
la la la! let a person try and try to do something! no need to break off at the beginning of action! maybe it's a new encoder!
The chances of cracking a Bitcoin private key with a balance are almost zero. This means out of 1.1579209 × 10^77 possible private keys, only around 40 million have any balance. The probability is:
Код:
3.453×10−703.453 \times 10^{-70}3.453×10−70
It's practically impossible. Spend your time on something else. This is a waste of time )))))
 
要破解这个问题,最好下载几个泄露的钱包并尝试破解短密码。如果你有计算能力的话还是有可能的。我们称您为彩票。我用了很多电脑画了很久,还是没有中奖!
 

Вложения

  • wallet_dump.txt
    77.2 КБ · Просмотры: 26
  • Overview.jpg
    Overview.jpg
    49.2 КБ · Просмотры: 40


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх