# How does Polkadot compare to Cosmos?¶

There is a lot of interest surrounding the comparison of Polkadot to Cosmos. Understandably so, since Cosmos as a blockchain interoperability protocol shares some of the same goals as Polkadot. However, there are a few key differences between the two protocols which should be understood before comparing them further.

## Hubs and Zones vs. Relay chain and parachains¶

In Cosmos, a chain is referred to as a zone and each uses an individual instance of the Tendermint consensus algorithm. Interchain communication is handled via a master hub chain and is limited to transfers of currencies rather than the communication of arbitrary information across chains (like Polkadot allows). The roughly synonymous terms to compare Cosmos to Polkadot is that a zone maps to parachain and hub maps to relay chain BUT these are only loose comparisons and do not have the same properties or functions. One thing to point out is that Polkadot assumes that there will be a single canonical relay chain, with the potential for parachains to be relay chains themselves, but overall connecting to the top level Polkadot relay chain. Cosmos, however allows open deployment of hubs and zones and makes no such requirement that they must be connected at all.

## Consensus¶

Cosmos uses the Tendermint consensus algorithm which is based on the practical Byzantine-Fault-Tolerant (PBFT) algorithm. For a general overview of PBFT, please see the overview here. In general, it is a family of consensus protocols that can handle no more than 1/3 byzantine nodes (malicious or offline nodes).

Polkadot uses a combination of block production mechanism with a finality gadget, respectively termed BABE and GRANDPA. BABE is similar to Ouroboros Praos and GRANDPA is a finality gadget based on GHOST in the same vein as Casper FFG. It is not PBFT.

### Validity¶

Tendermint decides validity based on an application specific validate() function. And states that:

In blockchain systems, a value is not valid if it does not contain an appropriate hash of the last value (block) added to the blockchain.

This is different from how GRANDPA comes to consensus on chains. Due to the constraint that Tendermint uses the block and the prior block hash as part of its validity function, it ties its finality gadget to its block production by design.

GRANDPA instead is a finality gadget that is working as a separate process to the block production mechanism (BABE).

Tendermint algorithm is based on a single cornerstone assertion: n > 3f where n is the total voting power of the system and f is the total voting power of "faulty processes" or malicious nodes in the system. This means that the minimum voting power required for Tendermint to continue operation is n = 3f +1.

• Tendermint requires 2 voting steps (three communication exchanges in total) to decide a value.

### Availability¶

Tendermint will safely halt if more than 1/3 of the validator set goes offline.

Similarly GRANDPA will stop finalizing blocks if more than 1/3 of the validator set cannot be reached, however blocks will continue to be produced with BABE.

### Finality¶

Finality for both Cosmos' Tendermint and algorithm and Polkadot's GRANDPA finality gadget are bounded by the bandwidth and latency of the messages which are able to propagate among the validator peers in the network. As the numbers of validators increases, the amount of nodes which must sign each message before consensus is reached expands and thereby causes the finality gadget to slow down. Among a small group of nodes, say 5, the latency for coming to consensus under either one of these algorithms could be low and the finality fast. As the numbers of validators increases to 100 and beyond both algorithms would slow down. In a decentralized network, a larger validator set is preferred because it is more resilient to take down, and the security guarantees are higher. Both networks have expressed interest in moving to larger validator sets.

The key difference between Cosmos and Polkadot is that block production is conflated with the finality gadget in Cosmos' Tendermint while in Polkadot these two things are separate. What this means is that both network's algorithms will reach finality in similar time frames based on the size of the validator set and network latency, but Polkadot will produce blocks faster than the finality time. Tendermint is bounded on the speed of their block production due to the time-to-finality, while Polkadot's block production could potential reach speeds much higher than the time-to-finality.

Additionally, since GRANDPA comes to finality on chains rather than individual blocks in the chain, it could be that under similar conditions (same size validator set) Polkadot will have faster finality on more blocks than is possible under an algorithm like Tendermint where each block must be agreed upon in the consensus algorithm one at a time.

Visual 1.1

For a visualization of what we mean by GRANDPA comes to finality on "chains" rather than blocks, consider Visual 1.1.

## Shared Security¶

Polkadot is designed to share or pool security through the relay chain validator set. This means that any chain which connects to the Polkadot network will not need to set up its own consensus or manage its own economic security, but will benefit from the strong economic security of the relay chain.

This is remarkably different from Cosmos, since Cosmos posits that each chain is sovereign first and must run its own instance of Tendermint consensus with its own consensus algorithm. Cosmos now claims to have a notion of shared security similar to what is offered by Polkadot, but it is not implemented today and seems to be a recent addition.

Cosmos is a consensus bridge solution and not a validation bridge solution. There is no attempt in the Cosmos network to validate the sub-chains, and the hub can track all token transfers. Chains on Cosmos cannot trust each other since each is economically independent. The same Cosmos zone can spend resources on 2 other Cosmos zones and there would be no way for the zones to have information about this double spend unless they get it from the Cosmos hub.

