Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use the mnemonic generated before or I have a new one each time when creating wallet? #21

Closed
zydjohnHotmail opened this issue Dec 2, 2022 · 5 comments

Comments

@zydjohnHotmail
Copy link

Expected behavior

Actual behavior

Steps to reproduce the behavior

  1. [First step]
  2. [Second step]
  3. [and so on...]

Logs

Environment

npm version: 9.1.3
multichain-crypto-wallet npm verion: 0.2.7
node.js version 19.1.0
OS: Windows 10 PRO

Hello:
I have the following node JS code to generate mnemonic:
const wallet = require('multichain-crypto-wallet');

const mnemonic = wallet.generateMnemonic();
console.log(mnemonic);

It worked, and I can save it in somewhere, and trying to use it later.
However, I wrote another node JS code to generate an ethereum wallet, like the following:
const multichainWallet = require('multichain-crypto-wallet');

const eth_wallet = multichainWallet.createWallet
({
derivationPath: "m/44'/60'/0'/0/0",
network: 'ethereum',
});

const json_wallet = JSON.stringify(eth_wallet);
console.log(json_wallet);

When I run my code, I can see something like this:
D:\nodejs\MultiChainCrypto>node Create_ETH_Wallet.js
bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
{"address":"0xbC…...972","privateKey":"0x…...62","mnemonic":"another_12_word_mnemonic"}

The mnemonic generated by the ethereum wallet node code is totally different from the code to generate a mnemonic by wallet.generateMnemonic();
Here, I am a little confused, which one I should use? Or how to use them?
By the way, the current version 0.2.7 seems have issue for bigint when running on Node.js version 19.1.0; anyone can fix this?
Version 0.2.7 has a lot of deprecated packages, can most of them be upgraded to the latest version?
Please advise,
Thanks,

@iamnotstatic
Copy link
Owner

Expected behavior

Actual behavior

Steps to reproduce the behavior

  1. [First step]
  2. [Second step]
  3. [and so on...]

Logs

Environment

npm version: 9.1.3 multichain-crypto-wallet npm verion: 0.2.7 node.js version 19.1.0 OS: Windows 10 PRO

Hello: I have the following node JS code to generate mnemonic: const wallet = require('multichain-crypto-wallet');

const mnemonic = wallet.generateMnemonic(); console.log(mnemonic);

It worked, and I can save it in somewhere, and trying to use it later. However, I wrote another node JS code to generate an ethereum wallet, like the following: const multichainWallet = require('multichain-crypto-wallet');

const eth_wallet = multichainWallet.createWallet ({ derivationPath: "m/44'/60'/0'/0/0", network: 'ethereum', });

const json_wallet = JSON.stringify(eth_wallet); console.log(json_wallet);

When I run my code, I can see something like this: D:\nodejs\MultiChainCrypto>node Create_ETH_Wallet.js bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?) {"address":"0xbC…...972","privateKey":"0x…...62","mnemonic":"another_12_word_mnemonic"}

The mnemonic generated by the ethereum wallet node code is totally different from the code to generate a mnemonic by wallet.generateMnemonic(); Here, I am a little confused, which one I should use? Or how to use them? By the way, the current version 0.2.7 seems have issue for bigint when running on Node.js version 19.1.0; anyone can fix this? Version 0.2.7 has a lot of deprecated packages, can most of them be upgraded to the latest version? Please advise, Thanks,

Hi @zydjohnHotmail ,

Yeah, anytime you call the function generateMnemonic it will always return a random mnemonic phrase that's how it is meant to work.

You can use any of the functions, it depends on how you plan to use it. if you just want to generate a random mnemonic, then you can use the generateMnemonic But if you want to create a specific wallet, you can use the createWallet mind you, you can also use the generateWalletFromMnemonic to create a wallet using already generated mnemonic.

Okay, will look into the deprecated packages and see if can update them.

@zydjohnHotmail
Copy link
Author

Hello:
Thanks for your reply. Please update the package, and if possible, please fix the bigint failed to load binding issue, and pubish a new NPM version.
So I can do more testing later.
Thanks,

@iamnotstatic
Copy link
Owner

Hello: Thanks for your reply. Please update the package, and if possible, please fix the bigint failed to load binding issue, and pubish a new NPM version. So I can do more testing later. Thanks,

Yeah, I will look into it.

@zydjohnHotmail
Copy link
Author

Hello:
I found you closed this issue, and it seems you have already updated the NPM package, but let me know when I can install a new version, as the currenent version 0.2.7 has so many deprecated packages, to install and use in Windows 10 seems not so good.
Thanks,

@iamnotstatic
Copy link
Owner

Yeah, Because the initial concern has been attended to. Yeah, will let you know also you will see a release note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants