Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,30 @@ if (cluster.isMaster) {
args.numWallets;
spinner.start();
} else if (message.counter) {
addps++;
addps += message.counter;
}
});
}
} else {
const worker_env = process.env;
while (true) {
if (process.send) {
setInterval(function() {
var res = VanityEth.getVanityWallet(
worker_env.input,
worker_env.isChecksum == "true",
worker_env.isContract == "true",
1000
);
if(res[1] > 0) {
process.send({
account: VanityEth.getVanityWallet(
worker_env.input,
worker_env.isChecksum == "true",
worker_env.isContract == "true",
function () {
process.send({
counter: true,
});
}
),
counter: res[1],
});
}
}
if(res[0]) {
process.send({
account: res[0],
});
}
}, 1000);
}
process.stdin.resume();
const cleanup = function (options, err) {
Expand Down
13 changes: 10 additions & 3 deletions libs/VanityEth.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,24 @@ var getVanityWallet = function (
input = "",
isChecksum = false,
isContract = false,
counter = function () {}
maxTime = 0
) {
if (!isValidHex(input)) throw new Error(ERRORS.invalidHex);
input = isChecksum ? input : input.toLowerCase();
var _wallet = getRandomWallet();
var now = (new Date()).getTime();
var startTime = now;
var loopCount = 0;
while (!isValidVanityWallet(_wallet, input, isChecksum, isContract)) {
counter();
loopCount++;
_wallet = getRandomWallet(isChecksum);
if(maxTime && loopCount % 10 === 0 && (new Date()).getTime() - startTime > maxTime) {
return [null, loopCount];
}
}

if (isChecksum) _wallet.address = ethUtils.toChecksumAddress(_wallet.address);
return _wallet;
return [ _wallet, loopCount ];
};
var getDeterministicContractAddress = function (address) {
return (
Expand Down