3

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 Javascript versions, but nothing in Python

1
  • If this is being done with a significant amount of funds at stake (e.g. your life savings) be careful with what server you enter your mnemonic into. Ideally it should be a "airgapped computer that has no WiFi, Bluetooth, Ethernet or other networking capability" Commented May 31, 2023 at 9:44

1 Answer 1

2

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 and acknowledge you have read our privacy policy.

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