原理
不断生成随机密钥对,检查地址是否符合要求。 基本要一百万次以上才能匹配到一个。
注意
- 在安全的环境运行。
- 生成后,彻底删除本地 JSON 文件。
- 不要相信别人提供的在线地址生成器。
代码
下面是 claude code 完成的代码,Node.js 实现,使用官方库。
package.json
{ "name": "solana-v2ex-generator", "version": "1.0.0", "description": "Generate Solana addresses ending with v2ex", "main": "generate-v2ex-address.js", "scripts": { "start": "node generate-v2ex-address.js" }, "dependencies": { "@solana/web3.js": "^1.95.0", "bs58": "^5.0.0" } } generate-v2ex-address.js
const { Keypair } = require('@solana/web3.js'); const fs = require('fs'); const bs58 = require('bs58'); async function generateV2exAddress() { let attempts = 0; const startTime = Date.now(); console.log('开始生成以 V2EX 结尾的 Solana 地址...\n'); while (true) { attempts++; const keypair = Keypair.generate(); const publicKey = keypair.publicKey.toBase58(); if (attempts % 10000 === 0) { console.log(`已尝试 ${attempts} 次...`); } if (publicKey.endsWith('v2ex')) { const elapsedTime = (Date.now() - startTime) / 1000; console.log('\n 成功找到匹配的地址!'); console.log(`尝试次数: ${attempts}`); console.log(`耗时: ${elapsedTime.toFixed(2)} 秒\n`); console.log('='.repeat(60)); console.log('地址:', publicKey); console.log('私钥 (Base58):', bs58.encode(keypair.secretKey)); console.log('='.repeat(60)); const result = { address: publicKey, privateKey: bs58.encode(keypair.secretKey), privateKeyArray: Array.from(keypair.secretKey), attempts: attempts, timeInSeconds: elapsedTime }; const filename = `v2ex-address-${Date.now()}.json`; fs.writeFileSync(filename, JSON.stringify(result, null, 2)); console.log(`\n 结果已保存到: ${filename}`); break; } } } generateV2exAddress().catch(console.error); 