import os import threading import time from mnemonic import Mnemonic from ethaccount…
- User
import os import threading import time from mnemonic import Mnemonic from eth_account import Account import requests import json import sys
Account.enable_unaudited_hdwallet_features() api_keys = ["9V98U5PIUSBU8GGE96KMTCBJGW9CGM1Z1K", "XYY8VPXWTWZIWGZ86T47JTCM53PASZPFM8", "8SCUMBDXDCBFEVQX8EHH3MWQZK8JT5TEWC"] lock = threading.Lock()
def api_request(api_keys, endpoint, params): for key in api_keys: params['apikey'] = key try: response = requests.get(endpoint, params=params) response.raise_for_status() data = response.json() if data.get("status") == "1": return data except requests.exceptions.RequestException: continue raise Exception("All API keys failed or were rate-limited")
def create_directories(): os.makedirs("wallets", exist_ok=True) os.makedirs("wallets_with_balance", exist_ok=True)
def generate_wallet(api_keys): mnemo = Mnemonic("english") while True: words = mnemo.generate(strength=128) filename = os.path.join("wallets", f"{words.replace(' ', '_')}.json")
if not os.path.exists(filename): account = Account.from_mnemonic(words) data = { "mnemonic": words, "address": account.address, "checked": False } with open(filename, 'w') as f: json.dump(data, f) with lock: with open("statistics.json", 'r+') as stat_file: stats = json.load(stat_file) stats['wallet_count'] += 1 stat_file.seek(0) json.dump(stats, stat_file)def check_balance(api_keys): while True: files = [f for f in os.listdir("wallets") if f.endswith('.json')] for filename in files: filepath = os.path.join("wallets", filename) with open(filepath, 'r') as f: data = json.load(f)
if not data["checked"]: try: endpoint = "https://api.etherscan.io/api" params = { "module": "account", "action": "balance", "address": data["address"] } result = api_request(api_keys, endpoint, params) balance = int(result["result"]) / 10 ** 18 if result["status"] == "1" else 0 if balance > 0: with open(os.path.join("wallets_with_balance", filename), 'w') as balance_file: data['balance'] = balance json.dump(data, balance_file) data["checked"] = True with open(filepath, 'w') as f: json.dump(data, f) with lock: with open("statistics.json", 'r+') as stat_file: stats = json.load(stat_file) stats['checked_wallets'] += 1 stat_file.seek(0) json.dump(stats, stat_file) except Exception as e: print(f"Error checking balance for {data['address']}: {e}") time.sleep(1) - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.