Cosmos is a parallel network with individual chains powered by consensus protocols like Tendermint. Within the Cosmos ecosystem, these independent "zones" can communicate, trade, and interoperate with each other. Cosmos envisions a future where the barriers between blockchains are broken down, creating a "blockchain internet" that becomes the preferred platform for a wide range of real-world use cases.
This vision is backed by a suite of system tools developed by Cosmos, including Tendermint, Cosmos SDK, IBC, and communication between Hubs and Zones facilitated by the IBC protocol. Go-Ethereum, employed by Ethereum, falls within the scope of a monolithic technology stack. Tendermint, established in 2014, emerged as an early solution addressing upgrade challenges and customization enhancements for Ethereum. Tendermint BFT offers a solution by packaging the network and consensus layers of a blockchain, allowing developers to focus solely on the application layer without needing to delve into underlying protocols. This developer-friendly design might seem unremarkable in the current landscape of proliferating public chains, but considering its inception in late 2014 highlights the foresight of Cosmos.
Furthermore, a significant advantage of the Tendermint consensus algorithm is its secure and simplified lightweight client, making it an ideal tool for mobile and IoT applications. The Tendermint lightweight client simply needs to keep up with changes in the validator set and then verify the +⅔ pre-committed transactions in the latest block to determine the current state. In essence, cross-chain functionality is not the sole focus of Cosmos; the Tendermint technology also prioritizes streamlining development time. The properties of Tendermint BFT are applicable to both public and private chains. Tendermint BFT exclusively handles the network and consensus layers of the blockchain, where nodes propagate transactions and validators reach consensus on a set of transactions to append to the blockchain, capable of processing thousands of transactions per second.
COSMOS is built upon Tendermints BPOS+PBFT consensus mechanism. This mechanism involves validators and proposers. PBFT is utilized to confirm the validity of blocks, and the amount of staked tokens determines the weight of a validators vote, signifying power within the process. BPOS is employed to allocate power to validators. The proposer for each round is selected sequentially from the list of validators, based on their voting proportion. Tendermint employs a Practical Byzantine Fault Tolerance (PBFT) algorithm, where a decision is reached by a two-thirds majority of votes.
一、Cosmos SDK
图1 Cosmos SDK功能
Building upon Tendermint BFT, the SDK further minimizes the development cycle for third-party developers. First, it enables developers to port any existing blockchain codebase to Golang, with Ethermint specifically targeting the Ethereum network. All existing tools (Truffle, Metamask, etc.) are compatible with Ethermint, allowing seamless migration of smart contracts without additional effort. The Cosmos SDK is based on two core principles that further standardize its framework:
• Modularity: The Tendermint team has constructed fundamental modules essential for the Cosmos Hub. These modules can be utilized by any developer building their own applications, and they can also create modules for the Cosmos SDK.
• Security Boundaries: Enforces security boundaries between modules, empowering developers to better manage module composability while concurrently limiting the scope of malicious or accidental interactions.
Comprehensive details about the Cosmos SDK can be found on its official website, which provides libraries for building command-line interfaces (CLIs), REST servers, and various other commonly used utilities.
二、IBC
Within the Cosmos network, connections between blockchains are established using the Inter-Blockchain Communication (IBC) protocol. Leveraging Tendermint consensus, IBC allows heterogeneous chains to transfer value (i.e., tokens) or data to each other. Heterogeneous chains are characterized by distinct layers, with each blockchain maintained by a set of validators known as miners. They differ in their consensus, application layers, and network structure. To achieve IBC compatibility, they need to adhere to certain requirements at the consensus layer. IBC empowers heterogeneous blockchains to exchange tokens and data between each other, meaning blockchains with different applications and validator sets can interoperate.
When an account on chain A intends to send 10 tokens to chain B, the system continuously tracks the process. Each chain is allowed to track the validator set of the other chain, and each chain runs a lightweight client of the other chain. When initiating an IBC transfer, two crucial pieces of information within the IBC protocol are the IBCBlockCommitTx and the IBCPacketTx. The former records the latest block information of the senders chain, while the latter encompasses the details of the cross-chain transaction itself. Upon execution, it is included in the outgoing queue by mentioning the cross-chain instruction. The transaction information is then retrieved from the outgoing queue and submitted to the Hub, where it undergoes subsequent steps to facilitate the cross-chain transaction. During this process, ATOM is locked (bonded) on chain A, and evidence of the 10 ATOM is forwarded from chain A to chain B. Validation of the evidence against chain A is performed on chain B. If deemed valid, 10 ATOM credentials are created on chain B. The ATOM created on chain B are not genuine ATOM. A similar mechanism is employed when the ATOM returns to its original chain for unlocking.
The design principle of IBC involves directly connecting each blockchain in the network, creating a chain-like structure. However, this approach can lead to uncontrollable quadratic growth. To address this issue, Cosmos introduces a modular architecture, categorizing blockchains in the network into two types: Hubs and Zones. Hubs serve as specialized entities for connecting Zones. When a Zone establishes an IBC connection with a Hub, it automatically gains access (i.e., sending and receiving) to every other Zone connected to the same Hub. Consequently, each Zone only needs to establish a limited number of connections with a restricted set of Hubs. This architecture also prevents double-spending within Zones. All token transfers within a Zone are routed through the Cosmos Hub, where the Hub maintains a record of the total token holdings of each Zone and ensures their isolation. Additionally, it encompasses the User Datagram Protocol (UDP), the Transmission Control Protocol (TCP), and other foundational protocols. The Hub and each Zone remain synchronized in terms of state changes by exchanging information through the publication of Merkle-proofs to confirm the transmission or reception of specific data.
Cosmos will offer robust vertical scalability upon its release. After completing the IBC module, horizontal scalability solutions will be implemented. The first Hub launched within the Cosmos Network is the Cosmos Hub, with its associated token being ATOM. Validators in Cosmos are analogous to miners who provide computing power. Non-validators delegate their ATOM stake tokens for voting purposes. This mechanism ensures the distribution of ATOM rewards to validators, and a specific system is in place to penalize and weaken validators in case of attacks or malicious behaviour.
三、Cosmos可解决的区块链问题
1、Scalability
Proof-of-work protocols are slow, expensive, unscalable, and environmentally harmful.
Tendermint BFT addresses this issue.
Tendermint BFT is a Byzantine Fault Tolerance consensus engine that powers Cosmos Proof-of-Stake consensus.
2、Ease of Use
Blockchain applications are complex and difficult for developers to understand.
The Cosmos SDK fixes this problem.
The Cosmos SDK is a modular framework for building interoperable, application-specific blockchains.
3、Interoperability
Blockchain economies are isolated, unable to transfer assets between each other.
The IBC protocol solves this issue.
Inter-Blockchain Communication (IBC) is a blockchain messaging protocol analogous to TCP/IP.
四、主要特点和里程碑
Tendermint Core: "Tendermint Core" is a readily available blockchain engine equipped with Cosmos practical Byzantine Fault Tolerance consensus protocol. The core can be used to build both public and private blockchains. The consensus mechanism provides instant settlement and security; security is prioritized above all else, followed by network activity.
Cosmos SDK: As a convenience toolkit, the Cosmos SDK