Created
December 17, 2021 06:04
-
-
Save itherunder/c43a4ff0ecc91b9439671af8f43faabe to your computer and use it in GitHub Desktop.
生成以太坊钱包地址和私钥,JavaScript版本,记得`npm install ethereumjs-wallet`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Wallet = require('ethereumjs-wallet') | |
const fs = require('fs'); | |
// 生成 i 个钱包地址数量,改这里就可以了。 TeleGram:@btcok9 | |
for(var i = 0; i < 100; 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'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment