Commit Graph

36 Commits

Author SHA1 Message Date
hailin 457ee8f4cb feat(infra): 双域名DNS架构 + DNS管理脚本
## 域名规划
- gogenex.cn (阿里云DNS): 29条记录,国内公网指向 14.215.128.96
- gogenex.com (Namecheap DNS): 5条记录,海外公网指向 154.84.135.121
- 两个域名到达同一台物理服务器(双网卡),再反代到内网 192.168.1.222

## DNS 管理脚本
- scripts/alidns_manager.py: 阿里云DNS单条记录CRUD
- scripts/alidns_batch.py: 阿里云DNS批量配置
- scripts/namecheap_manager.py: Namecheap DNS安全读-合并-写操作
- scripts/namecheap_batch.py: Namecheap DNS批量配置
- 修复 namecheap_manager.py XML解析大小写问题 (Host vs host)

## 文档
- docs/gogenex-domain-planning.md: 双域名架构规划 v1.1
- docs/plan-schema.md: 批量DNS配置JSON格式定义
- docs/migration-guide.md: DNS迁移指南

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 22:12:47 -08:00
hailin bc0d1e0876 feat: 新增 deploy.sh 部署管理脚本体系 — 后端主控+12服务独立+区块链
参照 rwadurian 项目模式,为全栈系统创建统一的 deploy.sh 管理体系:

- backend/deploy.sh: 主控脚本 (up/down/restart/build/build-no-cache/health/infra-*/单服务操作)
- 12个服务独立 deploy.sh (build/rebuild/start/stop/restart/logs/health/shell/test)
- blockchain/deploy.sh: 节点+生态+合约+浏览器+监控全覆盖
- 更新 09-编译部署指南.md 新增第9章 deploy.sh 使用文档

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:13:09 -08:00
hailin cc4d3d11f8 docs: 新增09-编译部署指南 — 全栈编译、运行与生产部署完整文档
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 16:54:03 -08:00
hailin 4c1d907df6 feat: ERC-1155 同质化券系统 + denom统一为agnx (18位EVM标准)
新增ERC-1155双模式券系统(Utility Track专用):
- ICouponBatch接口 + CouponBatch核心合约(FACTORY/BURNER角色)
- Redemption1155兑付合约(余额/过期/门店/黑名单验证)
- CouponFactory新增mintBatch1155路由(上限100,000张O(1)铸造)
- Deploy.s.sol部署CouponBatch+Redemption1155+角色授权
- 46个新测试(CouponBatch 16 + Redemption1155 9 + Factory 11 + Integration 5 + fuzz)

Denom统一: ugnx(6位)→agnx(18位EVM标准), 金额×10^12

全量测试143/143通过,编译零错误。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 22:34:30 -08:00
hailin 0ea869ac46 fix: 区块链生态审计修复 — SDK补全 + Enterprise API加固 + 删除无用wallet-service
基于08-区块链生态基础设施开发指南的全面审计,修复以下问题:

## SDK 补全(对齐指南 §7.2-7.4)

- **JS SDK**: 新增 SettlementModule (settlement.ts),实现 executeSwap() 合约交互
  和 onSwapExecuted() 事件监听,补齐指南 §7.2 要求的 settlement 模块
- **Go SDK**: 新增 ExecuteSwap() 函数 (settlement.go),完整实现 ABI 编码 → nonce
  获取 → gas 估算 → 签名 → 广播 → receipt 等链上交易全流程
- **Dart SDK**: 新增统一事件订阅接口 subscribeEvents(EventFilter),匹配指南 §7.4
  规范;新增 EventFilter 模型类,支持 newHeads/logs 两种订阅类型

## Enterprise API 加固(对齐指南 §3.2/§3.4)

- 新增 TierThrottlerGuard 分层限流守卫,按 API tier 区分速率限制:
  public 60/min, institutional 600/min, regulatory/internal unlimited
- WebSocket 网关增加完整认证:API Key 通过 query param 或 header 传递,
  最低要求 institutional 级别,未认证连接自动拒绝

## 删除无用的 wallet-service(架构纠正)

- 删除 blockchain/wallet-service/ 整个目录(13个文件,875行代码)
  该服务架构设计有误:钱包操作(用户钱包、机构操作、治理多签)已由现有
  后端微服务处理(user-service:3001、issuer-service:3002、trading-service:3003、
  clearing-service:3004),无需在 blockchain/ 目录下另建独立服务
