1

Is it possible to recover my wallet (BEP39 with 24 Words and a passphrase) without having the public key?

The problem is that I'm not sure about my passphrase and I need to test around 50 combinations, because I can't read my letters clearly.

I tried to recover around five times but had a wrong passphrase each time. I create a new wallet and I need to do the process over and over.

Is it maybe possible to make a Python script, so that it attempts to recover over and over with various passphrases, and outputs the passphrase that produces the wallet with the balance?

I tried with btcrecover, but they need a public key to check the passphrase and Electrum doesn't accept my 24-word seed (don't know why)

This is my Python attempt on Linux with Electrum

~/electrum# **/root/.local/bin/electrum restore 'word1 ... word24' --offline  --passphrase password_list.txt -v**
  0.43 | I | simple_config.SimpleConfig | electrum directory /root/.electrum
  0.43 | I | logging | Electrum version: 4.5.5 - https://electrum.org - https://github.com/spesmilo/electrum
  0.44 | I | logging | Python version: 3.8.10 (default, Nov 22 2023, 10:22:35) 
[GCC 9.4.0]. On platform: Linux-5.4.0-166-generic-x86_64-with-glibc2.29
  0.44 | I | logging | Logging to file: None
  0.44 | I | logging | Log filters: verbosity '*', verbosity_shortcuts ''
  0.44 | I | storage.WalletStorage | wallet path /root/.electrum/wallets/default_wallet
  0.44 | I | p/plugin.Plugins | registering hardware coldcard: ('hardware', 'coldcard', 'Coldcard Wallet')
  0.44 | I | p/plugin.Plugins | registering hardware digitalbitbox: ('hardware', 'digitalbitbox', 'Digital Bitbox wallet')
  0.44 | I | p/plugin.Plugins | registering hardware jade: ('hardware', 'jade', 'Jade wallet')
  0.44 | I | p/plugin.Plugins | registering hardware keepkey: ('hardware', 'keepkey', 'KeepKey wallet')
  0.44 | I | p/plugin.Plugins | registering hardware ledger: ('hardware', 'ledger', 'Ledger wallet')
  0.44 | I | p/plugin.Plugins | registering hardware safe_t: ('hardware', 'safe_t', 'Safe-T mini wallet')
  0.44 | I | p/plugin.Plugins | registering hardware trezor: ('hardware', 'trezor', 'Trezor wallet')
  0.44 | I | p/plugin.Plugins | registering wallet type ('2fa', 'trustedcoin')
  0.44 | D | util.profiler | Plugins.__init__ 0.0039 sec
  0.44 | I | storage.WalletStorage | wallet path /root/.electrum/wallets/default_wallet
  0.44 | D | util.profiler | WalletDB.load_transactions 0.0002 sec
  0.45 | I | p/plugin.Plugins | stopped

Seed or key not recognized
4
  • Hey Christian, I think you are missing some words, could you perhaps give your question post another read?
    – Murch
    Commented Jun 26 at 13:21
  • if i restore the wallet, the 24 words are working correct. So the words must be correct, is it?
    – Christian
    Commented Jun 28 at 10:57
  • Sorry, I meant that there are some sentences in your question that appear to be incomplete, and I was suggesting that you proofread especially the sentence with the bold text.
    – Murch
    Commented Jun 28 at 14:31
  • Thanks and sorry! "I tried with btcrecover, but they need a public key to check the passphrase and electrum doesnt accept my 24 words seed (dont know why)"
    – Christian
    Commented Jun 28 at 19:29

2 Answers 2

1

Since you don't have a public key, you need to use a different strategy: you need to query the blockchain to see if there are any transactions for each possible address.

The following bash script tests different bip39 english words as the 25th word for a given mnemonic:

  • extracts the private key from the mnemonic + passphrase
  • generates public key for derivation paths 44, 49 and 84:
    • generate address for locking scripts p2pkh, p2wpkh, p2shwpkh and p2tr:
      • queries blockchain for address transaction count
      • If transaction count greater than 0, a big green blob of text will be displayed with all the information needed and the script will exit

