Cosmos and Polkadot: Interoperability of blockchains

Foreword: A cross-chain network is essentially an extended solution, just like Ethereum and Harmony's shards, to achieve greater transaction throughput. In the cross-chain field, both Cosmos and Polkadot have a lot of community attention. So what are the similarities and differences between the two? This article is easy to read and suitable for beginners to read. This article was translated by the "Cipher" of the "Blue Fox Notes" community.

Blockchain interoperability is probably the next wave of innovation, creating tremendous value in expanding decentralized networks.

The two top competitors that create the blockchain network are the Cosmos network and the Polkadot network. We will compare the two protocols, network design, security model, technology stack and so on.

But first, we need to explain what blockchain interoperability means at a higher level.

What is blockchain interoperability?

Blockchain interoperability is very complex, so let's try to explain it in the simplest way.

Blockchain interoperability means that a person can send an ether and automatically receive bitcoin through a blockchain protocol. This process does not require third parties such as trading platforms to participate. This is a simple wish, but it has not yet been realized.

Both Polkadot and Cosmos are building protocols for the blockchain for secure, reliable interaction. These protocols allow newly created blockchains to send transactions and messages to each other.

Why is it important?

A network of blockchains can improve the decentralized Internet through network effects. When everything is connected, it brings more capital, a better user experience and more brainstorming to improve the network.

Blockchain interoperability can significantly increase the scalability, speed, and scalability of blockchains. For example, if your blockchain upper limit transaction is 100TPS, you can create an identical blockchain and interoperate with the previous blockchain so that you can reach 200TPS. In this way, you can achieve 1000TPS.

It also allows private, public, and federated links to connect. In the end, the blockchain can even interoperate with legal currency banking systems such as SWIFT.

Why pay attention to Cosmos and Polkadot?

From my research, I found them to be very promising projects. They all have strong technical teams and a good reputation in the decentralized community, they have been in the blockchain field for many years, and they have written a lot of code from scratch.

They use a similar strategy to resolve blockchain interoperability, but there are differences in protocol and design. These differences have different trade-offs between security, privacy, efficiency, flexibility, and ease of use.

Now let's take a closer look at what the future of blockchain interoperability looks like!

Cosmos Network

Since 2014, with the release of Tendermint, the Cosmos team has been working on blockchain interoperability. Tendermint is a Byzantine Fault Tolerant (BFT) consensus engine and a peer-to-peer network gossip protocol.

Cosmos – blockchain internet

The Cosmos network they built is a blockchain built on top of Tendermint. Both Tendermint and Cosmos are under the InterChain Foundation. The following two simple diagrams explain how they design the network.

(From a higher level, its blockchain consists of three main components, namely a computer node network that can communicate with each other, a protocol that allows nodes to reach consensus on new blocks, and an application layer with its own state (such as an Ethereum account). , it stores the etheric balance as a state).

(Tendermint is responsible for the network and consensus layers of the blockchain. This allows the blockchain to create applications with its own state based on Tendermint. (Blue Fox Note: Delivering the network and consensus layers to Tendermint reduces development difficulty.) The figure shows the ABCI application interacting with Tendermint via the ABCI protocol, which is explained in the next section.)

Technical design and agreement

Tendermint (consensus and network)

Tendermint is a practical Byzantine Fault Tolerant (PBFT) state machine. It requires a known set of verifiers to reach a consensus on a block. The Cosmos network requires at least two-thirds of the majority to reach a consensus. If less than one-third of the verifiers are Byzantium (Blue Fox note: malicious nodes), the network will never fork, because the verifier cannot submit conflicting blocks at the same height, which stems from Tendermint's emphasis. The safety of the chain outweighs the chain activity.

Application Blockchain Interface (ABCI)

ABCI is an interface that defines the boundary between the replica engine (Tendermint) and the state machine (blockchain). ABCI is the only way to update the status of the blockchain, and only Tendermint can get the status change function of the blockchain. This design is a good security strategy because only one entry can change state.

The following figure breaks down the Tendermint stack, showing how the nodes are connected in the peer-to-peer network, and the components of each node.

