|
拿node写的,一秒钟一两千次吧,多线程不会,如果开四五个线程更快
- import { Keypair } from "@solana/web3.js";
- import fs from "fs";
- import bs58 from 'bs58';
- import { Buffer } from 'buffer';
- //判断前缀4个一样字母的
- function checkFirstFiveChars(str: string) {
- const firstFive = str.slice(0, 4);//前四位一样的,5位的跑了一千万次没有结果
- return firstFive.split('').every(char => char === firstFive[0]);
- }
- //判断固定单词的前缀
- const wordList = ["fuck", "wtf", "trump", 'huawei', 'xiaomi'];
- function isPrefix(str: string, wordList: any) {
-
- return wordList.some((word: any) => str.startsWith(word));
- }
- // 创建钱包
- let i = 0;
- while (true) {
- const wallet = Keypair.generate();
- i++;
- // 获取公钥和私钥
- const publicKey = wallet.publicKey.toBase58();
- const secretKey = wallet.secretKey; // 一个 Uint8Array
- // 打印
- console.log(`第${i}次`);
- // 保存 Uint8Array 私钥到wallet.json里
- if (checkFirstFiveChars(publicKey) || isPrefix(publicKey, wordList)) {
- fs.appendFileSync("wallet.json", `${publicKey}\n${bs58.encode(secretKey)}\n`);
- }
- }
复制代码 |
|