Is there any Python package which will allow me to verify if the checksum of a bip39 mnemonic is valid? For instance, I have a 24-word bip39 mnemonic, and I might have made a mistake for one of the words. I want to see which words will result in a valid checksum.

I've seen javscript versions, but nothing in Python


Clone/download this code from Trezor (don't forget the word list).

Then check your word-list like this:

from mnemonic import Mnemonic

code = "word1 word2 [...] word23 word24"
mnemo = Mnemonic("english")
isValid = mnemo.check(code) # returns a boolean
print('Checksum is valid: ' + str(isValid))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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