Commit Graph

15 Commits

Author SHA1 Message Date
hailin dcf857059e fix(scripts): 修正容器名为 rwa-blockchain-service
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:34:25 -08:00
hailin b9b6dacbab fix(scripts): 使用 docker exec blockchain-service 计算地址
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:32:43 -08:00
hailin 6fe615eac5 fix(scripts): 进入 blockchain-service 目录使用 ethers 计算地址
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:30:19 -08:00
hailin a4d3f21475 revert(scripts): 恢复到 578a865 版本
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:28:05 -08:00
hailin 8465f53996 fix(scripts): 使用项目目录的 ethers 计算地址
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:27:42 -08:00
hailin 578a865c4d feat(scripts): 获取 mpc-system 实际创建的 username
- 添加 get_actual_username 函数从数据库查询实际 username
- mpc-system 自动生成 wallet-xxx 格式,脚本输出实际值
- show_result 使用 ACTUAL_USERNAME 显示正确配置

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:22:34 -08:00
hailin cdf858520d revert(scripts): 恢复脚本到JWT认证版本,不修改username
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:20:43 -08:00
hailin 8641529028 revert: 移除 verify_and_fix_username 调用
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:19:28 -08:00
hailin 0bf52c7b2c fix(scripts): 自动修复热钱包 username
- verify_and_fix_username 函数通过 docker exec 直接查询和更新数据库
- 移除手动回退,全自动化处理
- 将函数添加到主流程中

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:18:33 -08:00
hailin 93c658d914 fix(scripts): 添加 JWT 认证支持
mpc-system account-service 需要 JWT 认证,脚本需要:
- 添加 --jwt-secret 参数或从 MPC_JWT_SECRET 环境变量读取
- 使用 openssl 生成 HS256 JWT token
- 所有 API 请求添加 Authorization: Bearer header

用法:
  export MPC_JWT_SECRET='your_secret'
  ./init-hot-wallet.sh --username rwadurian-system-hot-wallet-01 --threshold-n 3 --threshold-t 2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 08:52:40 -08:00
hailin c0e6e1f620 refactor(scripts): 简化热钱包初始化脚本参数
- 只保留 --username, --threshold-n, --threshold-t 参数
- 移除 --host, --verbose, --help 参数(host 固定为 localhost:4000)
- username 改为必填参数
- 更新使用说明和错误提示

用法: ./init-hot-wallet.sh --username rwadurian-system-hot-wallet-01 --threshold-n 3 --threshold-t 2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 08:48:51 -08:00
hailin fce8a919ff fix(scripts): 修改热钱包初始化脚本直接调用mpc-system
- 改为直接调用 mpc-system account-service (端口 4000)
- 使用 snake_case API 格式 (threshold_n, threshold_t, require_delegate)
- 系统热钱包设置 require_delegate: false (不需要用户持有share)
- 更新状态查询路径为 /api/v1/mpc/sessions/{sessionId}

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 08:44:45 -08:00
hailin 9531405c9b fix(scripts): 修复热钱包初始化脚本默认端口为3006
mpc-service 实际运行在 3006 端口,将脚本默认值从 3013 改为 3006

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 08:20:48 -08:00
hailin ad22c23656 refactor(scripts): 完善热钱包MPC初始化脚本
主要改进:
- 修复API路径: /mpc/keygen -> /api/v1/mpc/keygen
- 添加彩色日志输出 (info/success/warn/error/debug)
- 添加依赖检查 (curl, jq)
- 添加服务连通性检查 (health endpoint)
- 添加参数验证
- 添加详细模式 (-v/--verbose)
- 改进等待进度显示 (spinner动画)
- 支持多种地址派生方式 (Node.js ethers / Python eth_keys)
- 改进错误处理和用户提示
- 添加使用示例
- 完成后提供一键复制的环境变量配置命令

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 08:17:40 -08:00
hailin 9cac91b5f0 feat(blockchain): 将提现转账从私钥签名改为 MPC 签名
背景:
- 原实现使用 HOT_WALLET_PRIVATE_KEY 进行热钱包签名
- 私钥直接存储存在安全风险
- 系统已有 MPC 基础设施,应该复用

改动内容:

1. 新增 MPC 签名客户端
   - infrastructure/mpc/mpc-signing.client.ts: 调用 mpc-service 的签名 API
   - 支持创建签名会话、轮询等待、获取签名结果

2. 重构 ERC20 转账服务
   - domain/services/erc20-transfer.service.ts: 从私钥签名改为 MPC 签名
   - 移除 Wallet 依赖,改用 Transaction 手动构建交易
   - 使用 MPC 签名后广播已签名交易

3. 新增初始化服务
   - mpc-transfer-initializer.service.ts: 启动时注入 MPC 客户端
   - 解决 Domain 层和 Infrastructure 层的循环依赖

4. 新增热钱包初始化脚本
   - scripts/init-hot-wallet.sh: 便捷创建系统热钱包的 MPC 密钥
   - 支持配置门限值、用户名等参数

5. 更新配置
   - 移除 HOT_WALLET_PRIVATE_KEY 依赖
   - 新增 MPC_SERVICE_URL, HOT_WALLET_USERNAME, HOT_WALLET_ADDRESS
   - 更新 docker-compose.yml 和 .env.example

部署前需要:
1. 运行 init-hot-wallet.sh 初始化热钱包
2. 配置 HOT_WALLET_USERNAME 和 HOT_WALLET_ADDRESS
3. 向热钱包充值 USDT 和原生币(gas)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 08:04:17 -08:00