Files
agent-bounty-protocol/scripts/generate_wallet.ts
OG T 997e1bf520
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 9s
chore: production rollout for external traffic monitoring, SDK ecosystem, and admin observability
2026-06-09 14:55:40 +08:00

37 lines
1.3 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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();