-
Notifications
You must be signed in to change notification settings - Fork 5
/
genEth.js
28 lines (22 loc) · 940 Bytes
/
genEth.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
var Wallet = require('ethereumjs-wallet')
const fs = require('fs');
// 生成 i 个钱包地址数量,改这里就可以了。 TeleGram:@btcok9
for(var i = 0; i < 20; i++){
const EthWallet = Wallet.default.generate(false);
const addressALL = EthWallet.getAddressString();
const addr = addressALL + "\n";
console.log("address: " + EthWallet.getAddressString());
const privateKeyALL = EthWallet.getPrivateKeyString();
const pKey = privateKeyALL + "\n";
console.log("privateKey: " + EthWallet.getPrivateKeyString());
//将所有地址保存到文件中
fs.appendFile('address.txt', addr, (err) => {
if (err) throw err;
console.log('追加address');
});
//将所有的私钥保存到私钥文件中
fs.appendFile('privateKeyALL.txt', pKey, (err) => {
if (err) throw err;
console.log('追加privateKey');
});
}