Generating and using a HD Wallet

This tutorial covers the generation, use and management of a HD Wallet using aepp-sdk.


Do not know what HD Wallets are? You can read about it here.

Importing the HD Wallet class

from aeternity.hdwallet import HDWallet

Generating a Mnemonic

The HdWallet class exposes a static method to generate a BIP39 compatible mnemonic seed phrase.

# Generating a mnemonic
mnemonic = HDWallet.generate_mnemonic()

Generating a HD Wallet

You can instantiate a HDWallet instance by using the HDWallet class. The constructor accepts a mnemonic seed phrase and if no seed phrase is provided then one is auto generated.

# Initializing the HDWallet
# (if mnemonic is not provided, a one will be autogenerated during initialization)
hdwallet = HDWallet(mnemonic)

Deriving a child private key

Once the HD wallet is instantiated, you can access the provided class method to derive child private/secret keys.

# Derive child accounts
# if you want to derive a child key with an specific account and/or address index
# then you can pass them to the method
# By default, every time you generate a child key, the account index is auto generated
key_path, account = hdwallet.derive_child()