Could there be repeated words in a mnemonic phrase?

Do mnemonic phrases allow words duplication? For example, is this a valid mnemonic phrase:

"sorry sorry sorry sorry sorry sorry sorry sorry sorry sorry sorry sorry"

?

If I try to create a wallet from this mnemonic, Rust SDK throws an error:

SecretKey::new_from_mnemonic_phrase_with_path(&phrase, &path);

However, TS SDK passes this mnemonic and generates a wallet:

Wallet.fromMnemonic(phrase)
1 Like

I would guess yes it’s possible, but not all combination of words are ‘valid’ from my understanding

1 Like

Yes it should be possible. The issue likely stems from the coins-bip39 crate used in fuel-crypto, where repeating a word in the phrase causes that issue.

Are you just asking out of curiosity, or is this issue causing a blocker for you?

I’m asking because we’re using both TS and Rust SDKs on different platforms in Fuelet. And we’ve encountered different behavior when importing seed phrases like the one in the example (12x “sorry”) or invalid mnemonics like “a b c…”: TS SDK allows them to pass, while Rust - not.

I think that Rust SDK works correctly, while TS SDK lacks some validation of the mnemonics.

We’ve added the validation on our side before passing the phrase to SDKs, this should solve the problem for us. But I think it’s a good potential problem you should be aware of

1 Like

I have spoken with the SDK teams, and they have confirmed that you are right. I will update this thread as soon as there are more internal updates. Thank you for reporting this. :saluting_face:

1 Like