Загрузка...

Генерация SOLANA кошелька NodeJS

Тема в разделе Node.js создана пользователем Okila 20 дек 2024. 296 просмотров

  1. Okila
    Okila Автор темы 20 дек 2024 Заблокирован(а) 1092 26 дек 2020
    1. Устанавливаем Node.JS LTC
    2. Устанавливаем зависимости:
    ⁡npm install Solana /web3.js bs58

    3. Создаем файл gen.js, куда вставляем этот код:
    ВАЖНО! Отредактируй свой желаемый префикс в 53 строчке кода, учитывая допустимые символы!
    JS
    const { Keypair } = require("@solana/web3.js");
    const bs58 = require("bs58").default || require("bs58");
    const { Worker, isMainThread, parentPort, workerData } = require("worker_threads");
    const { performance } = require("perf_hooks");

    /**
    * @returns {Object}
    */
    function generateWallet() {
    const keypair = Keypair.generate();
    const publicKey = keypair.publicKey.toBase58();
    const privateKey = bs58.encode(Buffer.from(keypair.secretKey));
    return { publicKey, privateKey };
    }

    /**
    * @param {string} prefix
    * @param {function} logProgress
    * @returns {Object}
    */
    function generateWalletWithPrefix(prefix, logProgress) {
    if (!prefix || typeof prefix !== "string") {
    throw new Error("Prefix must be a non-empty string.");
    }

    let wallet;
    let attempts = 0;
    const startTime = performance.now();
    const probability = 1 / Math.pow(58, prefix.length);

    while (true) {
    wallet = generateWallet();
    attempts++;

    if (attempts % 1000 === 0) {
    const elapsed = (performance.now() - startTime) / 1000;
    const expectedTotalAttempts = 1 / probability;
    const remainingAttempts = Math.max(0, expectedTotalAttempts - attempts);
    const avgAttemptsPerSecond = attempts / elapsed;
    const estimatedTimeRemaining = avgAttemptsPerSecond > 0 ? remainingAttempts / avgAttemptsPerSecond : Infinity;
    logProgress(attempts, elapsed, estimatedTimeRemaining);
    }

    if (wallet.publicKey.toLowerCase().startsWith(prefix.toLowerCase())) {
    const totalTime = (performance.now() - startTime) / 1000;
    return { wallet, attempts, totalTime };
    }
    }
    }

    if (isMainThread) {
    const numThreads = require("os").cpus().length;
    const prefix = "your_prefix"; // 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

    console.log(`Starting generation with prefix: ${prefix} using ${numThreads} threads`);

    const workers = [];
    let totalAttempts = 0;
    const startTime = performance.now();
    const probability = 1 / Math.pow(58, prefix.length);
    const expectedTotalAttempts = 1 / probability;

    function updateProgress() {
    const elapsed = (performance.now() - startTime) / 1000;
    const avgAttemptsPerSecond = totalAttempts / elapsed;
    const remainingAttempts = Math.max(0, expectedTotalAttempts - totalAttempts);
    const estimatedTimeRemaining = avgAttemptsPerSecond > 0 ? remainingAttempts / avgAttemptsPerSecond : Infinity;
    process.stdout.write(`\rTotal attempts: ${totalAttempts}, Elapsed time: ${elapsed.toFixed(2)} seconds, Estimated time remaining: ${estimatedTimeRemaining.toFixed(2)} seconds`);
    }

    for (let i = 0; i < numThreads; i++) {
    const worker = new Worker(__filename, { workerData: { prefix } });
    workers.push(worker);

    worker.on("message", (result) => {
    if (result.wallet) {
    console.log(`\nWallet found by thread after ${result.attempts} attempts in ${result.totalTime.toFixed(2)} seconds:`, result.wallet);
    process.exit(0);
    } else if (result.attempts) {
    totalAttempts += result.attempts;
    updateProgress();
    }
    });

    worker.on("error", (err) => {
    console.error(`Worker error: ${err}`);
    });

    worker.on("exit", (code) => {
    if (code !== 0) {
    console.error(`Worker stopped with exit code ${code}`);
    }
    });
    }
    } else {
    const { prefix } = workerData;
    const logProgress = (attempts, elapsed, estimatedTimeRemaining) => {
    const avgAttemptsPerSecond = elapsed > 0 ? (attempts / elapsed).toFixed(2) : "0.00";
    parentPort.postMessage({ attempts });
    };

    const result = generateWalletWithPrefix(prefix, logProgress);
    parentPort.postMessage(result);
    }
    4. Запускаем процесс:
    ⁡node gen.js


    Ждем пока сгенерируется приват ключ)



    Скрипт работает на CPU, используя максимум возможностей.
     
    20 дек 2024 Изменено
    1. ЗЛЫЕДЕНЬГИ666
      Okila, выглядит как :smile_snowball:
    2. Okila Автор темы
  2. el9in
    el9in 20 дек 2024 lolz.live/threads/7387449 — USDT TRC без комиссии
    Интересно конечно, но для чего это людям?
     
    1. Ягода
      el9in, для клипера, когда жертва адрес копирует может замети т что он изменился при переводе, а тут шанс что прокатит увеличивается
Загрузка...
Top