- docker-compose.yml: 移除 wallet-service 服务定义和端口 3021 映射
- chain-ci.yml: 从 NestJS 生态服务 CI matrix 中移除 wallet-service
- 08-指南: 删除第4节(钱包体系 §4.1-4.3),移除部署清单中 MPC签名服务:3021,
  更新生态全景图,章节重新编号 (12→11章)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 22:05:52 -08:00
hailin 02a597c252 docs: 新增08-区块链生态基础设施开发指南 — 链生态完整工具链
独立于06-区块链开发指南(链内核),本文档覆盖Genex Chain量产运营所需的全部生态基础设施:

1. 区块浏览器(Blockscout)
   - EVM兼容配置、券NFT定制详情页、合规标签系统
   - 发行方档案页、验证节点面板、Gas补贴统计

2. 企业API服务(:3020)
   - 4层认证:公开API Key / 机构mTLS / 监管mTLS+证书 / 内部服务间mTLS
   - 公开端点(区块/交易/券查询)、机构端点(批量导出/WebSocket)、监管端点(地址图谱/Travel Rule/冻结)

3. 三层钱包体系
   - 用户抽象钱包:MPC 2-of-3门限签名,用户无感(手机号=身份)
   - 机构托管钱包:HSM/Fireblocks,多签审批,白名单+限额
   - 治理多签钱包:Gnosis Safe 3/5或4/5,合约升级/冻结/参数调整

4. Gas Relayer(Meta-TX中继器,:3022)
   - EIP-712签名验证、防重放nonce、Relayer热钱包自动补充

5. 链监控运维(Prometheus + Grafana)
   - 14项关键指标:共识/EVM/存储/网络/业务/Relayer/跨链桥
   - AlertManager → PagerDuty / Slack

6. 测试网水龙头(:3023)
7. 开发者SDK(JS/Go/Dart三语言)
8. 归档节点(pruning=nothing,全历史状态)
9. 跨链桥监控(Axelar资产对账,自动暂停)
10. 合约安全CI(Slither + Mythril + 第三方审计)
11. 完整端口分配(3020-3024 + 4000 + 9090)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 17:12:46 -08:00
hailin 0c70a030ea docs: 06-区块链开发指南 v3.0 量产版 — 去除全部MVP/阶段性限制
变更明细:
- 链设计参数:共识机制从"初期平台运营"改为"平台+合格机构验证节点"
- 节点运营:去掉"未来开放",直接定义多机构验证节点架构
- CouponFactory:移除Utility-only硬编码限制,开放Utility+Securities双轨制
  - Securities Track增加合格投资者验证+Broker-Dealer合规检查
- 新增第11节"多机构验证节点架构":
  - 4类节点(创世验证/机构验证/监管观察/全节点)准入条件
  - 生产验证节点CometBFT共识配置(出块≤1s)
  - 部署拓扑(Genex x3 + 机构 x4+ + 监管 x3)
- GNX代币:去掉"待法律意见书后开放"措辞,改为"需合规审批"
  - 代币分配去掉"预留设计"标签
- CBS资产证券化:从Phase 4接口预留升级为完整合约实现
  - createPool(券收益流打包)
  - purchaseShares(合格投资者份额认购)
  - setCreditRating(链下评级机构写入)
  - distributeYield(到期收益按份额分配)
- Gas策略保持不变(前期补贴+未来可通过Governance调整)
- 章节重新编号(11→21共21节)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 18:47:55 -08:00
hailin e20c321d12 refactor: 遥测与版本管理拆分为独立微服务 (telemetry-service + admin-service)
架构重构: 将遥测(Telemetry)和版本管理(App Version)从 user-service 拆分为两个独立微服务,
严格遵循 DDD + Clean Architecture 四层架构。

新增服务:
- telemetry-service (:3011) — 用户心跳检测、事件采集、DAU统计、Prometheus指标
  - domain: 3实体 + 3值对象(EventName/InstallId/TimeWindow) + 2领域事件
  - infrastructure: Redis(Sorted Set心跳) + Kafka(事件发布) + Prometheus(5指标)
  - 定时任务: 每分钟在线快照、每小时清理过期、凌晨DAU精确计算、滚动DAU更新
- admin-service (:3012) — APK/IPA版本管理、OTA更新、MinIO文件存储
  - domain: 1实体 + 4值对象(VersionCode/VersionName/FileSha256/DownloadUrl)
  - infrastructure: MinIO(文件上传/下载) + APK/IPA解析器
  - 移动端: 检查更新API(无认证) + 下载重定向(预签名URL)
  - 管理端: 版本CRUD + 上传解析 + 启禁用

