issue with bip39.validateMnemonic()

6 replies 236 views
eric.altMember
Posts: 43 · Reputation: 230
#1May 14, 2019, 12:35 AM
I verified the words and the structure of the recoverySeed variable, but I'm still getting "ERROR: Invalid recovery seed". What’s going on with my code?
8 Reply Quote Share
coin_sigmaLegendary
Posts: 1275 · Reputation: 5553
#2May 14, 2019, 05:08 AM
What software exactly you are using to generate seed? Are you developing something? I can't figure it out where did you get that error "invalid recovery seed". It looks like you are developing something that generates a seed phrase?
1 Reply Quote Share
stack_2017Senior Member
Posts: 201 · Reputation: 1389
#3May 14, 2019, 05:53 AM
The words might be part of the wordlist, but this does not automatically make it a valid seedphrase. Just by looking "seed seek shine"... "suit summer strong" etc.. it feels as if you scrolled down the wordlist, and then selected the words randomly. You can use the same library you're using now to generate a valid seedphrase as written here: https://github.com/bitcoinjs/bip39
3 Reply Quote Share
pixel2014Hero Member
Posts: 857 · Reputation: 4132
#4May 15, 2019, 09:59 PM
It is very wrong to let people know your seed phrase for the people not to be able to compromise your wallet. But it is fine if you know this already. Your seed phrase is your money. If stolen, your coins on the addresses the keys of the seed phrase generated will all be stolen. You are right. I inputted both on iancoleman and they are both invalid. Also I join both together to make it 24 words seed phrase and still invalid. Roskapostit should let us know how he generated the seed phrase just as BitMaxz posted.
4 Reply Quote Share
eric.altMember
Posts: 43 · Reputation: 230
#5May 16, 2019, 03:14 PM
Thanks. This indeed was the problem. The last word is a checksum so this is why it didn't work.
1 Reply Quote Share
paul2017Senior Member
Posts: 218 · Reputation: 1426
#6May 16, 2019, 07:54 PM
FTFY Sorry for being pedantic.
0 Reply Quote Share
sam2019Full Member
Posts: 54 · Reputation: 342
#7May 18, 2019, 08:21 AM
You didn't check closely the format actually, if you haven't calculated and added the checksum to the seed. It's a bit harder than randomly generating 24 words belonging to the 2048 words list in reality. You have to generate randomly a binary value with a length between 128 and 256 bits, multiple of 32. Then to hash it with SHA256 and take the first length/32 bits of this hash as the checksum you put at the end of your binary string. After that, you need to convert each 11 bits packets of this string into words from the indexed wordlist to get your final mnemonic seed. You can find the precise requirements here https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
3 Reply Quote Share

Related topics