SETTINGS
Content language
flag Vietnamese
Vietnamese
flag Vietnamese
Vietnamese
Tiếng việt
flag English
English
English
Channel logo
Coin98 Insights
Save
Copy link

Cosmos Stack: Cosmos SDK, Tendermint, IBC, and CosmWasm

Several L1s have been observed attempting to resolve the blockchain trilemma. They are now referred to as "Eth murderers" in popular media and may attempt to replace Ethereum with a version of their own to address these issues. However, Cosmos' strategy differs significantly from most Ethereum killers. A network where each decentralized application (dApp) runs on its own blockchain and is connected to its Cosmos Hub to form the internet of blockchain.
Avatar
trangtran.c98
Published Aug 04 2022
Updated Aug 05 2022
7 min read
thumbnail

Blockchains Architecture - Layers explained 

Blockchain is a digital ledger of all cryptocurrency transactions. It is constantly growing as "completed" blocks are added with a new set of recordings. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data.

The blockchain architecture has 3 main layers that can be understood based on the below model.

stack blockchain architecture
Blockchain Architecture

Layer 0: Nodes - Hardware and Networking Layer

Blockchain layer 0 is composed of elements that support the smooth operation of blockchain networks like Bitcoin, Ethereum, and others. The internet, hardware, and connections with thousands of nodes are layer 0 components that ensure the flawless operation of layer 1.

The users' transactions must be completed in order for the nodes, who are in charge of achieving a consensus, to proceed. Then, third-party applications like smart contracts, wallets, or decentralized apps (dApps) must communicate with the blockchains. This layer is responsible for facilitating all types of these communications.

Learn more: What is a node?

Layer 1: Consensus (Solidity, Move, Motoko) Layer

Blockchain is a distributed ledger in which the consensus procedure ensures the transactions' legitimacy and order. Network participants (miners, validators, or other names with a similar meaning) attempt to propose, validate, and pass a set of blocks containing transactions during this process. The module in charge of all consensus-related tasks is the consensus layer.

The consensus layer achieves this through :

  • Persistence
  • Consensus
  • Liveness
  • Open

Layer 2 : Applications / Smart Contracts / Layer 2 blockchain

Layer 2 solutions are the overlapping networks that are positioned above the base layer. By eliminating some interactions from the base layer, layer 2 is used by protocols to boost scalability.

Two further sub-layers that can be distinguished from the application layer are the execution layer and the application layer.

End users utilize applications to communicate with the blockchain network are found on the application layer. It consists of user interfaces, frameworks, APIs, and scripts. These applications' back-end technology is the blockchain network, and they interface with it via APIs. The execution layer includes chaincode, smart contracts, and underlying logic. 

A transaction is approved and carried out at the semantic layer even though it passes from the application layer to the execution layer. Applications direct the execution layer, which carries out commands and maintains the determinism of the blockchain.

How to develop a Blockchain

There are 4 approaches for developing blockchain projects.

Create a Fork of an Existing Blockchain

Nearly all well-known blockchains have open-source code. This implies that anyone can obtain a copy of these source codes, alter them, and then repurpose them.

For instance, Litecoin is a Bitcoin fork.

The wonderful thing about forking is that it eliminates the need for coders to start from scratch. When necessary, they can leverage already created codes and add new functionality to them. Yet, this requires a very high level of technical expertise.

Develop Smart Contracts on Existing Blockchains

Numerous blockchains are providing virtual machine-based smart contract features that make it simple to construct numerous applications, including wallets, DeFi apps, fungible and non-fungible tokens, and many other types of applications.

The infrastructure and core blockchain are not a concern for developers. They just need to concentrate on the contract's rationale. The blockchain where the code will be used will take care of the remainder (security, decentralization, etc.). The fundamental problem, though, is that the dApp created using these contracts would share the same restrictions as the parent blockchain.

The Ethereum blockchain and its smart contracts are well-known examples. Scalability problems exist with Ethereum. As a result, the transaction throughput and fees for the smart contracts used in this blockchain are very high.

Develop Blockchains From Scratch

This is arguably the most challenging decision on the list. To accomplish this, you must develop:

  • Layer 0: Nodes - Hardware and Networking Layer.
  • Layer 1: Consensus (Solidity, Move, Motoko) Layer.
  • Layer 2 : Applications/ Smart Contracts/ Layer 2 blockchain.

There are numerous technical issues for each of these levels. As a result, adopting this method to create blockchains will undoubtedly need more time and effort. This strategy can make the project independent of any outside code. As a result, the project's creators have full creative freedom to complete the design.

Use Existing APIs and SDKs

Blockchain project development can be done by developers using the available APIs and SDKs. In essence, these tools are the ready-to-use parts for programmers.

Developers do not build everything from the ground up (also known as the core blockchain). They do not rely on the security and functionality of the projects that are already in existence. As a result, this strategy combines all of their best qualities.

The most prominent ecosystem using this kind of technology is Cosmos, with some of the most successful protocols: 

  • Cosmos
  • Kava
  • Oasis Network

And some astonishing technologies: 

  • Tendermint
  • Cosmos SDK
  • IBC
  • CosmWasm

Cosmos Stack

Tendermint: Create a chain

Tendermint is open-source software for launching blockchains, allowing developers to build blockchain applications' networking and consensus layers in any language. Better yet, they can communicate with other blockchains using IBC.