user-service 清理:
- 删除24个已迁移文件(4实体+4服务+4基础设施+5控制器+6DTO+1gitkeep)
- 移除不再需要的依赖: @nestjs/schedule, minio, prom-client, kafkajs
- 精简 user.module.ts,仅保留用户核心功能(Profile/KYC/Wallet/Message/Admin)

基础设施更新:
- Kong: 遥测路由 → telemetry-service:3011, 版本路由 → admin-service:3012
- docker-compose: 新增2个服务容器 + MinIO app-releases bucket
- 07开发指南: 更新为独立服务架构描述

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:30:39 -08:00
hailin 4da8a373f2 refactor: 全项目清除MVP字样,统一为正式系统用语
## 变更范围:21个文件,覆盖全栈

### SRS需求文档 (4个文件,20处修改)

docs/券金融平台-软件需求规格.md (7处):
- "MVP策略" → "运营策略"/"合规策略"
- "MVP阶段GNX不上交易所" → "Phase 1阶段GNX不上交易所"
- "MVP同步" → "同步发布"
- "MVP阶段优先级" → "阶段优先级"
- "Phase 1(MVP)" → "Phase 1(基础平台)"
- "基础发行与交易(MVP,仅Utility Track)" → "基础发行与交易(仅Utility Track)"

docs/券金融平台-需求规格综合评估报告.md (4处):
- "MVP分期" → "阶段分期"
- "MVP回避策略" → "合规回避策略"
- "MVP仅Utility Track" → "Phase 1仅Utility Track"

docs/闲券交易平台-架构开发需求.md (4处):
- "MVP阶段只开放" → "当前阶段只开放"
- "Phase 1(MVP)" → "Phase 1(基础平台)"
- "基础平台(MVP,仅Utility Track)" → "基础平台(仅Utility Track)"

docs/闲券平台-软件开发需求.md (5处):
- "MVP阶段用户不接触" → "当前阶段用户不接触"
- "MVP策略" → "运营策略"
- "Phase 1(MVP)" → "Phase 1(基础平台)"
- "Phase 1 — MVP" → "Phase 1 — 基础平台"

### 后端服务代码 (7个文件,13处修改)

trading-service (Go):
- admin_trade_handler.go: 3处 "for MVP"/"In MVP" 注释清除
- admin_mm_handler.go: 2处 "In MVP"/"for MVP" 注释清除

chain-indexer (Go):
- admin_chain_handler.go: 1处 "for MVP" 注释清除

compliance-service (NestJS):
- admin-compliance.service.ts: 3处 "(mock for MVP)" 注释清除

issuer-service (NestJS):
- admin-issuer.service.ts: 1处 "For MVP" 注释清除
- admin-merchant.service.ts: 2处 "For MVP" 注释清除

notification-service (NestJS):
- event-consumer.service.ts: 1处 "In MVP" 注释清除

### 前端代码 (10个文件)

mobile (5个文件):
- i18n: en/zh_cn/zh_tw/ja 4语言 "MVP版本仅支持" → "当前仅支持"
- i18n key: proMode.mvpNote → proMode.trackNote
- pro_mode_page.dart: 更新key引用

genex-mobile (5个文件):
- 同mobile,4语言+1页面引用全部更新

### 验证结果
全项目grep (?i)\bMVP\b = 0 matches,彻底清除完毕

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:13:47 -08:00
hailin 0bf1df0f7a feat: 补全遥测/版本管理完整功能 + 清除全部开发指南中的MVP字样
## 功能补全 (12个新文件 + 6个修改)

DTO验证类 (6):
- batch-events.dto.ts — 批量事件上报验证(ArrayMaxSize 500, ValidateNested)
- heartbeat.dto.ts — 心跳上报验证(installId, appVersion)
- query-dau.dto.ts — DAU查询+事件查询验证(IsDateString, 分页)
- check-update.dto.ts — 检查更新验证(platform IsIn, version_code IsInt)
- create-version.dto.ts — 创建/更新版本验证(CreateVersionDto + UpdateVersionDto)
- upload-version.dto.ts — 上传版本验证(multipart/form-data字段)

基础设施 (3):
- package-parser.service.ts — APK解析(adbkit-apkreader) + IPA解析(unzipper+bplist-parser)
- telemetry-producer.service.ts — Kafka事件发布(telemetry.session.started + telemetry.heartbeat)
- telemetry-metrics.service.ts — Prometheus 5指标(online_users/dau/heartbeat_total/events_total/batch_duration)

