Created
March 10, 2022 02:11
-
-
Save duanescarlett/07bfc4404a68f1e9496650ad89e40bb2 to your computer and use it in GitHub Desktop.
Create a new wallet with Ethers JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ethers = require('ethers') | |
require('dotenv').config() | |
const main = async () => { | |
// Create a wallet | |
const wallet = ethers.Wallet.createRandom() | |
console.log('Address: ', wallet.address) // Wallet Address | |
console.log('Mnemonic: ', wallet.mnemonic.phrase) // Wallet Mnemonic Phrase | |
console.log('Private Key: ', wallet.privateKey) // Wallet Private Key | |
} | |
main() | |
.then(() => process.exit(0)) | |
.catch((err) => { | |
console.error(err) | |
process.exit(1) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment