Bitcoin Forum
November 27, 2026, 03:37:33 PM *
News: Latest Bitcoin Core release: 32.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bip39.validateMnemonic() problem  (Read 110 times)
roskapostit (OP)
Newbie
*
Offline

Activity: 8
Merit: 3


View Profile
December 11, 2024, 04:43:04 PM
Merited by OmegaStarScream (3)
 #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');
}
BitMaxz
Legendary
*
Offline

Activity: 4186
Merit: 3711


#kycfree ❎


View Profile WWW
December 11, 2024, 04:55:52 PM
 #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?

OmegaStarScream
Staff
Legendary
*
Offline

Activity: 4410
Merit: 7869



View Profile
December 11, 2024, 05:14:35 PM
Merited by pooya87 (2), ABCbits (2)
 #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

▄▄████████████████████▄▄
▄███████▀▀██████▀▀███████▄
█████▀██████████████▀█████
████████▄▄██████▄▄████▀███

██████████████████████████
██▄▄██████████████▄▄██████
██▀▀██████████████████▄▄██
██████▀▀██████████████▀▀██
██████████████████████████
███▄████▀▀██████▀▀████████
█████▄██████████████▄█████
▀███████▄▄██████▄▄███████▀
▀▀████████████████████▀▀
 
 DΞX.fo 
▄▄██████
█████████
██████████
██████████
██████████
█████████
▀▀██████

▄███████
▄██████████
████████████
█████████████
█████████████
|
▄▄█
▄████▀
▄███▀█▄
▄██▀█▄██
█████▀▀█
████████
████████
▀██▄████
▄████▄▄█
▄█████▀███
▄█████▀████▀
█████▀███████
▀██▀█████████
|..BTC......XMR...
..USDT.....LTC...
....Fees  0.8%.....
Charles-Tim
Legendary
*
Offline

Activity: 2478
Merit: 6625


Leading Crypto Sports Betting & Casino Platform


View Profile
December 11, 2024, 05: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.

██████████████████████████████████████████████████████████████
████████████
▀▀███████▀████████████████████████████████████████
██████████
▀██▄▄████▄██▐████▀▀███████████▀▀████████████████████
█████████
▌██▐██████▌██████▌█▐█████████████▐███████████████████
█████████
▌█████████▄▄▄██████▀▀▀▀███████▌█████▀████████████████
██████████
▄███▀███████▀▀██████▄██████████▐█▀█▄███▀▀███████████
████████████
▄▄███▀▀██▄▄▄▄██▐███▀██▄█▐█▌██▀█▄██▀██▄▄███████████
████████████████
▄▄███▀██▌███████▄█▌███████▐██▌███▀█▄██████████
██████████
▀███▄███████████▐██▌█▐████████▐██▐████▄██▀██████████
█████████
▌██▄███████████▄████▄████▄██▄██████▀▄█████▄▀█████████
█████████
▌██▀███▀▀███▄█████████████████████▄██▀▀▀▀▀█▄█████████
██████████
▄██████▄▄██████████████████████████▄▄▄▄▄▄███████████
██████████████████████████████████████████████████████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██

 🎰  🎲 ..Play Smarter.. 🏀  ⚽ ..Play Now..
roskapostit (OP)
Newbie
*
Offline

Activity: 8
Merit: 3


View Profile
December 11, 2024, 05: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.
odolvlobo
Legendary
*
Offline

Activity: 5152
Merit: 3849



View Profile
December 11, 2024, 07:42:19 PM
Merited by Cricktor (1)
 #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.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
Saint-loup
Legendary
*
Offline

Activity: 3318
Merit: 2523



View Profile
December 14, 2024, 10:51:57 AM
Merited by Cricktor (1)
 #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


▄▄████████████████████▄▄
▄████████████████████████▄
██████████████████████████
██████████████████████████
███▄▄▀▀▀▄▀▀▄█▄▀▀▀▄█▄▀▀▄▄██
████████████▐▌████▐▌██████
███▀███████▀▀████▀▀███████
███▐▌█████████████████████
████▀▄▄██▄▄▄▄███▄▄▄███████
██████▀▀▀█▀▀▀▀█▀▀▀▀▀██████
██████████████████████████

▀████████████████████████▀
▀▀████████████████████▀▀

..1win..
█████████████████████████
█████████████████████████
████████████▀░░░▀▀▀▀█████
█████████▀▀▀█▄░░░░░░░████
████▀▀░░░░░░░█▄░▄░░░▐████
████▌░░░░▄░░░▐████░░▐████
█████░░░▄██▄░░██▀░░░█████
█████▌░░▀██▀░░▐▌░░░▐█████
██████░░░░▀░░░░█░░░▐█████
██████▌░░░░░░░░▐█▄▄██████
███████▄░░▄▄▄████████████
█████████████████████████
█████████████████████████

..POKER..
█████████████████████████
█████████████████████████
███████████▀▀▀███████████
███████▀▀░░▄▄▄░░▀▀███████
██████▄░░░░███░░░░▄██████
█████░▀▀█▄▄░░░▄▄█▀▀░█████
█████░██░░▀▀█▀▀░░██░█████
█████░░░░░░░█░██░▄▄░█████
█████▄░░░▄▄░█░▄▄░▀▀▄█████
███████▄▄▀▀░█░▀▀▄▄███████
███████████▄█▄███████████
█████████████████████████
█████████████████████████

..GAMES..
█████████████████████████
█████████████████████████
████████▀▀░░░░░▀▀████████
██████░░▄██▄░▄██▄░░██████
█████░░████▀░▀████░░█████
████░░░░▀▀░░░░░▀▀░░░░████
████░░▄██░░░░░░░██▄░░████
████░░████░░░░░████░░████
█████░░▀▀░▄███▄░▀▀░░█████
██████░░░░▀███▀░░░░██████
████████▄▄░░░░░▄▄████████
█████████████████████████
█████████████████████████
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!