cosmos-keys
cosmos-keys copied to clipboard
getNewWalletFromSeed(): Entropy source not available
Hello, guys! Could you, please, help me with this problem:
I couldn't process getNewWalletFromSeed() method, just get error: Entropy source not available
.
OS: macOS Sierra 10.12.6 Node.js: 12.8.1
What does it mean? How to resolve this issue?
I enclose my code below:
const {
getNewWalletFromSeed,
} = require('@lunie/cosmos-keys');
const createWallet = async () => {
const mnemonic = "gentle mutual speak consider mandate kingdom cash explain soul exile cabin squeeze";
try {
const {
cosmosAddress,
privateKey,
publicKey
} = getNewWalletFromSeed(mnemonic);
} catch (error) {
console.log(error);
}
};
Thanks a lot in advance!
I can reproduce this. It happens even without calling createWallet
from the example. Here is the stacktrace:
Error: Entropy source not available.
at h (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:1186:208)
at u (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:1186:701)
at Object.t.randomBytes (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:1186:782)
at Function.randomBits (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:1140:38253)
at Function.random (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:1140:38861)
at SECP256K1.randomScalar (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:372:10093)
at l._getBlinding (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:372:14282)
at l.precompute (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:372:15393)
at SECP256K1.precompute (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:372:7986)
at e.exports.get curve [as curve] (/projects/lunie-test/node_modules/@lunie/cosmos-keys/lib/cosmos-keys.js:133:316)
I can offer to integrate the secp256k1 implementation from @cosmjs/crypto here, which is well tested in browser and node. It does not require randomness for signing. Please let me know if this is desired.
@sollerias have you solved it?
The library works in the browser only. Checkout @cosmjs/launchpad for a more versatile library.
@faboweb could you add this to readme, so that it's obvious at the first glance on repo?