25th word missing :-(

There is error in the recovery code above… try this one…

# recover.py
# written by danger_dave
# updated by Ludovit Scholtz
#
# This code searches for one missing word in 25 mnemonic algorand phrase with known address

from algosdk import mnemonic
from algosdk import wordlist

# Write in Public Key here
address = "JU73IC5WZRS2AF4LN6WBAY5ZFDWMNNRXU6O5VIPZIFRLLT53VHDOBYP3HQ"

# 24 words go here (single space seperated)
confirmed = "youth journey spot increase action robust teach rubber direct world turn blouse camp hundred vessel pottery ozone brain hard risk quiz window abstract include"

word_list = wordlist.word_list_raw().split("\n")

wordscheck = confirmed.split(" ")
check = True
for word in wordscheck:
    if word in word_list:
        print(word+" is ok")
    else:
        print(word+" IS WRONG")
        check = False

if not check:
    print("!!!!!Some words are wrong .. try to find error in the allowed words: https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt")
    raise
        
curr = 0
first_part = ""
second_part = confirmed
for location in range(25):
    print(location)
    if location != 0:
        curr = confirmed.index(" ", curr + 1)
        first_part = confirmed[:curr]
        second_part = confirmed[curr:]
    for word in word_list:
        test_phrase = first_part + " " + word +" "+ second_part
        try:
            test_address = mnemonic.to_public_key(test_phrase)
        except:
            continue
        if test_address == address:
            print(test_phrase)
            raise

add your address to the address variable and word list in the word list as shown above

i have updated the original line test_phrase = first_part + " " + word +" "+ second_part

note that this solution requires only one library to work with, so you should run

pip install py-algorand-sdk

to install it

I have also updated it to validate the bips words, so that it does not attempt to brute force when we know some of the words are wrong

1 Like