Serverside – How to Generate Ethereum Wallets & Keys on Serverside with JS

nodesserver-side

Anybody knows, how can ether wallets be generated on serverside (node.js). It's needed for service, to create a new wallets for new customers. Maybe something like bitcoinJS-lib but for ethereum? But can't find with my own, please help 🙂

Best Answer

Using web3js library, here is how you do it on nodejs serverside

//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)
})

...

There you go.