| 11 | const chalk = require("chalk"); |
| 12 | |
| 13 | const createAccount = () => { |
| 14 | let list = ""; |
| 15 | |
| 16 | //step1: create wallet |
| 17 | for (let i = 0; i < 100; i++) { |
| 18 | const wallet = ethers.Wallet.createRandom(); |
| 19 | |
| 20 | const pv = wallet.privateKey; |
| 21 | |
| 22 | const address = wallet.address; |
| 23 | |
| 24 | list += '\r "address: ' + address + '", privateKey: "' + pv + '", \r'; |
| 25 | } |
| 26 | |
| 27 | //step2: create txt file and save wallet |
| 28 | fs.writeFile(`./addr_key_book.txt`, list, (error) => { |
| 29 | if (error) { |
| 30 | return console.log("create wallet failed, error: ", error); |
| 31 | } |
| 32 | console.log(chalk.green("Successfully created wallets in batches, file name: addr_key_book.txt")); |
| 33 | }); |
| 34 | }; |
| 35 | |
| 36 | const main = async () => { |
| 37 | createAccount(); |