import { ethers } from "ethers"; import fs from "fs"; /** * ⚠️ VibeWork Cold Wallet Generator ⚠️ * * 此腳本會使用安全的隨機熵產生一個全新的以太坊/EVM冷錢包。 * 產生的助記詞 (Mnemonic) 和私鑰 (Private Key) 絕對不要提交到 GitHub! */ function generateColdWallet() { console.log("🔒 Generating a new secure cold wallet..."); const wallet = ethers.Wallet.createRandom(); const walletData = { address: wallet.address, privateKey: wallet.privateKey, mnemonic: wallet.mnemonic?.phrase }; const backupFile = `./vibework-treasury-backup-${Date.now()}.json`; fs.writeFileSync(backupFile, JSON.stringify(walletData, null, 2)); console.log(`\n✅ 錢包已產生!`); console.log(`📍 地址 (Address): ${wallet.address}`); console.log(`🔑 私鑰 (Private Key): ${wallet.privateKey}`); console.log(`📝 助記詞 (Mnemonic): ${wallet.mnemonic?.phrase}`); console.log(`\n⚠️ 備份檔案已存至: ${backupFile}`); console.log(`⚠️ 請立刻將備份檔案移至離線的 USB 或紙本,並刪除電腦上的檔案!`); console.log(`\n💡 在 .env 檔中設定你的平台國庫:`); console.log(`PLATFORM_TREASURY_PRIVATE_KEY=${wallet.privateKey}`); } generateColdWallet();