Consensys / Consensys/eth-lightwallet

('KeyStore.generateNewAddress: No seed set') when seed is set according to debug

Open
#96 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.5k
Forks
513
PR merge metrics
No merged PRs in 30d

Description

```
Hi, I am using eth-lightwallet on a NodeJS server. I am getting a stack trace when I try and get the private key from the keystore. It is flagging this line "keystore.generateNewAddress(pwDerivedKey);" I cannot see how it is related. When I comment out the line "account.prv_key = keystore.exportPrivateKey(sendingAddr, pwDerivedKey);" it appears to work flawlessly. Am I doing something wrong? I am new to Node and suspect it has something to do with the asynchronous nature of Node. I have included the code and the stacktrace below. Thank you

lightwallet.keystore.deriveKeyFromPassword('mypassword',
function (err, pwDerivedKey) {
var seed = lightwallet.keystore.generateRandomSeed();
var keystore = new lightwallet.keystore(seed, pwDerivedKey);

keystore.generateNewAddress(pwDerivedKey);
account.address = keystore.getAddresses()[0];
account.prv_key = keystore.exportPrivateKey(sendingAddr, pwDerivedKey);
})

/Users/username/WebstormProjects/eth-project/nodejs-server/node_modules/eth-lightwallet/lib/keystore.js:389
throw new Error('KeyStore.generateNewAddress: No seed set');
^

Error: KeyStore.generateNewAddress: No seed set
at KeyStore.generateNewAddress (/Users/username/WebstormProjects/eth-project/nodejs-server/node_modules/eth-lightwallet/lib/keystore.js:389:11)
at /Users/username/WebstormProjects/eth-project/nodejs-server/controllers/ActorService.js:39:20
at cb (/Users/username/WebstormProjects/eth-project/nodejs-server/node_modules/eth-lightwallet/lib/keystore.js:459:7)
at /Users/username/WebstormProjects/eth-project/nodejs-server/node_modules/eth-lightwallet/node_modules/scrypt-async/scrypt-async.js:474:9
at Immediate._onImmediate (/Users/username/WebstormProjects/eth-project/nodejs-server/node_modules/eth-lightwallet/node_modules/scrypt-async/scrypt-async.js:433:11)
at processImmediate [as _immediateCallback] (timers.js:383:17)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lib/keystore.js:389 and the call at ActorService.js:39, then reproduce the provided deriveKeyFromPassword and address-generation sequence. Compare the keystore state at those calls; done means identifying why the seed is unavailable and documenting or correcting a reproducible path for generating an address and exporting its private key.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.