from eth_account import Account from eth_account.hdaccount import HDPath import os def generate_wallets(mnemonic, num_wallets): wallets = [] Account.enable_unaudited_hdwallet_features() try: Account.from_mnemonic(mnemonic) except ValueError as e: raise ValueError("Invalid mnemonic phrase") from e for i in range(num_wallets): derivation_path = f"m/44'/60'/0'/0/{i}" wallet = Account.from_mnemonic(mnemonic, account_path=derivation_path) address = wallet.address private_key = wallet.key.hex() wallets.append({ "address": address, "private_key": private_key, "mnemonic": mnemonic }) return wallets mnemonic = "need rare control glove luxury punch orbit beef antique return average appear trumpet cattle hundred unknown unable exist rotate village produce address guilt naive" num_wallets = 100 try: wallets = generate_wallets(mnemonic, num_wallets) for index, wallet in enumerate(wallets, 1): print(f"Wallet {index}:") print(f" Address: {wallet['address']}") print(f" Private Key: {wallet['private_key']}") print(f" Mnemonic: {wallet['mnemonic']}") print("---") except Exception as e: print(f"Error generating wallets: {str(e)}")