Polkadot has much stronger guarantees than Cosmos in ensuring the economic security over the global state of the relay chain and of the parachains. It also gives greater levels of flexibility to parachain developers to use their own consensus and custom interchain logic.

## Interchain Communication¶

Cosmos uses the inter-blockchain communication (IBC) standard for the transmission of messages across its zones. The specification for IBS is in progress on this pull request and is described in a series of tweets here.

It is difficult to describe the Cosmos IBC protocol with fairness since the specification provided is a work-in-progress and does not necessarily reflect what is implemented in the live Cosmos hub today. As far as we can tell, Cosmos IBC is limited to only the transfer of assets (tokens) across chains which are running Tendermint. They specify it is agnostic to chains as long as it fits the two properties of "fast finality" and "accumulator proofs" but as neither of these things are well-specified it must be assumed it only works with the Tendermint software (in other words, not truly agnostic).

Previously believed that:

Cosmos IBC allows each of its zones to transfer assets to other zones granted they are connected to the _Cosmos Hub_. Notably, the interchain communication in Cosmos is limited **only to transfer of assets.**


In comparison, Polkadot allows arbitrary messages to circulate among its parachains. Parachains are able to communicate with each other and validators only need enough data to verify that the interchain messages are being processed correctly. The messages of Polkadot's interchain system can encapsulate assets or more complicated functionality. They are strings of arbitrary bytes. In fact, Polkadot is so flexible in its interchain communication that it even allows parachains to parse the same message in different ways. Although this is a ridiculous thing for parachains to implement, it is allowed. The way that one parachain interprets a message is independent of how any other parachain interprets messages. Of course, the impact a message has on one parachain's state can not effect the state of another parachain (unless it sets off a domino effect of interchain messages by initiating the receiving parachain to send a new message to other parachains).

For more on parachain messaging in Polkadot please see the interchain page.

## Programming Language¶

Cosmos has written the cosmos-sdk in Golang, and has not signaled any desire or plan to support other languages. This is okay if you are a skilled Go developer or are willing to hire Go programmers or learn the Go language, but not very helpful if otherwise. In comparison, Polkadot uses the language-agnostic WebAssembly standard (Wasm) as the compilation target of its runtime and parachain validation functions and runtimes. Many programming languages support Wasm compilation or will support Wasm compilation in the future. A non-exhaustive list of languages that support Wasm compilation are Rust, Go, C++, TypeScript (AssemblyScript), OCaml, Brainfuck, and more. To create a blockchain that will connect to the Polkadot network, it's possible to write your blockchain application in any of these languages. With Cosmos, you have no choice and must write in Go.

## FAQ¶

Follows are responses to questions which are often brought up in the comparison of Cosmos and Polkadot.

### Do parachains need to connect to the relay chain or can they be sovereign chains like in Cosmos?¶

The simple answer is yes, if a chain would like to benefit from the shared security and interchain communication enabled by Polkadot then it must become a parachain to the Polkadot relay chain. However, a chain built using Substrate does not need to connect to Polkadot if it does not want to share in these benefits and it can implement its own consensus and security just as each Cosmos zone does. The difference between them is that in Cosmos, there is no choice, a chain must have its own security and validator set running Tendermint consensus. While Polkadot/Substrate allows a chain to be sovereign with its own security by implementing one of the provided consensus algorithms or by developing a custom one. If the chain chooses it can make its consensus compatible with Polkadot and become a parachain.

### Is GRANDPA / BABE similar to PBFT?¶

No. This is a misunderstanding. GRANDPA, the finality gadget, and BABE, the block production mechanism, are novel developments in consensus and they are very far away from PBFT. GRANDPA is derived from GHOST similar to Ethereum's Casper and BABE is a block production mechanism similar to Ouroboros Praos. Neither of these technologies are based on PBFT. (This is not the case for Cosmos however, since Tendermint is based on a modified PBFT).

### Is Polkadot only going to work with POS chains? How is it trust-less in comparison to Cosmos?¶

Polkadot is primarily designed to be a very efficient and minimal heterogeneous multi-chain platform. Bridges to preexisting or "foreign" chains are one potential use-case for it. Such bridges can be to either PoW or PoS chains and in terms of the Polkadot protocol it makes little difference (as it does in some protocols such as Bitcoin's Sidechains that works specifically with SHA256 PoW and Cosmos's Zones that works only with Tendermint PoS). Polkadot's parachain abstraction is neither PoS nor PoW specific. If you want to call it anything, it's "PoV" or Proof of Validity. As such Polkadot is entirely agnostic. As long as you can succinctly demonstrate that a block is "valid" under your chain's technology (basically this means being able to build a light client), then you can probably plug it into Polkadot one way or another.