You should NEVER give your seed phrase or private key to anyone!!!
As a user of both Keplr and Leap wallets in the Cosmos Ecosystem, I’ve encountered a common issue when trying to interact with decentralized applications (dApps) that require custom derivation paths. While Keplr supports this feature out-of-the-box, Leap wallet users are left wondering how to import their seed phrase with custom derivation path.

In this article, we’ll explore the solution using Python’s hdwallet package. Before diving into the code, let’s briefly discuss the two approaches to importing wallets: seed phrases and private keys. While both methods work for Leap wallet, only the private key method can be used to import a wallet with a custom derivation path.
After conducting research on Stackoverflow and other platforms, I stumbled upon an example using the hdwallet package that inspired me to create my own solution. In this tutorial, we’ll walk through the step-by-step process of generating a private key from your seed phrase with custom derivation path using Python.
#!/usr/bin/env python3
from hdwallet import BIP44HDWallet
from hdwallet.cryptocurrencies import AtomMainnet
from hdwallet.derivations import BIP44Derivation
from typing import Optional
# Generated previously mnemonic phrase
MNEMONIC: str = 'here should be your twelve or twenty four length mnemonic seed phrase'
# Secret passphrase/password for mnemonic
PASSPHRASE: Optional[str] = None # "strong-passphrase-password" if you have any
# Initialize Atom mainnet BIP44HDWallet
bip44_hdwallet: BIP44HDWallet = BIP44HDWallet(cryptocurrency=AtomMainnet)
# Get Atom BIP44HDWallet from mnemonic
bip44_hdwallet.from_mnemonic(
mnemonic=MNEMONIC, language="english", passphrase=PASSPHRASE
)
# Clean default BIP44 derivation indexes/paths
bip44_hdwallet.clean_derivation()
print("Mnemonic:", bip44_hdwallet.mnemonic())
address_index = 100
# Example of changing account index "m/44'/-'/0'/0/100"
# Derivation from Atom BIP44 derivation path
bip44_derivation: BIP44Derivation = BIP44Derivation(
cryptocurrency=AtomMainnet, account=0, change=False, address=address_index
)
# Drive Atom BIP44HDWallet
bip44_hdwallet.from_path(path=bip44_derivation)
# Print address_index, path, address and private_key
print(f"({address_index}) {bip44_hdwallet.path()} {bip44_hdwallet.address()} 0x{bip44_hdwallet.private_key()}")
# Clean derivation indexes/paths
bip44_hdwallet.clean_derivation()
By following this guide you do it on your own risk. Keep your personal data safe.
Conclusion: By following this guide, you can now import your seed phrase with custom derivation path into Leap wallet and interact seamlessly with dApps that require this feature. Whether you’re a Keplr or Leap user, this solution will help you unlock the full potential of your Cosmos-based cryptocurrencies
Leave a Reply