控制器 (1):
- metrics.controller.ts — GET /metrics 端点(Prometheus格式)

功能增强:
- admin-version.controller.ts — 新增POST /parse解析预览端点 + upload自动解析填充元数据
- app-version.controller.ts — 新增GET /download/:id下载端点(302重定向MinIO)
- telemetry.service.ts — 集成Prometheus计数器+直方图 + Kafka事件发布
- telemetry-scheduler.service.ts — 快照/DAU时更新Prometheus指标
- user.module.ts — 注册MetricsController + TelemetryMetricsService + TelemetryProducerService + PackageParserService
- package.json — 新增prom-client依赖

## 开发指南MVP清除 (4个文件)

- 00-UI设计需求.md — "MVP阶段" → "当前阶段"
- 05-后端开发指南.md — "Phase 1 (MVP)" → "Phase 1 (基础平台)"
- 06-区块链开发指南.md — 清除所有MVP引用(合约注释/代币用途/Gas模型/预留接口)
- 07-遥测与版本管理开发指南.md — 清除MVP理由, 删除"可选"标记

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:09:10 -08:00
hailin 5a66b3071f feat: 新增用户遥测(Telemetry)与移动端OTA版本管理功能
## 遥测系统 (Telemetry)
- 心跳检测: 客户端60s上报心跳,Redis Sorted Set实时计算在线用户数(180s窗口)
- 事件采集: 批量上报客户端事件(会话/页面/操作),写入PostgreSQL telemetry_events表
- DAU统计: 基于app_session_start事件按userId/installId去重
  - 实时近似: Redis HyperLogLog (PFADD/PFCOUNT)
  - 精确计算: 每天凌晨1:00从事件表聚合,支持平台/地区维度
- 在线快照: 每分钟记录在线用户数快照,支持1m/5m/1h区间聚合查询
- 定时任务: @nestjs/schedule驱动 (每分钟快照/每小时清理/凌晨DAU/滚动DAU)

## 版本管理 (App Version / OTA Update)
- 版本CRUD: 管理员创建/编辑/删除/启禁用版本记录
- 文件上传: APK/IPA上传至MinIO(app-releases bucket),自动计算SHA256
- 强制更新: isForceUpdate标志,客户端据此决定是否阻断使用
- 检查更新API: GET /app/version/check?platform=android&current_version_code=200
- 预签名下载: MinIO presigned URL (24h有效)

## 新增文件清单 (18个新文件 + 3个修改)

数据库迁移 (4):
- 032_create_telemetry_events.sql — 事件日志表(append-only, BIGSERIAL)
- 033_create_daily_active_stats.sql — DAU日统计表(day PK, JSONB平台/地区)
- 034_create_online_snapshots.sql — 在线快照表(每分钟记录)
- 035_create_app_versions.sql — 应用版本表(platform CHECK, 唯一索引)

TypeORM实体 (4):
- telemetry-event.entity.ts — 遥测事件(userId, installId, eventName, properties)
- online-snapshot.entity.ts — 在线快照(ts, onlineCount, windowSeconds)
- daily-active-stats.entity.ts — DAU统计(day PK, dauByPlatform/Region JSONB)
- app-version.entity.ts — 应用版本(Platform enum, @VersionColumn乐观锁)

Redis基础设施 (1):
- presence-redis.service.ts — ZADD心跳 + ZCOUNT在线 + PFADD/PFCOUNT DAU

业务服务 (4):
- telemetry.service.ts — 批量事件入库 + 心跳记录 + 在线/DAU查询
- telemetry-scheduler.service.ts — 4个Cron定时任务
- app-version.service.ts — checkUpdate + CRUD + toggle + 重复检测
- file-storage.service.ts — MinIO上传(SHA256) + presigned下载URL

HTTP控制器 (4):
- telemetry.controller.ts — POST events(无需认证) + POST heartbeat + GET online
- admin-telemetry.controller.ts — GET /admin/telemetry/dau|events|realtime
- app-version.controller.ts — GET /app/version/check (移动端)
- admin-version.controller.ts — 完整CRUD + multipart上传 + toggle启禁用

修改文件 (3):
- user.module.ts — 注册4实体+4控制器+5服务+ScheduleModule
- package.json — 新增@nestjs/schedule, minio, @types/multer
- kong.yml — 新增4条Kong路由(telemetry, admin/telemetry, app/version, admin/versions)

文档 (1):
- docs/guides/07-遥测与版本管理开发指南.md — 完整开发指导(参考rwadurian适配)