(The five nodes create a peer-to-peer network with each other. Each node is a computer running the Tendermint core. Tendermint can connect to the blockchain via the ABCI protocol. Lightweight client nodes in the lower left corner can connect to any Tendermint node via RPC calls .)

Cosmos interoperability

Blockchain communication (IBC)

The Cosmos network has a cross-blockchain communication (IBC) protocol that allows blockchains to interact with other blockchains. The blockchain network will communicate via the IBC, with the Cosmos network as the hub. The blockchain is connected to the Cosmos hub by a hub and spoke model. The spokes of the network are called "Zones", as shown in the following figure.

(The Cosmos Hub is the main blockchain that connects all other blockchains on the Cosmos network. Each Zone has its own blockchain, which together create a hub and branch model for the connection.)

IBC has a more specialized technical term, chain relay. Chain relay allows blockchains to read and verify events in other blockchains. For example, a smart contract on chain A wants to know if an event has occurred on chain B. To this end, the smart contract on chain B needs to take the block header of chain A and verify that it has met the consensus and reached its finality. (Blue Fox Note: Blockchain Ultimate means that transactions have been written to the block and added to the blockchain, ie cannot be reversed or tampered with.)

Essentially, Cosmos is building a network that makes it easy to create new blockchains, and these newly created blockchains can interact through chain relays from the start. Each blockchain will run on Tendermint as shown below.

