I have implemented the code which is creating new wallet but I am not able to get the private key of that wallet. Can anyone tell me like what is the proper way in which I can create new wallet which can provide me the private key as well using node.

my code:-

web3.personal.newAccount(name, function (err, res) {
        if (err) {
        } else {
            next(null , res);
//generate private key    
privateKey = web3.eth.accounts.create().privateKey.substr(2)

//generates pubKey from privateKey, encrypts it and store in keystore folder.
web3.eth.personal.importRawKey(privateKey, pin)
    .then((result) => {

    //store pub address.
    publicAddr = web3.utils.toChecksumAddress(result)

Sort of a similar question was also posted here: How to generate Ethereum wallets & keys on serverside with JS?

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.