Author

Topic: bip39.validateMnemonic() problem (Read 103 times)

legendary
Activity: 2604
Merit: 2353
December 14, 2024, 05:51:57 AM
#7
Thanks. This indeed was the problem. The last word is a checksum so this is why it didn't work.
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

legendary
Activity: 4522
Merit: 3426
December 11, 2024, 02:42:19 PM
#6
Thanks. This indeed was the problem. The last word is includes a checksum so this is why it didn't work.

FTFY

Sorry for being pedantic.
newbie
Activity: 5
Merit: 3
December 11, 2024, 12:41:43 PM
#5
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

Thanks. This indeed was the problem. The last word is a checksum so this is why it didn't work.
legendary
Activity: 1512
Merit: 4795
Leading Crypto Sports Betting & Casino Platform
December 11, 2024, 12:18:08 PM
#4
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.

Just by looking, "seed seek shine"... "suit summer strong" etc.. it almost as if you scrolled down the worldlist, and then selected the words randomly.
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.
staff
Activity: 3500
Merit: 6152
December 11, 2024, 12:14:35 PM
#3
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
legendary
Activity: 3514
Merit: 3253
Happy New year 🤗
December 11, 2024, 11:55:52 AM
#2
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?
newbie
Activity: 5
Merit: 3
December 11, 2024, 11:43:04 AM
#1
I have checked the words and the format of the recoverySeed variable but still getting "ERROR: Invalid recovery seed".

So what a heck is wrong with my code ?

Code:
const bip39 = require('bip39');

const recoverySeed =
  "seed seek shine weapon short odor off organ orphan suit summer strong " +
  "tuition vendor exit excite mom radar silver stone swap three update trip";

if (bip39.validateMnemonic(recoverySeed)) {
  console.log('Recovery seed is OK');
} else {
  console.log('ERROR: Invalid recovery seed');
}
Jump to: