Uncaught Error: KeyStore: Invalid mnemonic
See original GitHub issueUpgrading from eth-lightwallet 2.5.4 to 3.0.x I am having the issue that I am unable to catch the error whenever a wrong mnemonic is passed to lightwallet.keystore.createVault.
Example:
lightwallet.keystore.createVault({
password: password,
seedPhrase: seed, // Optionally provide a 12-word seed phrase
hdPathString: "m/44'/60'/0'/0" // Optional custom HD Path String
}, (err, ks) => {
// Any code here is NEVER executed when the mnemonic is invalid
if (err) throw new Error("Wrong password"); // Not triggered on invalid mnemonic
console.log('test'); // Not triggered on invalid mnemonic
});
In this example, whenever the password is wrong, the callback does not retrieve an error keystore. It just displays an uncaught error in the console of the browser. I also tried placing a try - catch around it, but it still does not work.
This is the error shown in the browser:
Uncaught Error: KeyStore: Invalid mnemonic
at KeyStore.init (keystore.js:75)
at keystore.js:114
at cb (keystore.js:352)
at scrypt-async.js:518
at scrypt-async.js:481
at run (setImmediate.js:40)
at runIfPresent (setImmediate.js:69)
at onGlobalMessage (setImmediate.js:109)
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Cannot Import Wallet "Invalid mnemonic phrase" Error
When you encounter an “Invalid menemonic phrase” Error, you need to check the following: The words are separated by a single space. The...
Read more >Error “invalid”or “incorrect length” when importing mnemonic
Error “invalid mnemonic” This happens because some of the words in your mnemonic aren't in the BIP39 wordlist. You should find out the...
Read more >How to Avoid Invalid Mnemonic Phrase Error While Importing ...
The process of entering mnemonic phrase is sensitive and should be carried out carefully as it pertains the recovery of an existing wallet....
Read more >Ethers.js - missing signer
log(err); });. Is there anything I'm doing wrong with the account address or password(contract address)?. What might the mistake be? Any ideas ...
Read more >Prysm - Frequently asked questions
If your beacon node or validator logs display an ERROR , go to our open ... A fatal crash is quite serious and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @DalderupMaurice , this is due to the fact that init function throws error if invalid mnemonic appears. But that error is not caught by it’s calling function viz.
createVault
function. I have created a pull request for this (https://github.com/ConsenSys/eth-lightwallet/pull/193).For now, you can import “bitcore-mnemonic” library and prior to calling
createVault
, you can check if your mnemonic is correct usingisValid
function of this library.@360disrupt Not any 12 random words make a correct mnemonic (not at least for Ethereum and Bitcoin chains). You can view the wordlist here. Again, you cannot arrange these words randomly yourself to make a valid mnemonic. This has steps to create one. You can visit https://iancoleman.io/bip39/ to generate mnemonic for yourself. Or include this in your codebase to create wallets. Here you can see that eth-lightwallet uses it as well 😉