If you want to develop a decentralized application today, you have multiple choices. Depending on the use case, a decentralized application can be built as a blockchain (application-specific blockchain) or on top of an existing blockchain (e.g. a smart contract on Ethereum). The former option allows for full flexibility but is costly in terms of development, while the latter allows for easy deployment at the cost of limited performance and sovereignty. In both cases, you won’t have interoperability outside of your application’s underlying blockchain environment.

Cosmos exists to solve these problems. It comes with a powerful toolkit based on Tendermint that enables developers to easily build decentralized applications. If your application requires sovereignty and flexibility, you can deploy your own blockchain without having to deal with the complicated networking and consensus parts of the software — thanks to Tendermint and its Application-Blockchain Interface (ABCI). If your application is of smaller scale and you don’t need your own chain, you can deploy it on Ethermint, which allows you to do everything Ethereum does — but with far greater performance. Finally, if you want to retain full privacy and control over your application, Tendermint enables you to deploy private blockchains.

The good news is: all these applications are interoperable and can exchange value with each other. Together, they form the Cosmos ecosystem — an internet of blockchains.

Understanding Cosmos

There are two types of blockchains in the Cosmos ecosystem: Hubs and Zones. Zones are sovereign blockchains — public or private — built on top of Tendermint. They can exchange value between each other by transacting through Hubs, which act as coordinators to limit overhead. Hubs help isolate zone failures so that global token invariance is preserved. If a zone wants to send tokens to any other zone in the ecosystem, a single connection with a shared Hub is required. This connection is achieved by a protocol called Inter-Blockchain Communication (IBC), which is optimized for chains with finality, and in particular, chains built on Tendermint.

Tendermint and IBC are the bread and butter of the Cosmos ecosystem. Let’s look into the detail of these two components.

Tendermint

A blockchain can be divided in three layers: networking, consensus and application. Before Tendermint was created, building a blockchain required building all the 3 layers from the ground up, which represented a considerable amount of work.

The goal of Tendermint is to ease the development of blockchains by providing a standard engine that deals with the networking and consensus layers. The only thing developers have to worry about is the application layer, on which they have full control. The interface that connects the state machine (application) to the underlying consensus engine is a socket protocol called Tendermint ABCI.

Tendermint provides these benefits:

Develop in any language . Tendermint is a general purpose blockchain consensus engine that is agnostic to the application built on top of it. This means that Tendermint blockchains can be developed in any language. This also means that Tendermint can be used as a plug-and-play replacement for the consensus engines of other blockchain software. One can take the current Ethereum code base, whether in Go, Rust, or Haskell, and run it as an ABCI application using Tendermint consensus. Indeed, we did that with Ethereum. Another example of a cryptocurrency application built on Tendermint is the Cosmos Hub.

. Tendermint is a general purpose blockchain consensus engine that is agnostic to the application built on top of it. This means that Tendermint blockchains can be developed in any language. This also means that Tendermint can be used as a plug-and-play replacement for the consensus engines of other blockchain software. One can take the current Ethereum code base, whether in Go, Rust, or Haskell, and run it as an ABCI application using Tendermint consensus. Indeed, we did that with Ethereum. Another example of a cryptocurrency application built on Tendermint is the Cosmos Hub. Public or private blockchain capable . Since developers can deploy arbitrary applications on top of Tendermint, it is possible to develop both permissioned and permissionless blockchains on top of it.

. Since developers can deploy arbitrary applications on top of Tendermint, it is possible to develop both permissioned and permissionless blockchains on top of it. Performance . Tendermint is a state of the art blockchain engine. Tendermint Core can have a block time on the order of 1 second and handle thousands of transactions per second.

. Tendermint is a state of the art blockchain engine. Tendermint Core can have a block time on the order of 1 second and handle thousands of transactions per second. Instant finality . A property of the Tendermint consensus algorithm is instant finality, meaning that forks are never created, as long as less than a third of the validators are malicious (byzantine). Users can be sure their transactions are finalized as soon as a block is created.

. A property of the Tendermint consensus algorithm is instant finality, meaning that forks are never created, as long as less than a third of the validators are malicious (byzantine). Users can be sure their transactions are finalized as soon as a block is created. Security. Tendermint consensus is not only fault tolerant, it’s optimally Byzantine fault-tolerant, with accountability. If the blockchain forks, there is a way to determine liability. We had Tendermint Core audited through Jepsen.io, a distributed systems security analysis tool, and the results verify that Tendermint BFT does not violate its stated guarantees: https://jepsen.io/analyses/tendermint-0-10-2.

You can learn more about Tendermint here.

IBC

Zones in the Cosmos ecosystem can exchange tokens with each other via a protocol called IBC. This protocol takes advantage of the fact that every chain runs on top of the same core engine, Tendermint, which provides instant finality. Zones do not need to establish an IBC connection with every other zone, only a single connection with a Hub is sufficient to send tokens to every zone that is connected to it.

One of the main benefits of IBC is that it does not infringe on the sovereignty of individual zones. Every blockchain in the Cosmos ecosystem relies on a set of validators responsible for committing new blocks to the blockchain. For a blockchain to be sovereign it is important that the application has control over validator set changes. In a public setting, this is achieved with a staking token and Proof-of-Stake algorithm. In private settings, the application can grant privileges to a certain pool of address to make changes to the validator set. In both cases, IBC does not require that the application surrenders control over the validator set. Each zone can have its own validator set and business logic while retaining IBC compatibility.

