代码生成
Buf — 将.proto 文件编译为 Go 类型、gRPC 存根和 REST gateway 代码。在 Cosmos 项目中运行 proto-gen 的标准方式。它还可用于检查和格式化 proto 文件,并将生成的文档发布到 Buf registry。参见 Buf registry 上的 Protobuf Documentation。
Protobuf Annotations — Cosmos SDK 特定的 proto 字段选项(标量描述符、amino 名称、查询分页等),会影响代码生成结果。在为新模块编写 .proto 文件时请参考此文档。
AutoCLI — 直接根据 proto 定义为模块的消息和查询生成 CLI 命令与 gRPC-gateway 路由。应优先使用它,而不是手写 CLI 命令;它还会处理分页、输出格式化和自定义标志映射。
客户端库
CosmJS — 官方 JavaScript 与 TypeScript 库,用于构建与 Cosmos 链交互的客户端、前端和脚本。可在浏览器和 Node.js 环境中处理交易签名、广播、查询以及钱包集成。状态管理
Collections — 对原始KVStore 访问的类型化抽象。负责处理键编码、前缀隔离、迭代和二级索引。还会生成一个 schema,供 simulation decoder 自动使用。对于所有新模块状态,都应使用它而不是原始字节键。
Store — SDK 存储层的参考文档:KVStore、CommitMultiStore、CacheKVStore、IAVL、裁剪策略以及存储版本控制。当你需要理解 collections 抽象之下的实际行为,或需要直接操作 store 时,请阅读此文档。
测试
Testing — SDK 的测试约定:用于 keeper 和 message server 的单元测试、通过depinject 连接的集成测试,以及使用 testnet 包的端到端测试。
Module Simulation — 一个模糊测试框架,会使用随机输入和创世状态运行模块消息。用于检查 panic、非确定性以及 import/export 不一致问题。可帮助发现单元测试遗漏的边界情况。
节点设置与运维
Prerequisites — 运行节点前所需的软件和环境配置。 Run a Node — 如何初始化链、配置创世文件,并使用simd 启动节点。
Run a Testnet — 如何使用 simd testnet 运行本地多节点测试网。
Production Deployment — 在生产环境运行节点的加固与部署指南:包括 systemd、状态同步、备份策略和安全注意事项。
Cosmovisor — 链二进制文件的进程管理器,会监控链上升级提案,并在正确的升级高度自动切换到新二进制文件。它是生产环境实现零停机升级的必需工具。
Confix — 一个 CLI 工具,用于在不同 SDK 版本之间读取、设置、迁移和比较 app.toml 与 client.toml 配置文件。升级节点的 SDK 版本或编写配置变更脚本时应使用它。
密钥与交易
Keyring — SDK 的密钥管理层。涵盖 keyring 后端(os、file、test、memory)、密钥类型,以及如何通过 simd keys 管理密钥。可用来理解生产部署中密钥存储的安全权衡。
Building Transactions — 如何使用 SDK 的 TxBuilder 和 TxConfig API,以编程方式构建、签名、编码并广播交易。
Interacting with a Node — 如何使用 CLI 和 gRPC 对运行中的节点进行状态查询与交易广播。
可观测性
Telemetry — 面向 SDK 及你的模块的基于 OpenTelemetry 的指标能力。可从 keeper 方法中输出计数器、仪表和直方图,并可集成 Prometheus 以及任何兼容 OTLP 的后端。 Logging — 通过cosmossdk.io/log 提供结构化日志能力(底层基于 zerolog)。可在 keeper 和 server 中输出结构化日志行,并支持日志关联与 OpenTelemetry 日志导出。
IBC
IBC Go — Cosmos SDK 链的标准 IBC 实现。可用于为你的链添加跨链代币转移和任意消息传递能力。A practical reference for Cosmos chain and module developers: what each tool does and when to reach for it.
Code generation
Buf — Compiles.proto files into Go types, gRPC stubs, and REST gateway code. The standard way to run proto-gen in a Cosmos project. Also lints and formats proto files, and publishes generated docs to the Buf registry. See the Protobuf Documentation on the Buf registry.
Protobuf Annotations — Cosmos SDK-specific proto field options (scalar descriptors, amino names, query pagination, etc.) that affect code generation output. Consult this when writing .proto files for a new module.
AutoCLI — Generates CLI commands and gRPC-gateway routes for your module’s messages and queries directly from proto definitions. Use it instead of hand-writing CLI commands — it also handles pagination, output formatting, and custom flag mappings.
Client library
CosmJS — The official JavaScript and TypeScript library for building clients, frontends, and scripts that interact with Cosmos chains. Handles transaction signing, broadcasting, querying, and wallet integration in browser and Node.js environments.State management
Collections — A typed abstraction over rawKVStore access. Handles key encoding, prefix isolation, iteration, and secondary indexes. Also produces a schema used automatically by simulation decoders. Use it for all new module state instead of raw byte keys.
Store — Reference documentation for the SDK store layer: KVStore, CommitMultiStore, CacheKVStore, IAVL, pruning strategies, and store versioning. Read this when you need to understand what is happening under the collections abstraction or need to work with stores directly.
Testing
Testing — The SDK’s testing conventions: unit tests for keepers and message servers, integration tests wired withdepinject, and end-to-end tests using the testnet package.
Module Simulation — A fuzz-testing framework that runs your module’s messages with randomized inputs and genesis states. Checks for panics, non-determinism, and import/export inconsistencies. Use it to catch edge cases that unit tests miss.
Node setup and operations
Prerequisites — Required software and environment setup before running a node. Run a Node — How to initialize a chain, configure genesis, and start a node withsimd.
Run a Testnet — Running a local multi-node testnet using simd testnet.
Production Deployment — Hardening and deployment guidance for running a node in production: systemd, state sync, backup strategies, and security considerations.
Cosmovisor — A process manager for your chain binary that watches for on-chain upgrade proposals and automatically swaps in the new binary at the correct upgrade height. Required for zero-downtime upgrades in production.
Confix — A CLI tool for reading, setting, migrating, and diffing app.toml and client.toml configuration files across SDK versions. Use it when upgrading a node between SDK versions or scripting config changes.
Keys and transactions
Keyring — The SDK’s key management layer. Covers keyring backends (os, file, test, memory), key types, and how to manage keys via simd keys. Use this to understand key storage security trade-offs in production deployments.
Building Transactions — How to programmatically construct, sign, encode, and broadcast transactions using the SDK’s TxBuilder and TxConfig APIs.
Interacting with a Node — Using the CLI and gRPC to query state and broadcast transactions against a running node.
Observability
Telemetry — OpenTelemetry-based metrics for the SDK and your modules. Emit counters, gauges, and histograms from keeper methods. Integrates with Prometheus and any OTLP-compatible backend. Logging — Structured logging viacosmossdk.io/log (backed by zerolog). Use it in keepers and servers to emit structured log lines, with support for log correlation and OpenTelemetry log export.