rwadurian/backend/services/blockchain-service
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
..
.claude fix(mobile-app): update share link domain to rwaapi.szaiai.com 2025-12-06 21:15:55 -08:00
contracts feat(blockchain-service): KAVA EVM address derivation and system accounts support 2025-12-08 21:45:34 -08:00
prisma fix: 修复多个服务的 accountSequence 类型和推荐关系 bug 2025-12-12 12:29:11 -08:00
scripts feat(blockchain-service): KAVA EVM address derivation and system accounts support 2025-12-08 21:45:34 -08:00
src feat(blockchain): 将提现转账从私钥签名改为 MPC 签名 2025-12-15 08:04:17 -08:00
.dockerignore feat(blockchain-service): implement complete blockchain service with DDD + Hexagonal architecture 2025-12-06 20:54:58 -08:00
.env.example feat(blockchain): 将提现转账从私钥签名改为 MPC 签名 2025-12-15 08:04:17 -08:00
.eslintrc.js feat(blockchain-service): implement complete blockchain service with DDD + Hexagonal architecture 2025-12-06 20:54:58 -08:00
.gitignore feat(blockchain-service): implement complete blockchain service with DDD + Hexagonal architecture 2025-12-06 20:54:58 -08:00
.prettierrc feat(blockchain-service): implement complete blockchain service with DDD + Hexagonal architecture 2025-12-06 20:54:58 -08:00
DEVELOPMENT_GUIDE.md refactor: 多项UI优化和品牌更名 2025-12-15 01:43:47 -08:00
Dockerfile fix(wallet): resolve account creation and wallet status query issues 2025-12-08 07:57:17 -08:00
deploy.sh . 2025-12-07 00:40:19 -08:00
docker-compose.yml feat(blockchain): 将提现转账从私钥签名改为 MPC 签名 2025-12-15 08:04:17 -08:00
nest-cli.json feat(blockchain-service): implement complete blockchain service with DDD + Hexagonal architecture 2025-12-06 20:54:58 -08:00
package-lock.json feat(deposit): add deposit balance API and Kafka consumer for deposit events 2025-12-09 02:29:31 -08:00
package.json feat(deposit): add deposit balance API and Kafka consumer for deposit events 2025-12-09 02:29:31 -08:00
tsconfig.json feat(blockchain-service): implement complete blockchain service with DDD + Hexagonal architecture 2025-12-06 20:54:58 -08:00