How to generate Ethereum wallet with ethers.js


With the ethers.js library, you can generate Ethereum wallet by writing the code below:

Code (Node.js)

const ethers = require('ethers')
const wallet = ethers.Wallet.createRandom()
console.log('address:', wallet.address)
console.log('mnemonic:', wallet.mnemonic.phrase)
console.log('privateKey:', wallet.privateKey)


address: 0xb985d345c4bb8121cE2d18583b2a28e98D56d04b
mnemonic: produce alley citizen bone enact settle hedgehog common plate dwarf lady someone
privateKey: 0x49723865a8ab41e5e8081839e33dff15ab6b0125ba3acc82c25df64e8a8668f5


If you find this article is helpful, it would be greatly appreciated if you could tip Ether to the address below. Thank you!