生成一个 V2EX 结尾的 solana 地址

49 天前
 BeCool

原理

不断生成随机密钥对,检查地址是否符合要求。 基本要一百万次以上才能匹配到一个。

注意

代码

下面是 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);
3777 次点击
所在节点    分享创造
24 条回复
GreyChou
45 天前
同样疑问,自己生成的地址怎么绑定的?
Oah1zO
45 天前
@kaichen 就算所有 holder 都改成 V2EX 后缀的地址..几千个而已..真的有影响么...

数量级在那呢。你要说被破解率上升了 1000 倍是吧...

一滴水和一杯水放到大海里,有区别么?
ershierdu
45 天前
@kaichen
纯好奇,这为什么会压缩状态空间?如果我撞出了 123456789……123456789 这个地址,其他人有办法破解吗?
BeCool
45 天前
@GreyChou 在钱包中导入私钥,然后绑定就可以。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://ex.noerr.eu.org/t/1150346

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX