<p>Long story short my 12 word seed phrase has a passphrase and I forgot the order.</p>
<p>So I did all the permutations of the 12 words to find the valid ones (29939407). So the script below is my way of adding the passphrase and then getting all the legacy addresses.</p>
<p>However, I'm not sure if it's my computer but so far the script I have has only written 3.5 million addresses and it has been running for 12 hours! So I was wondering if anyone could recommend any ways to speed up this script?</p>
<pre><code>from bip_utils import Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44Changes, Bip84, Bip84Coins, Bip44Changes, Bip44, Bip44Coins

mnemonics_filename = open ('sats.txt')
address_filename = open('sats-address.txt')

mnemonics = open(mnemonics_filename, 'r')
address = open(address_filename, 'w+')

for mnemonic in mnemonics:
    seed_bytes = Bip39SeedGenerator(mnemonic).Generate(&quot;satsenchanter&quot;)
    bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN)
    bip44_acc_ctx = bip44_mst_ctx.Purpose().Coin().Account(0)
    bip44_chg_ctx = bip44_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    for i in range(1):
        bip44_addr_ctx = bip44_chg_ctx.AddressIndex(i)
        b44.write(bip44_addr_ctx.PublicKey().ToAddress()+'\n')
</code></pre>

CC BY-SA 4.0
2023-08-17T14:24:45.073Z
Rewriting it in C (or other compiled language) would probably make a worthwhile difference.
RedGrittyBrick
CC BY-SA 4.0
2023-08-18T04:50:03.747Z
What is the information you have, if you compare the result form 12 word seed phrase permutation plus passphrase. With public key instead of address, I'll be faster.  And the most important thing is that Python can't utilize the full capacity of your CPU because it can't handle the Global Interpreter Lock (GIL). The script made from pure Python can only use 1 core, whereas another language like C or Rust can create a multiprocess script. Using those languages can increase the speed up to 10-30 times faster than Python.
Romo
CC BY-SA 4.0
2023-08-18T05:00:01.480Z
However, waiting for 12 hours is not too long when you consider it in contrast to learning a new language without any foundational knowledge.
Romo
<python><mnemonic-seed><bip44>
faster way to get bip44 address from mnemonic?
Dasher Love
# faster way to get bip44 address from mnemonic?

(Asked by: username_0 on 2023-08-17)

Long story short my 12 word seed phrase has a passphrase and I forgot the order.

So I did all the permutations of the 12 words to find the valid ones (29939407). So the script below is my way of adding the passphrase and then getting all the legacy addresses.

However, I'm not sure if it's my computer but so far the script I have has only written 3.5 million addresses and it has been running for 12 hours! So I was wondering if anyone could recommend any ways to speed up this script?

```
from bip_utils import Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44Changes, Bip84, Bip84Coins, Bip44Changes, Bip44, Bip44Coins

mnemonics_filename = open ('sats.txt')
address_filename = open('sats-address.txt')

mnemonics = open(mnemonics_filename, 'r')
address = open(address_filename, 'w+')

for mnemonic in mnemonics:
    seed_bytes = Bip39SeedGenerator(mnemonic).Generate("satsenchanter")
    bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN)
    bip44_acc_ctx = bip44_mst_ctx.Purpose().Coin().Account(0)
    bip44_chg_ctx = bip44_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
    for i in range(1):
        bip44_addr_ctx = bip44_chg_ctx.AddressIndex(i)
        b44.write(bip44_addr_ctx.PublicKey().ToAddress()+'\n')

```

**Tags:** python, mnemonic-seed, bip44

> **Comments:**
> **username_1**: Rewriting it in C (or other compiled language) would probably make a worthwhile difference.  
> **username_2**: What is the information you have, if you compare the result form 12 word seed phrase permutation plus passphrase. With public key instead of address, I'll be faster.  And the most important thing is that Python can't utilize the full capacity of your CPU because it can't handle the Global Interpreter Lock (GIL). The script made from pure Python can only use 1 core, whereas another language like C or Rust can create a multiprocess script. Using those languages can increase the speed up to 10-30 times faster than Python.  
> **username_2**: However, waiting for 12 hours is not too long when you consider it in contrast to learning a new language without any foundational knowledge.  

---

## 0 answers

