Skip to content

fabric-x · 模块详解 ​

本仓库 submodule:fabric-x/。本章引用的所有路径均为相对于该 submodule 根。

tools/ — 4 个 CLI ​

来源:Makefile:21、tools/。configtxgen / cryptogen 是薄封装,委托给 fabric-x-common;configtxlator 本仓库实现 CLI 接线(encode / decode / compute_update 包装函数,tools/configtxlator/main.go:133-242),但 REST 路由(rest.NewRouter)、config-update 计算(update.Compute)、proto 编解码(protolator)均 import 自 fabric-x-common(main.go:32-34、:124、:221);fxconfig 为本仓库完整实现(tools/fxconfig/main.go、internal/)。

工具目录关键文件
configtxgentools/configtxgen/main.go、main_test.go(委托 fabric-x-common/tools/configtxgen)
configtxlatortools/configtxlator/main.go(子命令 start / proto_encode / proto_decode / compute_update / version)
cryptogentools/cryptogen/main.go、main_test.go(委托 fabric-x-common/tools/cryptogen)
fxconfigtools/fxconfig/main.go,见下

fxconfig 子结构 ​

来源:tools/fxconfig/docs/README.md(421 行)、tools/fxconfig/。

路径用途
internal/app/命名空间 create / list / update、endorse / merge / submit、deploy、policy
internal/cli/v1/CLI 命令(namespace、tx、info、version)
internal/transaction/事务 namespace / 版本 / 背书 / 政策 / 合并
internal/config/配置加载与校验
internal/client/orderer / 查询 / 通知客户端
internal/msp/MSP 签名身份
internal/validation/验证逻辑
internal/adapters/、internal/provider/、internal/logging/适配器 / provider / 日志
integration/集成测试(single-org / multi-org)

详细命令与 flag 见 tools/fxconfig/docs/README.md。

integration/test/ — E2E 测试套件 ​

来源:integration/test/README.md、integration/test/。

项内容
build-e2e.sh构建 orderer(arma-4p1s)+ committer(committer-test-node)镜像 + 工具
run-e2e.sh完整 E2E:~10,000 TXs 负载,验证 ≥ 5,000 提交
clean.sh清理容器 / 卷 / 网络 / 工件
clean-docker.sh仅清理 Docker(容器 + 网络)
docker-compose.yamlarma + committer + loadgen + 监控栈
loadgen.yamlloadgen 配置
refs.conf组件 ref 默认值与镜像名
fxconfig-peer-org-{0,1}.yaml多组织背书配置
networkconfig/configtx.yaml / arma_config.yaml / crypto-config.yaml
ordererconfig/base.yaml.tpl + 4 个角色文件(router / assembler / batcher / consenter)
committerconfig/5 个微服务配置(sidecar / coordinator / verifier / vc / query)
prometheus/、grafana/监控配置 / 仪表板

diagrams/ ​

PNG内容
Fabric_vs_Fabric-X.png经典 Fabric vs Fabric-X 对比
Fabric-X-Orderer.pngOrderer 4 层架构
Fabric-X-Committer.pngCommitter 微服务架构

scripts/ ​

脚本用途
license-lint.sh检查 Apache-2.0 SPDX 头;忽略 json/pem/yaml/go/pbbin/png/cfg/pptx、go.sum、testdata/ 等
help_docs.sh生成 / 校验 docs/cli/ 下各 CLI 的帮助文档

Dockerfile ​

来源:Dockerfile:11-71。详见 02-architecture · 容器化构建。

Makefile target ​

来源:Makefile。

target行号
help34
tools39
generate47
test52
clean67
lint73

BUILD_DIR ?= bin(:12)、GO_TAGS ?=(:17)、MAKEFLAGS += --jobs=16(:30)。

go.mod 依赖 ​

详见 02-architecture · go.mod 关键依赖。

看代码推荐路径 ​

  1. README.md → 理解 Fabric-X 整体定位。
  2. integration/test/README.md → 了解 E2E 如何把组件串起来。
  3. tools/fxconfig/docs/README.md → 命名空间管理命令集。
  4. tools/configtxgen/main.go + tools/cryptogen/main.go → 最小工具实现。
  5. Dockerfile → 镜像产物。