注: admin遥测路径为/admin/telemetry,避免与issuer-service的/admin/analytics冲突

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 17:53:50 -08:00
hailin e450bef7cd feat: Complete all 4 frontend UI prototypes covering guides 00-04
Add 116 UI prototype files across 4 frontend applications, achieving
~95% coverage of all functional requirements from development guides.

## mobile/ (Flutter Consumer + Merchant App) — 48 files
- Auth: welcome, login, register, forgot-password
- Coupons: home, market, search, detail, my-coupons, my-coupon-detail,
  order-confirm, payment, payment-success, redeem-qr
- Trading: trading, sell-order (AI pricing), transfer
- Wallet: wallet, deposit, withdraw, transaction-records
- Profile: profile, kyc (L0-L3), settings, payment-management, pro-mode
  (WalletConnect, chain address, tx hash, track selection)
- AI Agent: agent-chat, ai-fab (floating button with unread count)
- Merchant: merchant-home (scanner, confirm, success, history, dashboard),
  merchant-ai-assistant (redeem assist, traffic prediction, anomaly alerts)
- Message: message-list, message-detail
- Issuer: issuer-main-page
- Shared widgets: coupon-card, price-tag, credit-badge, kyc-badge,
  status-tag, empty-state, skeleton-loader, confirm-sheet, genex-button,
  ai-confirm-dialog (3-level risk confirmation)
- Theme: app-colors, app-typography, app-spacing, app-theme
- i18n: zh-CN, en-US, ja-JP

## admin-app/ (Flutter Issuer Console) — 27 files
- Auth: issuer-login
- Onboarding: 5-step enterprise onboarding with AI compliance check
- Dashboard: issuer-dashboard (stats, AI insight, credit/quota),
  user-portrait (age/geo/preference/repurchase/AI insight)
- Coupon management: list, create (template-based, AI pricing),
  detail (recall/delist), batch-operations (issue/recall/price-adjust)
- Redemption: scan-to-redeem with offline mode
- Finance: overview, reconciliation (auto-reconcile, export PDF/Excel),
  financing-analysis (cost-benefit, liquidity, risk indicators, AI strategy)
- Credit: credit-scoring (4-factor, tier progress, AI suggestions),
  quota-management (usage gauge, type breakdown, tier upgrade, increase requests)
- AI Agent: full conversation UI with quick actions
- Settings: account, notification, support, tier display
- Store management: hierarchy (HQ/regional/store), employee roles
- Shared: ai-suggestion-card
- Theme: app-colors, app-theme, app-typography, app-spacing
- i18n: zh-CN, en-US, ja-JP

## admin-web/ (React + Next.js Platform Admin) — 26 files
- Layout: AdminLayout with collapsible sidebar, 10 nav sections
- Dashboard: key metrics, transaction feed, system health
- Users: user management with KYC filtering, risk tags
- Issuers: issuer review with AI pre-screening, credit rating display
- Trading: real-time monitor, order book, abnormal detection
- Risk: risk dashboard, AI warnings, suspicious transactions, OFAC logs
- Compliance: SAR/CTR management, audit logs, AI report generation
- SEC Filing: S-1/10-K/10-Q/8-K tracker, filing timeline, auto-disclosure
- License management: FinCEN MSB, BitLicense, MTL (48 states), renewal alerts
- SOX compliance: ICFR/ITGC/access/change-mgmt controls, deficiency tracking
- Tax compliance: Federal + 4 states, 8 IRS forms, tax calendar
- IPO readiness: 28-item checklist (legal/financial/SOX/governance/insurance),
  blocker tracking, milestone timeline, category progress, key contacts
- Finance: fee revenue, settlement queue, breakage tracking
- Disputes: case management with SLA countdown, chain evidence
- Analytics: user (DAU/MAU, cohort retention, geographic), coupon (category,
  breakage, secondary market), market-maker (TVL, spread, health, risk alerts),
  consumer-protection (complaints, CSAT, fund utilization, non-compliant issuers)
- Insurance: consumer protection fund, claims, IPO checklist overview
- Chain monitor: smart contract status, blockchain metrics
- Reports: platform-wide report center
- AI Agent panel: session stats, top questions, module accuracy
- Merchant redemption: stats, store ranking, real-time feed
- Design tokens: CSS custom properties (colors, typography, spacing, shadows)
- i18n: zh-CN, en-US, ja-JP

