Skip to content

Instantly share code, notes, and snippets.

@poussieren
Created Aug 6, 2022
Embed
What would you like to do?
"""
Name: hdwallet
Version: 2.1.1
Home-page: https://github.com/meherett/python-hdwallet
"""
import hdwallet
from hdwallet import BIP32HDWallet
from hdwallet.cryptocurrencies import EthereumMainnet
from hdwallet.derivations import Derivation
assert hdwallet.__version__ == 'v2.1.1'
MNEMONIC = "xx"
PASSPHRASE = "yy"
def get_address():
bip44_hdwallet = BIP32HDWallet(cryptocurrency=EthereumMainnet)
bip44_hdwallet.from_mnemonic(
mnemonic=MNEMONIC, language="english", passphrase=PASSPHRASE
)
for i in range(10):
# bip44_derivation = Derivation.from_path("m/44'/60'/0'/%s" % i) # ledger old
bip44_derivation = Derivation.from_path("m/44'/60'/%s'/0/0" % i) # ledger live
bip44_hdwallet.clean_derivation()
bip44_hdwallet.from_path(path=bip44_derivation)
# print(f"(0) {bip44_hdwallet.path()} {bip44_hdwallet.address()} 0x{bip44_hdwallet.private_key()}")
address = bip44_hdwallet.address()
print(i, address)
get_address()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment