Cosmos SDK 的定位
从核心上看,Cosmos SDK 的目标是为开发者在整个区块链技术栈上提供完全的灵活性。业务逻辑既可以原生运行在协议层,也可以通过模块化组件对外暴露,或根据应用需求通过可选的虚拟机层进行扩展。 Cosmos SDK 在设计上即具备互操作性。使用 SDK 构建的链可以通过 IBC 与其他区块链通信,同时保持独立执行与独立安全性。Cosmos SDK 的模块化
可互操作的模块
使用 Cosmos SDK 构建的区块链由一组可互操作的模块组成,每个模块负责特定功能,例如账户、交易、治理、代币化或合规逻辑。这些模块构建在 SDK 基础应用框架之上,该框架提供共享的执行环境,使各模块能够协同工作,形成一条完整的区块链。 Cosmos SDK 为工程师提供了一组健全的预定义模块,覆盖共识、账户、转账、治理权限控制、费用分配等标准区块链特性。此外,工程师还可以根据应用需求构建自己的模块。通过组合与扩展模块,开发者可以构建在性能、安全性和长期可维护性方面都得到优化的区块链和账本。 SDK 的基础层负责处理诸如消息路由、模块生命周期编排,以及与底层共识引擎交互等核心问题。它通过将模块状态隔离到独立存储中,定义了模块之间清晰的边界,同时提供安全且定义明确的跨模块通信接口。这种结构使模块能够独立运行和演进,同时保持整体系统的一致性。Cosmos SDK 与 Cosmos 技术栈的模块化
SDK 模块定义了链内应用逻辑的组合方式,而 Cosmos SDK 同时也支持组件层级的模块化。共识、网络和数据可用性由 CometBFT 等外部组件提供,执行逻辑则由 SDK 模块定义。 我们推荐使用 CometBFT 来构建基于 Cosmos SDK 的区块链,因为它能够提供同类领先的性能,以及开箱即用的组件间互操作性。或者,工程师也可以根据性能和安全需求,将 Cosmos SDK 与其他共识引擎,或模块化执行与结算架构进行组合。这种灵活性使账本链能够随着应用和运维需求一同演进。应用专用区块链
区块链生态中的一种常见开发范式,是使用通用型虚拟机链,在共享执行环境之上以智能合约形式部署应用。虽然这种方式适合某些用例,但它会在性能、可定制性以及协议层控制能力方面带来限制,从而影响组织的基础设施成本,以及安全与合规特征。 应用专用区块链提供了另一种模式。应用专用区块链是指在协议层或链层运行自定义业务逻辑,以实现特定业务场景的区块链或数字账本。借助 Cosmos SDK,开发者可以直接在协议层定制执行逻辑、费用模型、治理规则和状态转换,从而获得更高的灵活性与性能。虚拟机层
Cosmos SDK 支持使用智能合约。开发者可以通过添加虚拟机层来获得智能合约支持。Cosmos EVM 支持与以太坊兼容的智能合约和工具链,工程师也可以选择其他虚拟机。通过对象能力模型实现安全性
Cosmos SDK 使用基于能力的安全模型,在模块之间强制实施严格边界。它不会授予模块对共享状态的广泛访问权限,而是只赋予模块完成自身职责所需的特定能力,从而更容易分析权限边界、访问授权以及潜在攻击面。 这种设计提升了复杂区块链应用的安全性与可组合性。若要深入了解该模型,请参阅对象能力模型。Cosmos Enterprise
Cosmos 企业级解决方案为你提供一整套全面的区块链服务与技术,帮助你的组织面向未来构建数字账本能力。它结合了加固过的协议模块、本地部署与托管式基础设施组件,以及来自 Cosmos 技术栈构建工程师的主动支持。 Cosmos Enterprise 专为那些在企业级生产环境中扩展关键区块链基础设施时,需要可靠性、安全性和运维信心的组织而构建。 了解 Cosmos Enterprise →为什么使用 Cosmos SDK 构建
Cosmos SDK 是构建自定义、模块化区块链最成熟、采用最广泛的框架之一。其主要优势包括:- 已在生产环境中验证:如今已有 200 多条区块链在生产环境中使用 Cosmos SDK,覆盖银行间网络、受监管借贷、银行资产代币化等场景。
- 强大的安全基础:基于能力的安全模型,建立在多年的生产实践经验之上。
- 协议层级的可定制性:直接在区块链中定义应用逻辑、治理和经济模型,而不仅限于智能合约。
- 内置互操作性:通过 IBC 提供原生互操作能力,并支持可扩展的链级集成。
- 灵活的执行模型:可将原生模块与可选虚拟机层结合使用,例如 Cosmos EVM。
开始使用 Cosmos SDK
- 了解 Cosmos SDK 应用架构
- 通过 Cosmos SDK 节点教程 在 5 分钟内运行一条区块链
The Cosmos SDK is a secure, open-source framework for building application-specific blockchains and digital ledgers. It gives engineers full control over access control, security, business logic, and governance, while providing a robust set of pre-built modules covering common blockchain functionality. Organizations can use the Cosmos SDK to easily build and maintain any type of blockchain network, including private permissioned networks, public networks, and consortia. Cosmos SDK blockchains are natively interoperable through IBC. As the business logic layer of the Cosmos stack, the Cosmos SDK provides a fully customizable foundation for building blockchains from customizable modules that define how a chain behaves, from accounts and transactions to tokenization, compliance, and custom application logic. Development on the Cosmos SDK has been continuous since 2016. Today, companies in banking and finance, SaaS, AI, and other industries use the Cosmos SDK’s open-source codebase with proven consensus via CometBFT and native interoperability through IBC for business use cases like interbank networks, asset tokenization, and business automation. It offers fast performance of 10,000+ transactions per second, strong security, and resiliency in production.
Purpose of the Cosmos SDK
At its core, the Cosmos SDK is designed to give developers full flexibility across the entire blockchain stack. Business logic can run natively at the protocol level, be exposed through modular components, or be extended with optional virtual machine layers, depending on the needs of the application. The Cosmos SDK is interoperable by design. Chains built with the SDK can communicate with other blockchains via IBC while maintaining independent execution and security.Modularity of the Cosmos SDK
Interoperable Modules
Blockchains built with the Cosmos SDK are composed of interoperable modules, each responsible for a specific function, such as accounts, transactions, governance, tokenization, or compliance logic. These modules are built on top of the SDK’s base application framework, which provides the shared execution environment that allows modules to operate together as a cohesive blockchain. The Cosmos SDK offers engineers a robust set of predefined modules that cover standard blockchain features, such as consensus, accounts, transfers, governance permissioning, fee distribution, and more. In addition, engineers can build their own modules tailored to their application’s requirements. By composing and extending modules, developers can build blockchains and ledgers that are optimized for performance, security, and long-term maintainability. The SDK’s base layer handles core concerns such as message routing, module lifecycle orchestration, and interaction with the underlying consensus engine. It defines clear boundaries between modules by isolating their state into independent stores, while providing secure, well-defined interfaces for cross-module communication. This structure allows modules to operate and evolve independently while preserving the overall system.Cosmos SDK and the modularity of the Cosmos stack
While SDK modules define how application logic is composed within a chain, the Cosmos SDK also supports modularity at the component level. Consensus, networking, and data availability are provided by external components like CometBFT. Execution logic is defined by SDK modules. We recommend building Cosmos SDK-based blockchains using CometBFT for consensus because it offers best-in-class performance and out-of-the-box interoperability between components. Alternatively, engineers can pair the Cosmos SDK with other consensus engines like modular execution and settlement architectures depending on their performance and security requirements. This flexibility allows ledger chains to evolve alongside their application and operational needs.Application-Specific Blockchains
A common development paradigm in blockchain ecosystems is the use of general-purpose virtual machine chains, where applications are deployed as smart contracts on top of a shared execution environment. While this approach is well suited for some use cases, it imposes constraints around performance, customization, and protocol-level control, which impact an organization’s infrastructure costs and security and compliance profile. Application-specific blockchains offer a different model. An application-specific blockchain is a blockchain or digital ledger that runs custom business logic at the protocol or chain level to accomplish a particular business use case. With the Cosmos SDK, developers can tailor execution logic, fee models, governance rules, and state transitions directly at the protocol level, enabling greater flexibility and performance.Virtual Machine Layers
The Cosmos SDK allows for the use of smart contracts. Developers can add a virtual machine layer to add smart contract support. The Cosmos EVM supports Ethereum-compatible smart contracts and tooling. Engineers can also choose other VMs.Security via the Object-Capability Model
The Cosmos SDK uses a capabilities-based security model to enforce strict boundaries between modules. Rather than granting broad access to shared state, modules are given only the specific capabilities they require, making it easier to reason about authority, permissions, and potential attack surfaces. This design improves the security and composability of complex blockchain applications. For a deeper dive into this model, see the Object-Capability Model.Cosmos Enterprise
Cosmos enterprise solutions give you a comprehensive suite of blockchain services and technology to future-proof your organization’s digital ledger capabilities. It combines hardened protocol modules, on-premises and managed infrastructure components, and proactive support from the engineers building the Cosmos technology stack. Cosmos Enterprise is built for organizations that require reliability, security, and operational confidence as they scale critical blockchain infrastructure in enterprise production environments. Learn about Cosmos Enterprise →Why Build with the Cosmos SDK
The Cosmos SDK is one of the most mature and widely adopted frameworks for building custom, modular blockchains. Key advantages include:- Proven in production: 200+ blockchains use the Cosmos SDK in production today for use cases such as interbank networks, regulated lending, and banking asset tokenization.
- Strong security foundations: Capabilities-based security informed by years of production experience.
- Protocol-level customization: Define application logic, governance, and economic models directly in the blockchain, not just in smart contracts.
- Built-in interoperability: Native interoperability through IBC and extensible chain-level integration.
- Flexible execution models: Combine native modules with optional VM layers such as Cosmos EVM.
Getting Started with the Cosmos SDK
- Learn about the architecture of a Cosmos SDK application
- Run a blockchain in under 5 minutes with the Cosmos SDK Node Tutorial