## miniapp/ (Taro Mini Program + H5) — 15 files
- Pages: home, detail, purchase, orders, my-coupons, login, redeem, profile
- H5 pages: h5-share, h5-activity (countdown, featured coupons),
  h5-register (benefits, phone/SMS form, WeChat login)
- Components: coupon-card, ai-guide (recommendation bar + purchase bubble),
  share-card (brand header, QR code, coupon info)
- i18n: zh-CN, en-US, ja-JP

## Design System
- Primary: #6C5CE7 (innovation purple), Material 3 style
- Consistent design tokens across all platforms
- Zero blockchain terminology — "我的券" not "NFT", "订单号" not "TX Hash"
- Utility Track MVP only; Securities Track reserved as "coming soon"

## Not included (by design)
- Data/Domain layers (API, state management, business logic) — UI prototypes only
- Securities Track full UI — MVP focuses on Utility Track
- P2 "求购" (want-to-buy) feature — marked as optional

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:16:44 -08:00
hailin 03e5f5b3e3 v2.0: Supplement all guides to achieve 100% SRS coverage
Comprehensive additions across all 7 guide files (+2,439 lines):

- 05-Backend: fee calculation (Maker-Taker), Breakage processing,
  refund mechanism, market maker system, three-factor pricing engine,
  AI/ML models (LightGBM/LSTM/IsolationForest), AML detection rules,
  OFAC sync service, Travel Rule (TRISA), tax compliance (1099/FATCA),
  CCPA/GDPR data deletion, security incident response (P0-P3),
  disaster recovery (RPO/RTO), mapping table security (MPC+audit+anchor),
  multi-currency, fiat hot-standby, chain reconciliation, capacity
  planning, SDK development plan, dispute handling, customer service

- 06-Blockchain: GNX token economics, non-transferable coupon revert,
  differentiated KYC checks, validator-level OFAC/structuring/TravelRule
  interception, batch transfer, Treasury guarantee fund locking,
  contract upgrade rollback, multi-stablecoin (USDC+USDT), Oracle
  integration, asset securitization contract reserve

- 01-Flutter Mobile: Pro mode (seed phrase, social recovery, AA wallet),
  MetaMask integration, external wallet extraction, transfer history,
  balance/deposit/withdraw, order history, phone number change,
  offline redemption limits/conflicts, dispute/complaint, notifications

- 02-Flutter Admin: guarantee fund/frozen sales, reconciliation reports,
  secondary market analysis, financing effect analysis, refund window
  config, batch operations, coupon recall, multi-store hierarchy,
  dedicated customer service channel

- 03-Web Admin: user behavior analytics, coupon category analysis,
  1099 tax reports, FATCA, false advertising monitoring, SOX audit
  module, fee/revenue dashboard, settlement management, dispute
  arbitration, web merchant redemption console, market maker monitoring

- 00-UI Design: Utility/Securities Track UI isolation design

- 04-Mini Program: multi-language i18n (zh-CN/en-US/ja-JP),
  multi-currency display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 17:39:05 -08:00
hailin a0d2271cd5 Add comprehensive development guides for all platform components
- 00-UI设计需求 v1.1: AI Agent deep integration specs
- 01-Flutter移动端: Consumer + Merchant App (Riverpod + Clean Architecture)
- 02-Flutter管理后台: Issuer Console App (credit scoring, template-based issuance)
- 03-Web管理前端: Admin Dashboard (React + Next.js + Zustand + RTK)
- 04-小程序H5: Mini-program + H5 (Taro 3.x cross-platform)
- 05-后端: Backend services (NestJS + Go + DDD + Kong + PostgreSQL)
- 06-区块链: Genex Chain + 7-contract system (Cosmos SDK + cosmos/evm + Solidity)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 23:23:26 -08:00
hailin aa449d6bd3 Rewrite architecture and software dev docs based on SRS v4.1
Both documents completely rewritten to align with the v4.1 SRS:
- Architecture doc (v3.0): Genex Chain (Cosmos SDK + cosmos/evm),
  7-contract system, UX translation layer, three-tier asset control,
  GCFN global nodes, credit/pricing models, security IR, deployment
- Software dev doc (v2.0): Concise development requirements overview,
  all modules aligned with SRS including coupon type firewall, OFAC,
  Travel Rule, offline redemption, issuer configurable rules

