0

I have question

Is it possible to get address and private key from mnemonic code??

For example) I created address (0x12345) and I receive mnemonic code such as apple bed bad rice

If i know mnemonic code (apple bed bad rice), Can i get 0x12345 address ??

0

yes this is possible via ethers.js. Run the following piece of code in nodejs environment:

const ethers = require('ethers');

async function init() {
    //creating new random mnemonic
    //const mnemonic = await ethers.utils.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16));
    const mnemonic = 'YOUR_MNEMONIC_WORDS';

    //mnemonic to private, public key and address
    const wallet = ethers.Wallet.fromMnemonic(mnemonic);
}
init();

If you need this logic on website you will have to use browserify, because browsers don't have the require method defined.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.