Всем привет, у меня возникают ошибки в выполнении кода.
Я планировал создать генератор мнемонических фраз и проверять их на баланс (а также я запрашивал у API всю инфу о нем). Если баланс положительный нужно записать всю инфу в файл good.txt. Но запустить не получаеться! Помогите кто сможет.
Ошибка
Traceback (most recent call last):
File "C:\****************\Bit\main.py", line 57, in <module>
asyncio.run(main(num_accounts))
File "C:\***********AppData\Local\Programs\Python\Python39-32\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\*************AppData\Local\Programs\Python\Python39-32\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\****************\Bit\main.py", line 39, in main
tasks.append(generate_bitcoin_account())
File "C:\****************\Bit\main.py", line 20, in generate_bitcoin_account
wif = bitcoinlib.keys.Key(secret_exponent=private_key, network='main')
TypeError: __init__() got an unexpected keyword argument 'secret_exponent'
Программа
import asyncio
import bitcoin
import bitcoinlib.keys
import aiohttp
import mnemonic
def generate_seed_phrase():
word_list = []
with open("words.txt", "r") as f:
word_list = f.read().splitlines()
return " ".join(bitcoin.random.sample(word_list, 12)).encode()
def generate_bitcoin_account():
seed_phrase = generate_seed_phrase()
mnemo = mnemonic.Mnemonic("english")
private_key = mnemo.to_seed(seed_phrase)
public_key = bitcoin.privtopub(private_key)
p2pkh_address = bitcoin.pubtoaddr(public_key)
p2sh_address = bitcoin.b58check_to_hex(bitcoin.pubtoaddr(public_key, 5))
wif = bitcoinlib.keys.Key(secret_exponent=private_key, network='main')
wallet_important_format = wif.wif()
account_info = {
"mnemonic": seed_phrase.decode(),
"private_key": private_key.hex(),
"public_key": public_key,
"wallet_important_format": wallet_important_format,
"p2pkh_address": p2pkh_address,
"p2sh_address": p2sh_address,
"p2wpkh_address": "",
"p2wsh_address": "",
"p2wsh_in_p2sh_address": ""
}
return account_info
async def main(num_accounts):
tasks = []
for _ in range(num_accounts):
tasks.append(generate_bitcoin_account())
results = await asyncio.gather(*tasks)
for account_info in results:
print("Mnemonic:", account_info["mnemonic"])
print("Private Key:", account_info["private_key"])
print("Public Key:", account_info["public_key"])
print("Wallet Important Format (WIF):", account_info["wallet_important_format"])
print("P2PKH Address:", account_info["p2pkh_address"])
print("P2SH Address:", account_info["p2sh_address"])
print("P2WPKH Address:", account_info["p2wpkh_address"])
print("P2WSH Address:", account_info["p2wsh_address"])
print("P2WSH In P2SH Address:", account_info["p2wsh_in_p2sh_address"])
print()
if __name__ == "__main__":
num_accounts = 10
asyncio.run(main(num_accounts))