-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.js
40 lines (31 loc) · 1018 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* @LastEditors: Bot80926
* @Description: Create wallet in batches
* @FilePath: /ethers-scripts/script-1-create-wallet/index.js
* Copyright (c) 2023 by Bot80926, All Rights Reserved.
* Buy me a coffee: 0xa1ebF7E97Cfd6939fb90b27567AEBa5904a66630
*/
const ethers = require("ethers");
const fs = require("fs");
const chalk = require("chalk");
const createAccount = () => {
let list = "";
//step1: create wallet
for (let i = 0; i < 100; i++) {
const wallet = ethers.Wallet.createRandom();
const pv = wallet.privateKey;
const address = wallet.address;
list += '\r "address: ' + address + '", privateKey: "' + pv + '", \r';
}
//step2: create txt file and save wallet
fs.writeFile(`./addr_key_book.txt`, list, (error) => {
if (error) {
return console.log("create wallet failed, error: ", error);
}
console.log(chalk.green("Successfully created wallets in batches, file name: addr_key_book.txt"));
});
};
const main = async () => {
createAccount();
};
main();