cosmos tendermint

Tendermint has two main components, which are: 

  • Blockchain Consensus Engine (Tendermint Core): The Byzantine Fault Tolerance (BFT) consensus model powers the Tendermint consensus engine, referred to as Tendermint Core.
cosmos tendermint mechanism
BFT Consensus Protocol (Tendermint Core)
  • Application BlockChain Interface (ABCI): The application layer logic and the consensus engine are connected by the Application Blockchain Interface (ABCI), a collection of ready-to-use functions. Because ABCI is the central element of the networking layer, all communications and transactions must go through it.
 
cosmos tendermint abci
Flow of Messages via ABCI

Tendermint Pros

There are two main parts of Tendermint that can divide various layers of each blockchain network. From that, developers of each layer just need to concentrate on issues of their own.

Tendermint's consensus engine uses the trusted Byzantine Fault Tolerant (BFT) consensus paradigm with other features added to the mechanism to ensure its functions work flawlessly in the projects.

Tendermint Cons

The blockchain may suffer an attack if one-third of validator nodes behave maliciously in the network. This fault-tolerance rate is lower than other consensus models, such as the 51% attack in the Proof of Work (PoW) consensus model.

cosmos tendermint cons
TPS vs Block size using Tendermint Consensus

Validators must interact through several phases to obtain consensus and disseminate the transactions/blocks (prevote, pre-commit, commit). As a result, the number of validators significantly impacts the system's overall throughput. The throughput will decrease as there are more validators in the system.

Cosmos SDK: Create a dApp

The Cosmos SDK is an open-source framework for creating permissioned Proof-of-Authority (PoA) and multi-asset public Proof-of-Stake (PoS) blockchains. The Cosmos SDK allows for the creation of application-specific or private blockchains.

The Cosmos SDK enables developers to quickly build original custom blockchains that can natively communicate with other blockchains. These chains can then be connected via IBC to the larger Cosmos network.

Golang is the programming language used to create Cosmos SDK and Tendermint Core (BFT Consensus). Gaia, the initial Cosmos Hub implementation, was built using the Cosmos SDK.

Cosmos SDK Pros

Users can create a blockchain of blockchains using this method, known as inter-blockchain communication technology (IBC). Such networks can already be implemented using existing code and techniques, with just modest adjustments required.

The majority of required tasks are handled in the application logic layer by Cosmos SDK. This pertains to everything from transactions to storage, encryption, governance, tokens, wallets, balances, and more. Instead of creating something from scratch, developers can use these pre-made components in their projects.

Cosmos SDK Cons

Ethereum is one of the most widely used frameworks for creating smart contracts and dApps. There are a lot of resources online and a sizable community centered around these ERC standards. Meanwhile, the Cosmos SDK community is still too small, with limited documentation and resources.

The Cosmos SDK contains most of its code in the Go programming language. Go is a very sophisticated and modern programming language, but learning it can occasionally be challenging. Additionally, knowledge of Tendermint Core, ABCI, and the Interblockchain Communication (IBC) protocol is required to utilize Cosmos SDK fully. As a result, a lot of knowledge must be acquired before using it.

IBC: Communicate with other chains

IBC is an end-to-end, connection-oriented, stateful protocol for dependable, organized, and authorized communication across heterogeneous blockchains structured in an ambiguous and dynamic topology.

By defining a set of data structures, abstractions, and semantics that any distributed ledger complies with a modest set of constraints can implement, the protocol realizes this interoperability.

Token transfers, atomic swaps, multi-chain smart contracts (with or without mutually understandable VMs), and other types of data and code sharding are just a few of the cross-chain applications that may be built with IBC.

CosmWasm: Create a dApp in any language

The Cosmos ecosystem's CosmWasm smart contract engine is based on the Cosmos SDK and IBC. Simply put, it uses WebAssembly (Wasm) in the Cosmos (Cosm) way, hence the name. Other than the EVM, it is the only cross-chain interpretable VM.

The Cosmos SDK can accept modules that have been written for CosmWasm. Anyone presently developing a blockchain using the Cosmos SDK can easily add CosmWasm smart contract compatibility to their chain without changing the existing logic.

The most popular programming language for CosmWasm is Rust, however other languages like Golang and Vlang are also being developed. Different programming languages like AssemblyScript may exist in the future.

This guide seeks to go in-depth on the subject for developers who want to test the technology out or incorporate it into their products. It is targeted mostly at Go developers with Cosmos SDK experience and Rust developers searching for a blockchain platform.

How to use CosmWasm

A binary is all that is required to begin integrating CosmWasm into the blockchain because it is another Cosmos SDK module.

A new blockchain with smart contracts may be launched using wasmd right out of the box, utilizing tested and documented technology and the same security paradigm as the Cosmos Hub.

A functioning blockchain is required to host the contracts and communicate with them. It could be a mainnet, testnet, or localhost blockchain.

Conclusion

The Cosmos network has a more promising future. It has drawn numerous developers and is in charge of managing assets worth more than $64 billion. 

Although many chains have been constructed using it, its software development kit is frequently disregarded. In response, Cosmos introduced Composite, a fully collateralized stablecoin. It appears that the network is occupied with colonizing DeFi.

 

RELEVANT SERIES