From having a list of bip39 seeds, is there any way of recovering a wallet? In particular, I have a list of ~100 seeds--one of which is mine--and need an automate way of figuring out which is valid and has my funds. Thanks

1 Answer 1


There are a few things to consider here.

First, do you know the path of the HD wallet? You can find out what type of path structure your wallet is using, and if the address with the unspent transactions was the very first one, then it would be account 0, for example.

See this on BIP44 paths...

If you know the path structure, and you know the exact address you are looking for at a given path, then you could do something like this using bitcoinjs-lib:

const bip39 = require("bip39")
const bitcoin = require("bitcoinjs-lib")

const network = bitcoin.networks.bitcoin

for (const phrase of phrases) {
    const seed = await bip39.mnemonicToSeed(phrase)
    const root = bitcoin.bip32.fromSeed(seed, network)
    const path = "m/44'/0'/0'/0"
    const child = root.derivePath(path)
    const { address } = bitcoin.payments.p2sh({
        redeem: bitcoin.payments.p2wpkh({
            pubkey: child.publicKey,

    if (address === '3...') {
        //this is yours

Note that this example is for P2WPKH wrapped addresses (3 prefix). You would need to change this a bit depending on the type of address you are trying to match.

  • 1
    Hi Michael, unfortunately I do not have the path of the HD wallet. I have a list of seeds (and thus can derive the master public key) and was thinking of scanning the blockchain (blockchain.com) using the master public key to see the funds in the wallet. I do know how many bitcoins I have in that account. Do you have any other suggestions on how to do this without the path? I can always derive addresses but that will take very long.
    – Sameer Lal
    Dec 11, 2019 at 23:14
  • @SameerLal indeed! You can obtain the xpubs from the list of seeds you have by looping through them as I have shown above, and then check on blockchain.com/btc/xpub/<xpub_address> to see if you've found your match. Dec 11, 2019 at 23:58
  • thank you! This works well. Sorry for so many questions, but do you happen to know of a python module or any code that'll allow me to derive the xpub address from bip39 seed without having to do any heavy lifting? just trying to save time.
    – Sameer Lal
    Dec 13, 2019 at 0:45
  • Sure no problem. Is python your preference? The snippet I posted above uses bitcoinjs-lib which is pretty well maintained and easy to use, but if node/JavaScript isn’t your thing I can help you achieve this with a python library as well. Dec 13, 2019 at 0:54
  • Yeah I'd prefer python because I already have a (fairly long) script I wrote in python for other parts. If you do not know of any other alternatives, no worries, I can spend some time trying to pythonify the code you wrote.
    – Sameer Lal
    Dec 13, 2019 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.