seed backup appended to create wallet

This commit is contained in:
0ceanSlim 2023-12-18 16:40:02 -05:00
parent 4485cc15a0
commit ac16a24b7c
3 changed files with 12 additions and 1 deletions

BIN
cli.exe

Binary file not shown.

View File

@ -1 +1,2 @@
python-bitcoinrpc python-bitcoinrpc
mnemonic

View File

@ -1,5 +1,6 @@
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util.rpcHandler import read_rpc_config, create_rpc_connection from util.rpcHandler import read_rpc_config, create_rpc_connection
from mnemonic import Mnemonic
# Read the RPC configuration from the configuration file # Read the RPC configuration from the configuration file
rpc_host, rpc_port, rpc_user, rpc_password = read_rpc_config() rpc_host, rpc_port, rpc_user, rpc_password = read_rpc_config()
@ -19,6 +20,15 @@ try:
if wallet_name not in wallet_info: if wallet_name not in wallet_info:
rpc_connection.createwallet(wallet_name) rpc_connection.createwallet(wallet_name)
print(f"Wallet '{wallet_name}' created successfully.") print(f"Wallet '{wallet_name}' created successfully.")
# Generate HD seed
mnemonic = Mnemonic("english")
seed_words = mnemonic.generate(256) # 256 bits entropy for BIP39
print("Write down these seed words:")
print(seed_words)
# You might want to save or display these seed words securely for the user
else: else:
print(f"Wallet '{wallet_name}' already exists.") print(f"Wallet '{wallet_name}' already exists.")