Hi,
when i remove the 7th word from the mnemonic above it finds it correctly…
# recover.py
# written by danger_dave
# updated by Ludovit Scholtz
# Works with py-algorand-sdk:2.0.0 & python 3.10+
#
# This code searches for one missing word in 25 mnemonic algorand phrase with known address
from algosdk import mnemonic
from algosdk import account
from algosdk import wordlist
# Write in Public Key here
address = "JU73IC5WZRS2AF4LN6WBAY5ZFDWMNNRXU6O5VIPZIFRLLT53VHDOBYP3HQ"
# 24 words go here (single space seperated)
confirmed = "loyal youth journey spot increase action 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")
exit()
found=0
curr = 0
first_part = ""
second_part = confirmed
for location in range(25):
print(location)
if location != 0:
if location == 24:
first_part = confirmed
second_part = ""
else:
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
#print(test_phrase)
try:
private_key = mnemonic.to_private_key(test_phrase)
test_address = account.address_from_private_key(private_key)
print(test_address)
print(test_phrase)
found=found+1
except Exception as e:
#print('Exception: '+ e)
continue
if test_address == address:
print("Found match for specific address >>>>>>>>>>> "+address)
print(test_phrase)
exit()
if found == 0:
print("Mnemonic not found")
In your code you have extra ``` at the end of the file
just store it to any folder and run the python
python.exe recovery.py
i am using windows with python 3.11.5, but it should work with any