The script requires you to have an etherscan api key which you can steal from someone or get from their site yourself
It will check up to 100k randomized private keys a day. If you leave it running on a raspberry-pi it will take breaks and then start again once your cool down period is over. The logfile that is created is useful for sending yourself alerts if you do happen to find something.
Below is a watchdog portion you can further customize for alerts via SMS/Email.
This was all written by GPT just for fun of course since the chances of actually finding anything are a needle in a haystack. I wish you the best of luck if you do try and remember if you win the ETH lottery to donate to the forums!
Python:
import csv
import os
import time
import requests
import logging
from eth_account import Account
ETHERSCAN_API_KEY = "Steal_your_own_key_its_more_fun"
ETHERSCAN_API_URL = "https://api.etherscan.io/api"
logging.basicConfig(filename='wallet_bruteforce.log', level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s')
def generate_private_key():
return os.urandom(32).hex()
def derive_address(private_key):
account = Account.from_key(private_key)
return account.address
def check_balance(address):
params = {
"module": "account",
"action": "balance",
"address": address,
"tag": "latest",
"apikey": ETHERSCAN_API_KEY
}
response = requests.get(ETHERSCAN_API_URL, params=params)
data = response.json()
if data['status'] == '1':
balance = int(data['result']) / 10**18 # Convert from Wei to Ether
return balance
else:
logging.error(f"Error checking balance for {address}: {data['message']}")
return None
def save_results(results):
with open('wallets_with_balance.csv', mode='w', newline='') as file:
writer = csv.writer(file)
writer.writerow(['Private Key', 'Address', 'Balance (ETH)'])
for result in results:
writer.writerow([result['private_key'], result['address'], result['balance']])
def bruteforce_wallets(num_attempts):
results = []
attempt_count = 0
while attempt_count < num_attempts:
try:
private_key = generate_private_key()
address = derive_address(private_key)
balance = check_balance(address)
logging.info(f"Attempt {attempt_count + 1}/{num_attempts}: Private Key: {private_key}, Address: {address}, Balance: {balance if balance is not None else 'Error checking balance'}")
if balance and balance > 0:
print(f"Found wallet with balance! Address: {address}, Balance: {balance} ETH")
results.append({'private_key': private_key, 'address': address, 'balance': balance})
attempt_count += 1
time.sleep(1.3)
except requests.exceptions.RequestException as e:
logging.error(f"Request failed: {e}")
print("API limit reached or network error occurred. Waiting for 24 hours before retrying...")
time.sleep(86400) # Sleep for 24 hours
save_results(results)
print("Bruteforce completed. Results saved to 'wallets_with_balance.csv'.")
if __name__ == "__main__":
num_attempts = 1000000
bruteforce_wallets(num_attempts)
It will check up to 100k randomized private keys a day. If you leave it running on a raspberry-pi it will take breaks and then start again once your cool down period is over. The logfile that is created is useful for sending yourself alerts if you do happen to find something.
Below is a watchdog portion you can further customize for alerts via SMS/Email.
Python:
import smtplib
from email.mime.text import MIMEText
import time
import logging
EMAIL_SENDER = "your_email@example.com"
EMAIL_RECEIVER = "your_phone_number@your_sms_gateway.com"
SMTP_SERVER = "smtp.example.com"
SMTP_PORT = 587
SMTP_USERNAME = "your_email@example.com"
SMTP_PASSWORD = "your_email_password"
LOG_FILE = 'wallet_bruteforce.log'
LAST_CHECKED_FILE = 'last_checked.log'
logging.basicConfig(filename='notification_script.log', level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s')
def send_notification(message):
msg = MIMEText(message)
msg['Subject'] = 'Wallet Balance Found'
msg['From'] = EMAIL_SENDER
msg['To'] = EMAIL_RECEIVER
try:
with smtplib.SMTP(SMTP_SERVER, SMTP_PORT) as server:
server.starttls()
server.login(SMTP_USERNAME, SMTP_PASSWORD)
server.sendmail(EMAIL_SENDER, EMAIL_RECEIVER, msg.as_string())
logging.info(f"Notification sent: {message}")
except Exception as e:
logging.error(f"Failed to send notification: {e}")
def check_log_file():
last_checked = 0
try:
with open(LAST_CHECKED_FILE, 'r') as f:
last_checked = int(f.read().strip())
except FileNotFoundError:
pass
with open(LOG_FILE, 'r') as log_file:
lines = log_file.readlines()
new_entries = lines[last_checked:]
for line in new_entries:
if 'Found wallet with balance!' in line:
send_notification(line.strip())
with open(LAST_CHECKED_FILE, 'w') as f:
f.write(str(len(lines)))
def main():
while True:
check_log_file()
time.sleep(86400)
if __name__ == "__main__":
main()
This was all written by GPT just for fun of course since the chances of actually finding anything are a needle in a haystack. I wish you the best of luck if you do try and remember if you win the ETH lottery to donate to the forums!