Go to file
hailin be3555f338 fix(chain-indexer): 替换Mock为真实区块链RPC索引 — 接入Genex Chain EVM节点
## 背景
chain-indexer(:3009)此前使用Mock模式,每10秒生成假区块数据(hash为纯数字填充,
txCount固定为0),未连接任何真实区块链节点。这是整个区块链架构中唯一的功能缺口
(8大核心服务中TX Indexer完成度仅85%)。

## 改动内容

### 新增文件
- internal/domain/repository/chain_client.go
  DDD领域接口ChainClient,定义GetLatestBlockNumber/GetBlockByNumber/Close三个方法,
  遵循依赖倒置原则,应用层不依赖具体RPC实现

- internal/infrastructure/rpc/eth_client.go
  EthChainClient实现,基于go-ethereum/ethclient:
  · ethclient.Dial()连接EVM JSON-RPC节点
  · BlockByNumber()获取完整区块(hash/timestamp/txCount)
  · types.LatestSignerForChainID()恢复交易发送方地址
  · TransactionReceipt()获取交易执行状态(confirmed/failed)

### 修改文件
- go.mod: 新增github.com/ethereum/go-ethereum v1.14.8依赖

- internal/application/service/indexer_service.go
  · 注入ChainClient依赖,移除所有Mock逻辑
  · 轮询间隔10s→2s(匹配链~1s出块时间)
  · 批量追赶:每周期最多索引50个区块,快速消化落后高度
  · 新增GetChainHeight()/IsSynced()方法供API层使用
  · 区块+交易分别持久化,每条交易独立发布Kafka事件

- cmd/server/main.go
  · 新增RPC_URL环境变量(默认http://localhost:8545)
  · 初始化EthChainClient并注入IndexerService
  · /api/v1/chain/status返回真实chainHeight和syncing状态

- internal/interface/http/handler/admin_chain_handler.go
  · GetContracts: 合约列表更新为真实11个已部署合约(与genex-contracts对齐)
  · GetGasMonitor: Gas数据全部归零(Genex Chain min_gas_price=0平台补贴)
  · GetChainStats: 使用真实chainHeight计算indexerLag/tps/indexerStatus
  · chainId修正88888→8888,consensusType修正PoA→CometBFT

## 环境变量
RPC_URL=http://localhost:8545  (Docker内使用 http://genex-node-1:8545)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 18:04:18 -08:00
.claude feat: 区块链生态基础设施完整实现 — 12组件全量交付 (Phase 11) 2026-02-15 18:03:04 -08:00
backend fix(chain-indexer): 替换Mock为真实区块链RPC索引 — 接入Genex Chain EVM节点 2026-02-16 18:04:18 -08:00
blockchain feat: ERC-1155 同质化券系统 + denom统一为agnx (18位EVM标准) 2026-02-15 22:34:30 -08:00
docs feat: ERC-1155 同质化券系统 + denom统一为agnx (18位EVM标准) 2026-02-15 22:34:30 -08:00
frontend feat: 三端集成 App升级 + 内部推送 + FCM外部推送框架 (genex-mobile/admin-app/mobile) 2026-02-13 07:02:14 -08:00
.gitignore chore: Ignore Claude Code config and Flutter auto-generated files 2026-02-11 07:28:02 -08:00
README.md Update company names and structure (Inc. for West, Ltd. for Asia) 2026-01-28 00:15:01 -08:00

README.md

Global Coupon Exchange

Website: gogenex.com

Brand Naming Strategy

This project adopts a regional branding strategy, using different brand names for different markets while maintaining brand family consistency.

Brand Structure

Market Brand Abbr Description
Western (US/Europe) Genex GNX Derived from Generation + Exchange, familiar Western naming style
Asian (including China) Gensen / 券信 GS "Gensen" from Cantonese pronunciation of Chinese characters "券信"

Unified Domain

  • gogenex.com - Single global domain for all markets
  • Subdomains or paths for regional content (e.g., gogenex.com/cn, gogenex.com/asia)

Naming Logic

Genex (Western Markets)

  • Gen = Generation / Generic / Genesis
  • ex = Exchange
  • Natural pronunciation, similar to well-known Western brands like FedEx, Amex
  • Professional, modern, and trustworthy fintech image

Gensen / 券信 (Asian Markets)

  • 券 (Quan) = Coupon / Voucher
  • 信 (Xin) = Trust / Credit
  • Gensen = Romanization of Cantonese pronunciation "gyun seon"
  • Use Chinese characters "券信" in Mainland China
  • Use romanized "Gensen" in other Asian regions
  • Two characters conveying core values: coupon trading + trust guarantee

Brand Consistency

Genex    ←── "Gen-" prefix ──→  Gensen
   ↑                              ↑
   └─────── Same brand family ────┘
                   ↓
                 券信 (Chinese localization)
  • Genex and Gensen share the "Gen-" prefix, establishing brand family recognition
  • Gensen directly transliterates to 券信, providing seamless connection
  • Global users can recognize these as regional versions of the same platform

Usage Scenarios

Scenario Western Markets Asian Markets (non-China) China Market
Company Name GoGenex Inc. Gensen Asia Ltd. 券信科技有限公司
App Name Genex Gensen 券信
Domain gogenex.com gogenex.com/asia gogenex.com/cn
Social Media @gogenex @gensen_official @券信official

Note on Company Structure:

  • Inc. (Corporation) for Western markets: Better for VC funding, stock issuance, and potential IPO
  • Ltd. (Limited) for Asian markets: Common structure in Asia-Pacific region
  • Social media handles use variations to avoid conflicts with existing accounts

Due to varying financial regulations across countries, each regional brand will:

  • Operate as an independent legal entity
  • Comply with local regulatory requirements
  • Share core technology platform and philosophy
  • Establish brand association through parent company

Project Overview

Global Coupon Exchange (GCX) is a coupon asset trading platform designed to provide users with secure and convenient trading services for digital assets such as coupons, gift cards, and vouchers.

Core Features

  • Coupon asset listing and trading
  • Secure transaction matching mechanism
  • Multi-currency settlement support
  • User credit system

Tech Stack

TBD

Documentation

For detailed development documentation, please refer to the docs directory.

License

TBD