For each passphrase, a total of 12 addresses will be queried.

Requires:

Script code:

#!/bin/bash

# given a mnemonic, try different bip39 english words as passphrase

# requires hal (https://github.com/stevenroose/hal)
# requires jq (https://jqlang.github.io/jq/)

# font colors
GREEN='\033[0;32m'
NC='\033[0m' # No Color

# put your mnemonic here
mnemonic="embrace traffic prepare fatigue burger hood shed comic royal whisper sibling suspect silver spoon erupt edge top squirrel ancient seek start noble window autumn"

# all 2048 bip39 english words
dictionary=`curl -s https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt`
# or try with just a few: uncomment next line
# dictionary="prepare bacon burger"

for passphrase in $dictionary
do
  echo "Testing passphrase: $passphrase"
  xpriv=`hal bip39 get-seed --passphrase $passphrase "$mnemonic" | jq -r .seed.bip32_xpriv`
  for d in 44 49 84 # derivation paths
  do
    echo
    derivationPath="m/$d'/0'/0'/0/0"
    echo -e "  $derivationPath"
    for lock in p2pkh p2wpkh p2shwpkh p2tr # locking scripts
    do
      echo -e "    $lock"
      address=`hal bip32 derive "$xpriv" "$derivationPath" | jq -r .addresses.$lock`
      txcount=`curl -sSL "https://mempool.space/api/address/$address" | jq .chain_stats.tx_count`
      echo -e "      $address = $txcount"
      if [[ $txcount -gt 0 ]]
      then
        echo -e "${GREEN}"
        echo -e "FOUND!"
        echo -e "mnemonic: $mnemonic"
        echo -e "passphrase: $passphrase"
        echo -e "derivation path: $derivationPath"
        echo -e "locking script: $lock"
        echo -e "address: $address"
        echo -e "tx count: $txcount"
        echo -e "${NC}"
        exit
      fi
    done
  done
done

Save the code to a file called main.sh, chmod +x main.sh and then run ./main.sh

8
  • Thanks for your help! With my 24 words i was able to create the 12 addresses and no one has a transaction. So how can i found out the public key without the passphrase? :/
    – Christian
    Commented Jun 28 at 10:57
  • And where can i add the passphrase at your bash here? Thanks a lot!
    – Christian
    Commented Jun 28 at 11:01
  • Save the code to a file called main.sh and then run: ``` ./main.sh "embrace traffic prepare fatigue burger hood shed comic royal whisper sibling suspect silver spoon erupt edge top squirrel ancient seek start noble window autumn" "other mnemonic..." ```
    – bordalix
    Commented Jun 28 at 14:27
  • @Christian It seems markdown is not allowed on comments, so I updated the original answer.
    – bordalix
    Commented Jun 28 at 14:30
  • Thanks a lot! So where can i add my 25 word (the passphrase) there? Also i dont have other mnemonic. I have that 24 words and i'm missing the passphrase. So do i need to brutforce all possibilities of the 25 word? Should crazy.
    – Christian
    Commented Jun 28 at 19:33
0

Is it possible ...

It is possible to recover a wallet using only the seed phrase and passphrase (if one was used). That is what they are designed for.

...without having the public key?

You only need a public key or address if you don't have the whole seed phrase and pass phrase. They are used to check if a guess was correct.

BEP39 (sic)

Electrum generally doesn't use BIP-39. You need to make sure whatever recovery tools you are using are configured for Electrum and probably configured for the specific choices of configuration you made for Electrum when it (or other software) generated that phrase.

electrum [doesn't like] my seed

The message "seed or key not recognized" means your 'word1 ... word24' doesn't look like a seed phrase to Electrum. I have not checked but I suspect the apostrophes/single-quotes are not needed and the phrase should be placed after all other options.

usage: electrum restore [-h] [-v] [-D ELECTRUM_PATH] [-P] [-w WALLET_PATH]
                   [-o]
                   text

Source: some random 2017 webpage - may be outdated. Try electrum help restore with your version. caveat emptor

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.