python-hdwallet icon indicating copy to clipboard operation
python-hdwallet copied to clipboard

Generate independent Mnemonic Phrase for address

Open fj44dn opened this issue 2 years ago • 0 comments

I want to generate a independent Mnemonic Phrase, but with the code generate the same Mnemonic Phrase:

import mnemonic
import threading
from hdwallet import BIP44HDWallet
from hdwallet.cryptocurrencies import EthereumMainnet
from hdwallet.derivations import BIP44Derivation
from hdwallet.utils import generate_mnemonic
from typing import Optional
from  etherscan import Etherscan
from requests import get
from matplotlib import pyplot as plt
from datetime import datetime
import time
import os
import sys

MNEMONIC: str = generate_mnemonic(language="english", strength=128)
PASSPHRASE: Optional[str] = None  # "meherett"
bip44_hdwallet: BIP44HDWallet = BIP44HDWallet(cryptocurrency=EthereumMainnet)
bip44_hdwallet.from_mnemonic(
mnemonic=MNEMONIC, language="english", passphrase=PASSPHRASE
)

bip44_hdwallet.clean_derivation()
for address_index in range(2): # Mnemonic Quantity to generate 
    bip44_derivation: BIP44Derivation = BIP44Derivation(
        cryptocurrency=EthereumMainnet, account=0, change=False, address=address_index
    )
    bip44_hdwallet.from_path(path=bip44_derivation)
    bip44_hdwallet.clean_derivation()
    print(f"{bip44_hdwallet.mnemonic()}")

    os.system(f'echo {bip44_hdwallet.mnemonic()} >> /home/mnemonic.txt')

fj44dn avatar Jun 21 '23 21:06 fj44dn