Replaces deprecated Hyperledger Fabric / DPoA architecture with
Genex Chain / CometBFT throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 22:31:55 -08:00
hailin c822e4c14b v4.1: Reverse-supplement from architecture/dev docs
Add credit scoring formula with weights (3.5.1), three-factor
pricing model + AI-assisted pricing engine (3.3.4), issuer tier
incentive system (3.9), AI/ML tech stack selection (4.2), SDK
support plan with rate limits (3.10.1), GCFN global clearing
node architecture (5.2), capacity planning and matching latency
metrics (8.4-8.5).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 22:23:42 -08:00
hailin 99e3c65382 Add comprehensive SRS evaluation report (v3.3→v4.0)
Full evaluation covering: completeness, compliance, convenience,
social contribution, security, and technical integrity across
8 iterations with 30+ issues tracked to resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:57:57 -08:00
hailin 967d7d62c9 v4.0: Final 4 refinements for complete coverage
- Merchant POS integration: scan/input/online redemption, offline capability, multi-store management (3.10.4)
- Issuer-configurable rules: transferability, resale limits, audience targeting, per-person limits, store restrictions (3.1.3)
- On-chain refund logic: atomic reverse swap, refund windows, non-refundable states, abuse prevention (3.4.2)
- KPI system expanded to 4 categories / 25 metrics: business, UX, security/compliance, infrastructure (8.1-8.4)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:26:20 -08:00
hailin 7a247c3a62 v3.9: Complete 6 remaining gaps for near-perfect coverage
- GNX token securities analysis with Howey Test (1.7)
- Smart contract upgrade strategy: Transparent Proxy + multisig + timelock (4.3.6)
- Security incident response plan: P0-P3 grading, emergency freeze, bug bounty (4.4.2)
- Privacy deletion rights vs blockchain immutability resolution (3.7.3)
- Critical third-party dependencies with backup options (4.7)
- Issuer B-end Web2 UX: template-based coupon creation, no blockchain knowledge needed (3.10.3)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:14:33 -08:00
hailin 9d0b499494 v3.8: Asset withdrawal, mapping security, terminology cleanup
- Three-tier asset control model: Standard / Withdraw to external wallet / Pro (3.4.1)
- Users can withdraw coupons to any EVM wallet, platform becomes irrelevant
- MPC-signed phone→address mapping table with hash anchoring on-chain (4.6.2)
- CARD Act vs Utility Track validity conflict noted with resolution path (3.7.1)
- Fix legacy terminology: 方案A/B → 标准模式/Pro模式

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:03:39 -08:00
hailin 1ca83e1bb1 v3.7: Web2 UX + Web3 infrastructure redesign
- Platform custody as default (3.4.1): MPC wallet auto-created on registration
- Phone/email registration first (3.6): no wallet concepts for users
- UX architecture layer (4.6): User Layer → Translation Layer → Infrastructure Layer
- Terminology mapping (9.2): all blockchain terms translated to user-friendly language
- MVP updated: phone registration, UX translation layer, phone-based P2P transfer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 20:46:43 -08:00
hailin 15519b1670 v3.6: Coupon type firewall, P2P compliance routing, MVP Utility Track only
- Add section 1.6: Coupon Type Firewall (Utility/Securities dual-track)
  - Utility Track: resale price capped at face value (no profit = not security)
  - Securities Track: full SEC compliance (Reg D/A+/CF, Broker-Dealer)
  - Smart contract enforced: price cap, transfer count limit, type immutable
- Rewrite 4.3.4: P2P compliance routing architecture
  - <$3,000: free transfer, chain-level monitoring with structuring detection
  - >=$3,000: Compliance contract routing, Travel Rule enforced at validator level
  - Identity hash on-chain, plaintext off-chain (privacy preserved)
  - Redemption (consumption) not affected - platform still doesn't intervene
