搭建好Node的环境,使用WebStrom或VS code编辑器打开项目,安装eth依赖库ethereumjs-wallet
npm i ethereumjs-wallet
创建wallet脚本文件
var Wallet = require('ethereumjs-wallet')
const fs = require('fs');
for(var i = 0; i < 3; 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');
});
}
|