As a result, each zone can implement its own governance mechanism to upgrade the software without losing compatibility with the rest of the ecosystem. Additionally, fully private blockchains can send and receive token from public blockchains or other private blockchains, opening a whole new range of possibilities for existing institutions and businesses that require high levels of control and privacy.

You can learn more about IBC here.

Developing on Top of Cosmos

Once you have analyzed the benefits of Cosmos and want to move ahead, there are various possibilities for how to develop your application. Different options have different benefits that allow you to make the optimal choice based on the importance of factors including speed of development, performance or your application’s need for sovereignty.

Building your own ABCI app

Pros:

Full control and flexibility over the application

Programmability. Code your blockchain with your preferred programming language

Public or private

Cons:

Out of the three options, this is the one that requires the most development efforts, especially if you’re building a public blockchain (even if Tendermint saves you a lot of work!).

Good for: Applications that require their own chain and maximum flexibility, projects with high resources/network effect, private chains.

Learn more here

Build on top of cosmos-sdk

The Cosmos SDK is an ABCI application framework designed to be used with the Tendermint consensus engine to build secure blockchain applications. It comes with a set of useful modules (staking, governance, IBC, …) that developers can choose to use or not depending on the requirements of their application.

Pros:

Built-in plugins optimized for Proof-of-Stake blockchain (staking, governance,…)

Design considerations taken care of

Flexible and secure

Con:

Language constraint (golang)

Good for: Public proof of stake blockchains

Learn more here

Build on top of an existing blockchain like the Ethermint zone

Ethermint is the high speed implementation of Ethereum built on top of Tendermint. Part of Tendermint’s goal, once Ethermint is launched together with the Cosmos Hub, is to give developers the best of both worlds — the full capabilities of writing and executing smart contracts in Ethereum plus all the added performance and interoperability benefits of a Tendermint-powered zone in the Cosmos Ecosystem.

Pros:

Just like an Ethereum application but with better performance and compatibility with the Cosmos ecosystem

No need to deal with security / setting up a validator set

Con:

Less flexibility and sovereignty

Good for: Small to medium public decentralized applications that do not require their own chain, projects that do not want to deploy their own validator set

Learn more here.

Build with Lotion

Lotion is a JavaScript library for Cosmos applications which aims to make writing new blockchains fast, fun, and easy for beginners. Like the Cosmos SDK, it builds on top of Tendermint using the ABCI protocol.

Lotion itself is a tiny framework; its true power comes from the network of small, focused modules built upon it. Adding a fully-featured cryptocurrency to a blockchain, for example, takes only a few lines of code.

Writing a Lotion application is often as simple as writing a single function that mutates the application’s state (held in a single JavaScript object) in response to a transaction.

Pros:

Easy to use

Access to the 500k+ modules on npm

Cosmos-compatible via IBC

Con:

Light client support not yet implemented

Experimental

Good for: Experimental blockchain applications, prototypes, javascript developers

Learn more here

Deploying a decentralized application on Cosmos

After you’ve developed and tested your application, it is time to deploy it. Once again, several options are available for you to choose from.

My application is a public proof of stake blockchain

If you’ve decided to go for a public proof of stake blockchain, either through a custom ABCI-app or a sdk-based app, you will most likely need to have a staking token and bootstrap a validator set.

Two questions then arise :

What is the initial distribution of the staking token ?

How to find validators to bootstrap the network ?

Pooled security

Bootstrapping a network is demanding in terms of resources, and blockchains that fail to reach critical mass could be exposed to security issues. For small to medium projects that require their own blockchain, the launching phase could prove difficult to handle. To circumvent this problem, these blockchains could pool security together. In effect, they would share the same validator set and staking token.

One way of implementing this would be via an incubator zone. Validators of this zone would lend their services to chains in exchange for some compensation. Chains would apply to be supported by the incubator zone and admission would be handled by the incubator’s governance system. Once an incubated chain reaches critical mass and if it makes sense, it would be able to move away from the incubator zone and become independent; that is, have its own staking token and validator set. Incubator zones do not exist yet, but they would be good additions to the Cosmos ecosystem in the future. For now, if you do not want to deploy a validator set for your decentralized application, you should use Ethermint.

My application lives on top of an existing blockchain such as Ethermint

In this case, the deployment process is easier since you do not have to concern yourself with setting up a staking token and validator set. You can just deploy your application using the tools given by the underlying blockchain you’re using. For example, with Ethermint, you can use all the tools available for Ethereum, such as Truffle. A tutorial for doing this can be found here.

My application is a private blockchain

If your application is a private chain, you don’t need a staking token, and validators are known entities. You just have to launch your chain with an initial validator set of your choice and implement a mechanism to allow an address or set of addresses to authorize validator set changes.

Conclusion

The Cosmos network offers various options for running decentralized applications. They range from already-built Ethereum applications on Ethermint, all the way to creating high performance custom-built blockchains. Cosmos is set to launch in a few months with the release of the Cosmos Hub. With many projects already preparing to launch on Cosmos, the time to embrace the coming internet of blockchains and build consumer-ready decentralized applications has arrived.