(Cosmos Hub interacts with the other 4 blockchains running on Tendermint. Through the design of the IBC protocol, they can easily read each other's status and take action accordingly. The chain in the upper left corner is a peg zone, in the next This is explained in the section.)

The new blockchain can join the network as long as it follows the IBC protocol, and this rule applies regardless of whether it is a public or private chain.

Peg Zone

The Peg Zone will allow the Cosmos network to connect to an on-line blockchain network, such as the Ethereum's main network. Being able to connect to an on-line blockchain is a major requirement for any blockchain interoperability network. The Peg Zone is complicated, but let's try to explain how they work in a simple language.

First, you must have a shared security model in which the authentication node of the Cosmos Peg Zone also needs to run an Ethereum main network node, and this special verification node approves the interaction between the two chains. This is a complex infrastructure, for which you also need to trust the team responsible for running the Peg Zone.

The actual transaction of the asset requires an intelligent contract of the Ethereum main network to lock the ether, and at the same time create a new token representing "Cosmos-Ether" in the anchoring area. This new token can be used on the Cosmos network through IBC. On the Cosmos side, the certifier will lock the Cosmos local token ATOM, and then create an ERC-20 version of the ATOM token, which can be used in the Ethernet main network. This will allow full interoperability of assets between Cosmos and Ethereum's main network.

Realize interoperability between the two chains

Any interoperable network requires at least two blockchains that can exchange messages and conduct transactions. Ethermint will be the first blockchain to interact with Cosmos Hub.

Ethermint is a blockchain that the Cosmos team launched after the Cosmos Hub main online line. The easiest way to describe Ethermint is that it is the Ethereum blockchain, but its original PoW consensus algorithm was replaced by the Tendermint consensus engine. This allows the blockchain based on the Ethereum Virtual Machine (EVM) to easily interact with the Cosmos network via IBC.

Ethermint will "snap" all Ethernet accounts at a certain point in time and use this state to create a new Ethernint zone. This allows them to attract existing Ethereum developer groups at minimal cost and will provide Ethermint users with new tokens and faster transaction speeds.

Instead of connecting to the existing Ethereum main network via Peg Zone, instead of creating an Ethermint, the former is technically easier to build. However, a blockchain network must have a Peg Zone. Bitcoin and Ethereum are so powerful that ignoring them will be a very dangerous move for Cosmos or Polkadot.

Cosmos Hub

The Cosmos Hub is the main blockchain that acts as the central connector for all blockchains in the Cosmos network. It is a multi-asset equity certification blockchain driven by Tendermint. The native token of Cosmos Hub is ATOM (Blue Fox Note: Chinese community is called Astro Boy), and ATOM is used for staking and governance of blockchain. The Hub is launched with 100 certifiers and will continue to increase each year thereafter.

The ATOM holder can be either a verifier or a delegator. The certifier sets up a complete node to maintain network security and process transactions. The consignor delegates his token to a verifier who is trustworthy and able to run the node, based on their personal review of the verifier.

The verifier obtains additional ATOM as a block reward by pledge ATOM. The certifier will distribute these rewards to the delegator after deducting a small amount of agency fees.

In order to maintain the credibility of the verifier, the verifiers who make malicious acts or issue erroneous data to the blockchain are subject to financial penalties – losing part of their ATOM. This is often referred to as "slashing." These game theory level requirements are used to motivate the correct behavior in the equity proof blockchain.

Tokens are also used for governance. An Atom represents a vote for any suggestion on the network, such as a software upgrade. Cosmos's governance agreement is fairly simple. The consignor can choose to vote on their own, or they can vote for the verifier they are entrusted to. The verifier must vote on each proposal, otherwise the token will be “subtracted”.

Developers on Cosmos

Developers can develop on the basis of the Cosmos network in two ways. Build a new blockchain using IBC interactions and build smart contracts in Cosmos zones. To this end, they developed the Cosmos SDK, allowing developers to easily build new blockchains on the Cosmos network.

Cosmos SDK

Cosmos' "Cosmos SDK" allows developers to design their own blockchains on the network using a simple, modular approach. The SDK is also used to build the Cosmos Hub.

This will allow developers to choose the basic blockchain application, add governance or staking pledge modules, build their own modules, and easily publish their own blockchains, and these custom blockchains can also be used with the SDK. Other blockchain interactions. This is an exciting opportunity as it will provide developers with a new decentralized platform that they can play freely, not just using Ethereum to issue tokens.

The SDK is written in Golang and is planned to support more languages ​​in the future. But in the first year, the blockchain in the Cosmos network will only be written in Golang.

Building applications based on Cosmos

Ethermint will be the first implementation to build a dApp on the Cosmos Network. Since it is an EVM-based blockchain, you can write contracts with Solidity. The network's trading speed will also increase, because the Tendermint consensus can handle more transactions per second than Ethereum's PoW.

Polkadot

The Polkadot network is another project that has a strong technical team to handle blockchain interoperability issues. Polkadot was written in Rust and developed by the Parity team, which also developed the Ethereum client.

Polkadot Network

Technical design and agreement

consensus

Like the Cosmos team, they also separated the consensus architecture from the state application. According to Polkadot's white paper, their consensus engine was actually inspired by Tendermint and HoneyBadgerBFT.

A detailed explanation of the Polkadot technology stack. A peer-to-peer network with consensus as the outer layer, connected to the blockchain state machine via the WebAssembly interpreter. (Blue Fox notes Cipher Note: WebAssembly is an interpreter that can be deployed directly on the server side, supports multi-language compilation, the most intuitive effect is that although Polkadot is written using Rust, in theory the smart contract in the Polkadot network can use any Compile the language into WebAssembly, such as C, C++, etc.)

They also mentioned that they plan to use a hybrid consensus mechanism that combines Aurand and Tendermint PBFT. Aurand allows randomly selected verifiers to produce a block directly without the need for a 2/3 consensus. The hybrid design allows for a faster consensus, but it also raises the possibility that certain blocks will have to be reversed if the verifier has malicious behavior.

(Tendermint PBFT and Aurand's hybrid design. Tendermint guarantees the finality of every 5 blocks in the picture, while the middle 4 blocks are processed quickly without any consensus. It is faster than PBFT, but paid The price is that you can post the error block, and if this happens, you need to reverse it.)

Polkadot interoperability

The interoperability strategies of Cosmos and Polkadot are similar. The Polkadot network has a relay chain, which is a central connector that functions like a Cosmos hub. It has a blockchain connected to the relay chain, which they name as a parallel chain (Parachain). Cosmos's Zone and parallel chains have the same purpose. Polkadot also has a bridge that connects to the on-line blockchain, similar to the Cosmos's Peg Zone.

Parallel chains (Parachains)

Both the parallel chain and the Cosmos Zone use chain trunking to achieve blockchain interoperability. But their implementation is really different. The biggest difference is how they connect chains and share security. With Polkadot, network security is pooled and shared. This means that a single chain can directly enjoy collective security without having to build attraction and trust from scratch.

This is done by binding the Polkadot native token DOT to the newly created parallel chain and by removing the DOT and removing the useless Parachain. Cosmos does not require the creation of another chain by combining ATOM, which uses governance to determine if the Cosmos Hub should be connected to a Cosmos zone.

Bridge

Bridge and Peg Zone are the two names of the same thing. They all allow connections to networked blockchain networks, such as the Ethereum main network. Both Cosmos and Polkadot are expected to connect quickly to the Ethereum main network at the beginning.

Realize interoperability between the two chains

As mentioned earlier, the first chain to interoperate with Cosmos Hub will be Ethermint. Polkadot will also create one, which should not be too difficult for them because they already have a lot of experience with Ethereum's Parity client.

Polkadot Network

The Polkadot network is a proof of interest blockchain, and the native token is DOT. DOT provides governance and incentives for token holders to be honest. The network hub hub is a trunk chain that functions like the Cosmos Hub in the Cosmos network. The Polkadot network has four rights holders: Validator, Nominator, Collator and Fishermen. Polkadot also has "slashing" to punish malicious behavior.

The verifier on Polkadot has the same role as the verifier in Cosmos, and the nominee for Polkadot is similar to the Delegator in Cosmos. The following diagram from the Polkadot white paper shows the interaction between equity holders.

(Interaction between the four stakeholders of the Polkadot network)

The verifier does not maintain a fully synchronized database with all parallel chains because there is too much data. Therefore, the verifier will hand over the task of storing and verifying new parallel chain blocks to a third party, the checker. The main function of the checker is to generate valid parallel chain blocks, they must maintain a complete node. They will perform a zero knowledge proof (zkp) on the unsealed block and provide it to one or more verifiers who are responsible for proposing parallel chain blocks to the relay chain. Checkers and verifiers will receive transaction fees for these tasks.

Fishermen are like independent bounty hunters who seek big rewards. It is expected that their existence will only lead to malicious behavior, because the verifier and the checker know that they will be caught and slashed. The fishermen will send evidence of any illegal activities of the verifier or the verifier.

There are several levels of governance. The most important point is to conduct online voting through DOT tokens. In addition, they plan to set up a board of 12-24 accounts to vote on proposals that are not sufficiently focused by stakeholders, a backup solution to low voting participation rates. They also promised to add adaptive arbitration bias (Blue Fox note Cipher Note: usually the voting participation rate will lead to a certain deviation of the voting results, high voting rate has a positive bias, low voting rate has a negative bias, in order to correct this deviation, Polkadot Choosing to join the adaptive arbitration bias mechanism means that the higher the voting participation rate, the lower the vote rate required to pass the proposal. A feasible (not necessarily final) positive deviation correction scheme is: if the number of consents is *√ Vote participation rate> objection, then the proposal is passed). They may also try to increase the voting power of different voting mechanisms, such as long-term DOT token holders or verifiers, and even dApp teams that have long-term contributions to the network. But these are just the current ideas.

Status of the main online line

Their first Proof of Concept has been able to verify blocks and reach consensus on state transitions. They have been able to send DOTs through the test network. Proof of concept is written in Rust, and runtime is built on WebAssembly.

Developed on Polkadot

Substrate

Substrate is a technology stack that developers can build blockchains based on Substrate. This is very similar to the Cosmos SDK developed by Cosmos.

The Polkadot network is built on top of Substrate, just as the Cosmos hub is built on top of the Cosmos SDK. You don't have to worry about consensus or the network, just focus on the blockchain application.

Substrate is written in Rust, but the core functionality of the state machine compiles it into WebAssembly. It can be run locally using compiled Rust code or via the WebAssembly interpreter. This can be seen in the image below.

(If the local client node is up to date, it can run the WebAssembly code locally, but if not, it will have to use the WebAssembly interpreter on the chain, which will run slower than local.)

Building dApps on Polkadot

You can build dApps on parallel chains that support smart contracts. This is similar to Cosmos, where neither the Polkadot trunk chain nor the Cosmos hub supports smart contracts, but the chain connected to them can be supported.

Comparison of Cosmos and Polkadot

Let's take a look at the main components of each network and how they are stacked. This is the most interesting part, you can compare the differences and decide which network may be more successful!

Consensus agreement

They all use the Tendermint PBFT consensus, although Polkadot promises to use a hybrid consensus that combines Aurand. The hybrid approach will speed up the consensus, but it can lead to block reversal. Both methods still require field testing on a formal on-line blockchain network. Both of these agreements are much faster than the Ethereum or Bitcoin work certification agreement.

Polkadot also mentioned on their website that they plan to use the "positive BFT authority certificate", but it is not clear what this means. The Web3 Foundation recently stated that "polkadot is pre-defined to be completely open and open, and does not require any particular organization or trusted authority to maintain a blockchain network." From the overall design of Polkadot listed in the white paper, the proof of the rights of the DOT will obviously be the dominant factor in reaching consensus. If proof-of-authority is used, it may play a secondary role.

Token and equity proof design

They all have a token for governance and pledge. Both have a certifier that protects the network and a delegator/nominator who delegates the token to the verifier. Polkadot also added the role of Collator to help parallel chains, and Fisherman closely followed any malicious actors.

Both can impose a penalty for token mitigation on malicious actors, and the mitigation parameters are likely to be adjusted at network startup. Polkadot's proof of entitlement is more advanced, but it also makes it more complicated.

The advantage of Cosmos is that they will be the first to go online; their simple design will make it easier for equity holders to organize and create a stable decentralized network. The advantage of Polkadot is that the four equity holders allow the network to be more decentralized. Now it's hard to pick which strategy is better, but time will give the answer.

Governance

Cosmos has a relatively simple agreement on governance because it is based only on the verifier, the consignor, and the written constitution.

Polkadot wants to do more work on governance, through adaptive arbitration bias, and a Certifier Council, which votes on proposals with lower voter turnouts.

In the blockchain that is currently online, equity certification governance has basically not been adequately tested, and it is expected that both teams will propose a proposal to adjust the governance agreement from the outset. Both designs are simple enough to be improved with small iterations, naturally moving toward a more powerful decentralized governance system. It's best to start with simplicity and then gradually increase complexity instead of imposing a bunch of rules and regulations from the start. The decentralization of these two networks seems to be sufficient to prevent a few certifiers from controlling the network.

Safety

Polkadot allows parallel chains and relay chains to share a secure pool, while Cosmos requires the zone on its platform to protect its own network. This means that to open a new parallel chain, you need to accumulate a large number of DOTs and connect your parallel chains to the Polkadot network by pleasing these tokens. Therefore, the security of each Parachain is rooted in the DOT token itself, which creates a shared security model for the entire network.

The Cosmos program allows zones to manage their own security model, the so-called autonomous zone. Cosmos Hub will use governance to determine which areas are allowed to connect to it. Other Hubs and Zones can choose their own security methods, which gives the network a lot of flexibility.

In any case, IBC token transfer is only done for another zone or hub that you trust. A zone may plan to conduct trade reviews in the future, so you need to look at the history of the zone and determine if they are truly decentralized and trustworthy. However, this works for any blockchain, because you won't want to use your bitcoin to trade another blockchain token you have never heard of.

It is important to note that when performing an IBC transfer, you must trust the zone with which the token is exchanged and any repeaters. If you receive a token from zone A in zone B and the token passes through the Hub (Zone A->Cosmos Hub->Zone B), then you need to trust all three blockchains (not just Zone A).

This is similar to the token transaction between today's blockchains because you need to trust the centralized exchange. You must trust both blockchains A and B, as well as a centralized exchange as a trusted third party.

Since Cosmos has autonomous zones, each zone connected must establish a secure decentralized network. So if Cosmos Hub has 5 fully available zones, there might be 100 Cosmos Hub certifiers and 5×100 Zone certifiers. This is a more decentralized model than Polkadot, and if it works, it should work well.

It is conceivable that 100 Polkadot certifiers can secure the relay chain and five parallel chains, while the Cosmos network requires 100 Hub certifiers and 500 Zone certifiers. This suggests that the Polkadots model makes it easier to create new parallel chains, but it also means that power is concentrated in DOT ownership. Cosmos allows for a more decentralized security model, but it will be more difficult to implement.

However, Cosmos said that they also plan to support shared security mode shortly after going online. Once they have this, it gives developers more flexibility because on Cosmos, they can share ATOM-based security or create their own tokens and security models. The trade-off they need in these two modes is that the autonomous zone is added to the network through governance, which opens up the possibility of a malicious zone connection, although this is unlikely.

Polkadot has a unique feature that allows you to upgrade your runtime without the need for a fork. They do this by storing the WebAssembly runtime on the chain. Nodes that have not updated their local version of the client will be forced to use the runtime. This eliminates the need for coordination through the certifier chain to update the software, eliminating the possibility of chain forks and improving security.

Speed ​​and scalability

Both consensus agreements allow for 1000 TPS transactions. It depends on how many nodes and parameter values. For each additional parallel chain or zone, the network's TPS will increase, and both networks can easily reach 1000TPS. The actual bottlenecks will appear in the state machine application running in their zone/parallel chain.

Interoperability

Both networks use a trunk chain to connect to the hub hub. They all use the "anchor area" / or "bridge" to connect to the Ethereum main network. They will all make it easier to run EVM Zone or EVM parallel chains on their respective networks.

Developer

Cosmos-sdk and Polkadots Substrate have the same idea for the development platform. They make it easy for developers to create their own blockchains on the web. Both teams are focused on being developer-friendly and trying to build a new development platform, just as Ethernet uses smart contracts and tokens.

The difference in development between the two platforms is that Polkadots is committed to using WebAssembly and Rust, while Cosmos is committed to Golang.

Polkadot looks to the future by supporting WebAssembly. WebAssembly is supported by Google, Apple, Microsoft and Mozilla, and it is highly likely to be widely used in the next decade. Rust has also been promoting one of the main languages ​​compiled into WebAssembly. From the perspective of five years, Polkadot seems to have made the right move to attract developers in the long run.

However, as we have seen in the experience of Ethereum, sometimes the first to enter the market is more important. While there are other smart contract chains that allow smart contracts to be written in other languages, Ethereum accounts for almost all of the smart contract development because they attracted developers and built an ecosystem around Solidity and EVM early on.

Cosmos will enter the market first. The main way to develop on Cosmos is to use Golang via Cosmos-SDK, which also has Lotion-JS, a Javascript implementation that creates Tindermint-based blockchains. However, the Cosmos website states that the Lotion-JS code has not been security audited, and it is best to use Cosmos-SDK to ensure value security.

Currently Cosmos does not support the work of WebAssembly. However, you can bet that maybe at some point in the near future, Golang will add support and compile to WebAssembly. They have made good progress. Finally, Golang is a much easier language to learn than Rust, and there are more Golang developers around the world.

to sum up

It is now difficult to tell which network will be more successful. But what is certain is that the party that attracts more developers will be the fastest growing and the largest share of the market.

As a developer, if you think Cosmos will be more successful, you will want to start learning Golang. If you believe in Polkadot, you will want to learn Rust. You can also write parallel chains in any other language (such as C or C++) compiled into WebAssembly.

Although one party will eventually be larger than the other, it is interesting to note that there may be situations in which both exist and are connected to each other. For example, if both networks create a Peg Zone/Bridge on Ethereum, you can use the ERC20 version of DOT to exchange ERM20 versions of ATOM. This will cause the two networks to be interoperable. This may create a huge intertwined blockchain network in which all tokens on Ethereum, all parallel chains of Polkadot and all Zones of Cosmos are interoperable. This will allow the Ethereum Plasma chains to be connected as well.

As you can see, the network effect of the blockchain interoperability network created by Polkadot and Cosmos is astronomical. This is very worthwhile for us to take the time to track the progress of each network and find the roots of the success of these two networks.

——

Risk Warning: All articles in Blue Fox Notes do not constitute investment recommendations . Investment is risky . Investment should consider individual risk tolerance . It is recommended to conduct in-depth inspections of the project and carefully make your own investment decisions.