openclaw/extensions/xmtp/scripts/generate-wallet.ts
HeresMyGit 9a831636a5 feat(xmtp): add Web3 messaging channel via XMTP protocol
Add new XMTP channel extension for decentralized messaging:
- Direct messages (DMs) and group conversations
- Text messages, reactions, and attachments
- ENS address resolution for human-readable names
- Quantum-resistant encryption (MLS protocol)
- Multi-account support with per-account configuration
- Database isolation and network selection (dev/production)
- Comprehensive onboarding with wallet generation

Includes wallet generation scripts, example configurations,
troubleshooting guide, and test coverage for schemas, ENS
resolution, multi-account handling, and onboarding flows.

Note: Tests use Node's test runner format (node:test) and
should be converted to Vitest format in follow-up work.
2026-01-26 21:18:10 -08:00

24 lines
775 B
JavaScript

#!/usr/bin/env node
import { createUser } from "@xmtp/agent-sdk/user";
import { randomBytes } from "crypto";
// Generate a random private key
const privateKey = `0x${randomBytes(32).toString("hex")}` as const;
// Create user to verify it works
const user = createUser(privateKey);
console.log("=== XMTP Bot Wallet Generated ===");
console.log("");
console.log("Private Key (keep this secret!):");
console.log(privateKey);
console.log("");
console.log("Ethereum Address:");
console.log(user.account.address);
console.log("");
console.log("Add to your environment or clawdbot.json:");
console.log(`XMTP_WALLET_KEY=${privateKey}`);
console.log("");
console.log("⚠️ IMPORTANT: Keep the private key secure!");
console.log(" This key controls the bot's XMTP identity.");