- Update MVP Phase 1: Utility Track only, avoid SEC securities compliance
- Update Phase 4: Securities Track after legal opinion + Broker-Dealer registration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 20:21:46 -08:00
hailin abcf1d9ab3 v3.5: Genex Chain architecture - Cosmos SDK + cosmos/evm, ref Cronos/dYdX v4
- Replace Kava reference with Cronos (architecture) + dYdX v4 (trading)
- Replace deprecated Ethermint with official cosmos/evm (Apache 2.0, 2025.3)
- Block time target: <=1s (Cronos validated), Block-STM parallel execution
- Off-chain orderbook + on-chain settlement (dYdX v4 pattern)
- Add Compliance and Governance smart contracts
- Platform subsidizes all gas fees in early stage
- Chain-level compliance: OFAC filtering, Travel Rule, emergency freeze

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 20:06:57 -08:00
hailin bbb52221bb v3.4: Complete 9 missing areas from comprehensive review
- OFAC sanctions screening (SDN list, real-time transaction screening)
- FATF Travel Rule (P2P transfers ≥$3000 via platform contract routing)
- Consumer protection laws (FTC Act, Dodd-Frank UDAAP, CARD Act)
- Gas fee strategy (Paymaster/ERC-4337, platform subsidizes user gas)
- Wallet loss recovery (MPC wallet, social recovery, AA wallet/ERC-4337)
- Market maker incentive mechanism (Maker-Taker model, liquidity mining)
- Disaster recovery & business continuity (RPO<1min, RTO<15min, multi-region)
- Blockchain selection criteria (gas cost, speed, EVM, regulatory friendliness)
- Commercial insurance requirements (D&O, E&O, Cyber, Fidelity Bond)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:55:37 -08:00
hailin 10cc21fed7 v3.3: SEC securities analysis, US regulatory compliance, Nasdaq IPO preparation
- Add section 1.5: Howey Test securities risk analysis, SEC Project Crypto taxonomy
- Update section 3.7: FinCEN/BSA, SEC registration, GENIUS Act, state MTLs, tax/privacy compliance
- Add chapter 6: Nasdaq IPO preparation (SOX, FASB, listing standards, post-IPO compliance)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:05:44 -08:00
hailin f22a5ffedf v3.2: Add AML, KYC tiers, dispute handling, business model, open platform
- KYC now mandatory with 4 tiers (L0-L3), no trading without KYC
- AML anti-money laundering: 4 identified laundering paths with countermeasures
- P2P transfer monitoring, related-party detection, transaction graph analysis
- Dispute resolution module: trade disputes, issuer default, coupon recall
- Platform business model: 5 revenue streams
- Open platform: API/SDK, developer sandbox
- Internationalization: multi-language, multi-currency
- Issuer management console
- MVP Phase 1 now includes KYC and AML from day one

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:54:10 -08:00
hailin 39234c2d10 Replace deposit model with credit-growth zero-deposit mechanism
- Zero deposit to onboard, start with low issuance quota
- Credit rating drives quota dynamically
- Deposit and sales freeze become optional (voluntary, boosts credit)
- Violation triggers: downgrade, quota cut, suspension, freeze

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:46:04 -08:00
hailin 7874000eed Add dual custody model: Plan B (default self-custody) + Plan A (managed)
- Default: users hold coupons in own wallet, platform only custodies fiat
- Plan A: enterprise signs service agreement for platform-managed custody
- Clear comparison table for both modes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:38:49 -08:00
hailin bff939b343 Add 3-tier guarantee mechanism, clarify fund custody model
- Three parallel guarantee modes: deposit, sales freeze, credit transparency
- Platform only custodies fiat; coupons stay in user wallets
- Renumber 3.1 subsections

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:37:14 -08:00
hailin d7699bae35 v3.1: Blockchain as infrastructure, not full decentralization
- Blockchain is infrastructure, platform provides centralized services on top
- Key innovation: smart contract settlement protects enterprise customer data
- Platform does NOT access consumer data during coupon redemption
- Clear separation: decentralized (issuance, P2P, settlement) vs centralized (review, rating, compliance)
- Fix secondary market: all holders can trade, not just consumers
- Fix KPI: instant on-chain confirmation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 18:58:40 -08:00
hailin f59997b017 v3.0: Blockchain-native rewrite, remove all centralized concepts
- Replace Token with 数字券/链上资产
- Smart contract atomic swap for trading
- On-chain verification (no platform verification needed)
- Wallet-centric user system
- On-chain settlement (instant, no T+N)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:39:30 -08:00
hailin 187b090491 Fix consumer value proposition: instant payment like cash/credit card
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:33:02 -08:00
hailin 0075d86472 Emphasize trading as core platform function
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:26:32 -08:00
hailin ce87f108e4 Replace '企业' with '发行方' throughout document
- 发行方 includes 企业、政府、机构
- Update all sections: 入驻、发行、数据分析、一级市场、清算、智能合约、MVP
- Version v2.2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:22:23 -08:00
hailin c2164d8b43 Add blockchain-native architecture as core technical advantage
- Add section 1.2: Core technical advantage with traditional vs Genex comparison
- Add first mover market positioning
- Add section 4.3: Blockchain core architecture (token standard, smart contracts, P2P)
- Move blockchain from future extension to core requirement
- Update version to v2.1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:14:39 -08:00
hailin 19e007b443 Add project documentation 2026-01-28 17:44:13 -08:00