Created
December 30, 2021 14:24
-
-
Save reaperes/82b03fc284411be1aa19c4aee20ca8b8 to your computer and use it in GitHub Desktop.
Create ethereum accounts
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
const ethers = require('ethers'); | |
const entropy = ethers.utils.randomBytes(16); // or 32 | |
const mnemonic = ethers.utils.entropyToMnemonic(entropy); | |
console.log(mnemonic); | |
const wallets = []; | |
const maxIdx = 10; | |
for (let i=0; i<maxIdx; i++) { | |
const wallet = ethers.Wallet.fromMnemonic(mnemonic, `m/44'/60'/0'/0/${i}`); | |
wallets.push({ | |
address: wallet.address, | |
privateKey: wallet.privateKey, | |
}); | |
} | |
console.table(wallets); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment