Skip to content

Instantly share code, notes, and snippets.

@reaperes
Created December 30, 2021 14:24
Show Gist options
  • Save reaperes/82b03fc284411be1aa19c4aee20ca8b8 to your computer and use it in GitHub Desktop.
Save reaperes/82b03fc284411be1aa19c4aee20ca8b8 to your computer and use it in GitHub Desktop.
Create ethereum accounts
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