主题
fabric-token-sdk · 快速开始
TIP
完整起步在 docs/tokensdk.md、docs/token_sdk_usage.md。本章只列 Makefile 与 README 可验证的命令。
Makefile target
来源:Makefile。
| target | 行号 | 用途 |
|---|---|---|
install-tools | 32 | 装 tools/tools.go 中的开发工具 |
download-fabric | 40 | 下载 Fabric 二进制 |
unit-tests | 48 | 单元测试(带覆盖率) |
unit-tests-race | 54 | race detector |
unit-tests-regression | 60 | 回归 |
docker-images | 70 | 拉取 fabric + monitoring + testing 全部镜像 |
testing-docker-images | 74 | postgres:16.2-alpine、hashicorp/vault |
fabric-docker-images | 81 | fabric-baseos、fabric-ccenv |
monitoring-docker-images | 89 | explorer / prometheus / grafana / jaeger |
integration-tests-nft-dlog | 98 | NFT + ZKAT-DLOG |
integration-tests-nft-fabtoken | 103 | NFT + FabToken |
integration-tests-dvp-fabtoken | 108 | DVP + FabToken |
integration-tests-dvp-dlog | 113 | DVP + ZKAT-DLOG |
tidy | 119 | go mod tidy |
clean | 129 | 删构建产物 |
lint | 218 | golangci-lint |
lint-auto-fix | 224 | 自动修 lint |
fmt | 235 | gofmt |
辅助 mk 文件:checks.mk / fungible.mk / fabricx.mk / interop.mk。
构建 CLI
来源:cmd/tokengen/main.go、cmd/artifactgen/main.go。
sh
go build ./cmd/tokengen # 令牌生成与管理工具
go build ./cmd/artifactgen # 工件生成工具env 前缀:core(cmd/tokengen/main.go:21、cmd/artifactgen/main.go:19)。
tokengen 子命令(cmd/tokengen/main.go:55-59):
pp.GenCmd()—— 生成公共参数pp.UpdateCmd()—— 更新公共参数pp.UtilsCmd()—— 公共参数工具certfier.KeyPairGenCmd()—— 生成证书密钥对version.Cmd()—— 版本
artifactgen 子命令(cmd/artifactgen/main.go:48):
gen.Cmd()—— 注册的 CLI 命令名为artifacts(即artifactgen artifacts),生成工件
具体 flag [未核] —— 运行 --help。
集成测试入口
来源:integration/token/。
sh
make integration-tests-nft-dlog
make integration-tests-nft-fabtoken
make integration-tests-dvp-fabtoken
make integration-tests-dvp-dlog更多示例:
| 路径 | 内容 |
|---|---|
integration/token/fungible/fabtoken/ | FabToken 可替换令牌 |
integration/token/fungible/dlog/ | ZKAT-DLOG 可替换令牌 |
integration/token/fungible/dloghsm/ | ZKAT-DLOG HSM |
integration/token/fungible/dlogstress/ | 压力测试 |
integration/token/fungible/dlogx/ | FabricX |
integration/token/fungible/mixed/ | 混合驱动 |
integration/token/fungible/update/ | 升级 |
integration/token/nft/{fabtoken,dlog}/ | NFT |
integration/token/dvp/{fabtoken,dlog}/ | Delivery vs Payment |
integration/token/interop/{fabtoken,dlog}/ | HTLC 跨链 |
integration/nwo/ | 网络编排(基于 fabric-smart-client nwo) |