cosmos-keys icon indicating copy to clipboard operation
cosmos-keys copied to clipboard

getNewWalletFromSeed(): Entropy source not available

Open sollerias opened this issue 4 years ago • 4 comments

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!

sollerias avatar Jul 07 '20 09:07 sollerias

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.

webmaster128 avatar Jul 08 '20 20:07 webmaster128

@sollerias have you solved it?

gelinger777 avatar Dec 19 '20 11:12 gelinger777

The library works in the browser only. Checkout @cosmjs/launchpad for a more versatile library.

faboweb avatar Dec 20 '20 14:12 faboweb

@faboweb could you add this to readme, so that it's obvious at the first glance on repo?

YakovL avatar Feb 14 '22 17:02 YakovL