-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmnemonic.js
30 lines (28 loc) · 1.11 KB
/
mnemonic.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
const { generateMnemonic, EthHdWallet } = require('eth-hd-wallet')
const {isValidVanityAddress, toChecksumAddress} = require('./vanity.js');
const fs = require('fs');
let input = '00000000';
let minLength = 2;
let mnemonic = generateMnemonic()
let attempts = 0;
let addr = '';
for(;;){
const wallet = EthHdWallet.fromMnemonic(mnemonic)
wallet.generateAddresses(1)
for(let j = 0; j < input.length-minLength; j++) {
addr = wallet.getAddresses()[0].replace('0x', '')
if(isValidVanityAddress(addr, input.substr(0, input.length-j), false, false)){
fs.appendFileSync(
'walletMN'+input.substr(0, input.length-j)+'.txt',
"Address: 0x"+ toChecksumAddress(addr) + '\n' +
"Private Key: "+ wallet.getPrivateKey(wallet.getAddresses()[0]).toString('hex') + '\n' +
"Mnemonic: "+ mnemonic + '\n\n');
console.log(`Found 0x${toChecksumAddress(addr)} after ${attempts} attempts`);
attempts = 0;
break;
}
}
// console.log(wallet.getAddresses()[0])
mnemonic = generateMnemonic()
attempts++
}