Cosmos has launched the main network, but "why do you need to cross-chain" is still to be explored
Editor's Note: This article comes fromorange bookEditor's Note: This article comes from
orange book
(ID: chengpishu), author: orangefans, reprinted by Odaily with authorization.
Written in front:
Cosmos is live.
Looking back, the last time I communicated with the founder Jae was in October last year. I remember at the end of the interview, Orange Book asked, is there any difficulty ahead of the universe? Jae thought about it, and counted the components that needed to be made with his fingers. After counting, he found that these seemed to be almost finished, so he looked up and smiled, and said: it is been a long way.
yes. From 2014 to now, 4 years have passed in a blink of an eye, and Cosmos is finally on the mainnet.
I love Jae's sincerity in chatting. After writing that interview article in October, what impressed me the most is that Jae believes from the bottom of his heart that there will always be two forces in this world, one is towards the direction of centralization and clustering (for example, the emergence of a unified public chain ), the other is that people want some kind of substitutability, or a second choice (for example, they can easily send a chain). These two forces will keep pushing each other, and Jae chooses the less obvious side.
The world needs different people experimenting with different ideas. Jae hopes that every application, every organization, and even every person can have a chain. We don’t even need the Cosmos main network, but use their tools to build a hub by ourselves, and then find some friends around to build a zone, so that a small group can have a small blockchain network. It needs to be linked to any external public chain, and it runs completely internally - I think this concept is very interesting, like letting a small group of people build a local area network related only to themselves, a small island of their own. At the same time, this small island can also communicate with the outside world if necessary.
But the problem is, I'm not sure if such a concept can be supported by people's real needs. Perhaps the resources of miners and verification nodes can be shared to solve the problem of resource waste to a certain extent, but the cost and difficulty of operating a chain by itself are still not low. Maybe we will not have too many layer 1s in the future, and there will still be a unified public chain. Its performance and structure are safe and stable enough. People will continue to build new applications on top of stable things, but now such a The public chain has not yet appeared, and it may take a long time, but we currently only have two really solid value pools: Bitcoin and Ethereum.
I like the attempt of Cosmos, but the technical difficulty of cross-chain itself often replaces the discussion of some other issues, so that the discussions we see seem to be based on the premise of "the necessity of default layer1 cross-chain". But about the cross-chain scenario, I really haven't figured it out. I'd love to hear some other perspectives on this confusion. If you have a better understanding, welcome to comment and communicate.
For those who don’t know Cosmos, as an introduction to understand the principles of Cosmos, this article written by Orange Book in October last year is still worth reading. We have always wanted to produce content that has a longer life cycle, so for the following article, we decided to post it again.

first level title
Dialogue with Cosmos: In the future, will everyone use a public chain, or will everyone have their own chain?
cosmos is an interesting project. If you want to summarize its thinking, the original intention of this project established in 2014 is to allow everyone to easily own a chain of their own.
While most people are busy building public chains and dominating the world, the founder of Cosmos, Jae, has some unique ideas of his own. He believes that people still need to have alternative options outside of the unified public chain, and there are always some people who want to have a chain of their own. Even from other perspectives, many decentralized applications themselves should be an independent chain - for example, CryptoKitties should be a chain, fomo3d should also be a chain, not an application on the public chain.
To this end, the cosmos team has created many tools that allow developers to develop their own chains as easily as developing dapps. In the end, when many "small and beautiful", "customized", "specialized", and "specialized" chains emerge like countless rivers and seas, cosmos will use the cross-chain protocol and the larger network ecology system that provides interconnection capabilities for these different chains. The goal of cosmos is to make these rivers and rivers converge into a big ocean of blockchain.This article hopes to introduce in an easy-to-understand language what Cosmos does and where it is interesting. After introducing these basic information, there is a part of the Orange Book at the end of the article that talks with Jae, the founder of Cosmos, and his core technical team. content, from which you may have a deeper understanding of the concept of cosmos.
Origin of cosmos: tendermint
In the early days of technology development, people did not have much understanding and thinking about how to develop a decentralized public ledger. Bitcoin and Ethereum are like a whole welded computer, all the components on it are integrated, the logic in it is intricate, and there is no layered technology stack at all. It is difficult for you to change it, and the parts inside cannot be pulled out for upgrades. When people have all kinds of completely different ideas about the public chain, many people want to develop their own chain. At this time, you will find that even if Bitcoin and Ethereum are open source, it is difficult for you to reuse code. Apart from copying the Bitcoin code, changing the parameters, changing the name, and making an altcoin, there is not much that can be done.
In this context, some people think, can I make a tool so that everyone can use this tool to develop their own chain better and faster? Just like assembling a computer, keyboards, mice, monitors, and memory sticks are ready-made and can be disassembled independently. A person who does not understand the principles of computers can also build computers with various performances like building blocks. .
Cosmos - to be exact, the tendermint of Cosmos - was born.
Tendermint is one of the most important components in cosmos, and it is also the foundation of the entire cosmos ecology. To understand cosmos, you need to understand tendermint first.
Simply put, tendermint is a general blockchain development framework. You can use this framework to quickly customize and develop your own chain.
Just imagine, if you were asked to design such a set of development tools, how would you design it? Obviously, the first step is to abstract the functions that all chains need to use. Just like if you want to help others build a computer, you need to find out that the computer has cpu, memory, and display.
What are the necessary components of a chain?
The cosmos team believes that it can be divided as follows:
Network layer: used to ensure that, in a peer-to-peer network, each node can receive and transmit a transaction.

Consensus layer: used to ensure that each node selects the same transaction, which will be allowed to modify the state of the node. In Bitcoin, the so-called "state" is the balance of a series of accounts (although it is a utxo model, but in order to simplify the understanding, we can think of it this way), the miners reach a consensus on a transaction, and if it is valid, the transaction will be modified The balance of all accounts.
Application layer: used to ensure the processing of transactions. The so-called "transaction processing" refers to: input a transaction and a state, the application will return a new state. On Ethereum, the application layer is actually the so-called evm virtual machine. All transactions enter the virtual machine, and the virtual machine modifies the state according to the instructions of the smart contract that invoked the transaction.
The cosmos team believes that this three-tier structure can basically summarize everything in a chain. At the same time, most people want to develop their own chains, but they don’t care much about the network layer and consensus layer. What they want to define is the application layer, because this layer is responsible for business logic.So, the tendermint goal becomes:
Create a common network layer and consensus layer, so that everyone can easily build their own application layer on it, saving a lot of unnecessary development time.
Tendermint consists of two parts:
The second part is called ABCI protocol, Application Blockchain Interface. This part is the interface between the tendermint core engine and the above developer-defined application layer. Through this interface, the application layer can communicate with the underlying consensus layer and network layer. The characteristic of the ABCI protocol is that a transaction can be processed by applications in different programming languages and in any programming environment.
tendermint core
Next, let's look at these two parts in detail:
text
Tendermint core includes a network layer and a consensus layer: the network layer uses the gossip protocol, which is not important, let's focus on the consensus layer.In terms of consensus, tendermint uses the Byzantine consensus algorithm + pos.
The Byzantine algorithm is a kind of algorithm for solving consensus. It requires the verification nodes in the network to broadcast and vote round after round, and finally achieve the consistency of the entire network, so as to offset node offline, network communication delay, malicious node disturbance, etc. question. The Byzantine algorithm requires at least 2/3 of the nodes to be honest nodes. In tendermint, this 2/3 of the nodes does not refer to the number of nodes, but the rights and interests owned by the nodes, that is, the amount of "money" - because Is the pos mechanism, this and our
The algorand introduced before is the same.
In addition, everyone knows that Byzantine consensus algorithms such as PBFT require that the verification nodes must be a set of fixed nodes preset in advance, but in tendermint, the verification nodes can change dynamically, but this dynamic cannot be as flexible as Bitcoin POW , you can join if you want to join, and you can quit if you want to quit. Every time tendermint adds or exits a set of verification nodes, it needs to be voted by at least 2/3 of the nodes.
64 nodes, spanning 5 continents, 7 data centers, using commercial cloud computing instances, can provide ultra-high processing performance, process thousands of transactions per second, and delay between 1-2 seconds. Moreover, this kind of performance can also be established under strict adversary assumptions. Even if there are malicious nodes in the system deliberately cheating in voting, a certain degree of fault tolerance can be guaranteed.
It can be seen that the benefits of tendermint are reflected in performance and security. In addition, another advantage of tendermint is that it will not fork, because the pos Byzantine consensus algorithm reaches finality immediately after the block is produced.
text
ABCI agreement

With the tendermint core, you can build various chains on it, whether it is a public chain, alliance chain or private chain.
The reason why this can be done is that the tendermint core does not know what the application layer above looks like, and it does not care about the implementation of the application layer. Tendermint ignores many irrelevant details, and only abstracts the key things to make a common interface. This interface is called the abci protocol, which is used to connect the communication between the application layer and tendermint core.
Ethereum's Solidity, as well as languages such as Java, C++, Python, and Go, can all be used to write deterministic blockchain transaction processing logic. It should be noted that the processing of blocks must be determined instantly, not probabilistically determined like Bitcoin pow, otherwise tendermint core cannot reach a consensus. Both pos and poa (proof of authority) consensus algorithms are instantly determined.
flow chart
flow chart

image description
text
Let's use a more concrete example to see the relationship between the abci protocol and the application layer, which may be more intuitive.
text
For example, we want to implement a "fake Bitcoin" based on tendermint: Bitcoin is a blockchain that records virtual currency transaction records, and each node in the network maintains a UTXO database that has been fully audited by everyone.
We need to use abci to make a system that conforms to a similar definition. Then Tendermint Core is mainly responsible for these things:
Share block information between nodes and exchange transactions;
Establish an authoritative, immutable transaction record (that is, a chain)
The application layer stuff we need to write is responsible for:
Maintain UTXO database
Verify the cryptographic signature of the transaction
Prevent "spend non-existent transactions"
Allow clients to query the UTXO database

Ok, we have a general idea of what tendermint is.
With the Cosmos SDK, users only need to implement other plug-in modules on the basis of the SDK to handle some chain-specific services.
Cross-chainThe cosmos team also used this SDK to implement an example called Cosmos Hub, which we will cover later.
Cross-chain
We have learned about tendermint, the core technology of cosmos, and what the cosmos sdk does. Next, let's take a look at the technology of cosmos cross-chain. This is also the most important imaginative space for the future of cosmos.
When we do not have many chains, the problem of cross-chain does not actually exist. But with more and more public chains now, cross-chain has become a problem that needs to be solved. The two chains need to talk to each other. Bitcoin and Ethereum need to trade with each other, transfer value, and exchange their respective tokens. How to solve this problem?There is such an idea:
Suppose chain A wants to send 10 x tokens to chain B. First, these 10 x tokens will be locked on chain A and cannot be moved. Then, the cryptographic evidence that the 10 x tokens are locked is transmitted from the A chain to the B chain, and the B chain tracks the verification nodes on the A chain. If the cryptographic evidence has been signed by at least 2/3 of the verification nodes, then the The cross-chain transaction is valid, and the corresponding 10 x tokens will be generated on the B chain. https://github.com/cosmos/cosmos-sdk/tree/master/docs/spec/ibc
Note that the 10 x tokens on the B chain are not real x tokens, because the x tokens only exist on the A chain, and the x tokens on the B chain are just agents of the x tokens on the A chain. This proxy token needs to cooperate A cryptographic evidence that proves that these coins have indeed been locked on the A chain. When these tokens are returned from chain B to chain A, a similar mechanism is adopted.
The abstraction of this mechanism is the inter-blockchain communication protocol used by cosmos - IBC protocol, Inter-Blockchain Communication. IBC is like a bridge that allows different chains to communicate with each other. A more detailed definition of IBC can be found here:
Unfortunately, the current IBC protocol only supports simple value transfer, that is, sending tokens across chains, and does not support the transfer of logic, code, or other data.
blockchain network
With the IBC cross-chain communication protocol, how can we construct an interconnected blockchain network?
One of the most direct methods is to let each public chain in the network establish an IBC communication protocol with other different public chains. This approach is simple and effective, but it has a big problem: it does not scale. Assuming that there are 100 different chains in the network, they need to establish 4590 links to connect each other. Once the number of chains increases, the number of established links will also increase rapidly.
So can we not interconnect with each other, but directly connect all the chains in series?
So if there are 100 chains, they only need to establish 99 links in total. But this method will face another problem: the cost of trust will increase, and the risk of double spending in a cross-chain transaction will also greatly increase. why? If the token sent by A chain to B chain is generated on A chain, then B chain only needs to trust the verification node of A chain, but if the token is generated on C chain, it will be transmitted from C to A and then to B , then B chain needs to trust the verification nodes of A and C at the same time, and eventually the verification of this cross-chain transaction will be very troublesome.

In order to avoid the above two types of problems, Cosmos adopts another method to cross-chain. They use a modular architecture to establish the connection of the entire blockchain network. This architecture includes two components: one is called hub and the other is called zone.
Zone and hub are both tendermint-based blockchains: the hub is the center of cross-chain connections, and all cross-chain transactions are uniformly processed through the hub; zones are different sub-chains. The zone is connected to the hub through the ibc protocol, and different chains need to conduct cross-chain transactions with each other, which can be completed only through the proxy of the hub.
This kind of cross-chain architecture makes it easy for people to immediately think of another question: all cross-chain communication is completed through the central agent of the hub. Will this violate the original intention of blockchain decentralization?
It is worth mentioning that although the cross-chain does rely heavily on the cosmos hub, everyone can run their own hub without necessarily going through the official cosmos hub. Therefore, to a certain extent, cross-chain decentralization can also be guaranteed. It's a bit similar: you can run a hub by yourself, and then form a local area network with a few good friends, and at the same time, the local area network and the local area network can be connected through different hubs. Even if the hub connected to the external network is paralyzed, the communication within the LAN will not be affected.
text
Can non-tendermint chains connect to each other?
So far, we have tendermint and cosmos sdk, we can only care about the business logic of the application layer, regardless of the underlying network and consensus layer, and quickly develop our own chain. In addition, we also have cosmos hub and zone, which can connect many different chains based on tendermint and have interoperability.
So, can chains that are not based on tendermint also be interconnected?
There are two cases here: if it is a chain with instant certainty (such as adopting POS and POA consensus), as long as it adapts to IBC, it can access the network ecology of cosmos; Just a little more complicated.In response to the latter's cross-chain requirements, cosmos launched a new component - Peg-Zone on the basis of zone. Peg-Zone is actually a proxy chain used to track the status of the original chain.
Peg-Zone itself is a tendermint-based chain, so it has instant certainty and is adapted to ibc. Peg-Zone is responsible for tracking the original chain and ensuring the certainty of blocks on the proxy chain. Therefore, Peg-Zone needs to set a rule in advance, and use this rule to confirm the certainty of the block. For example, the rule can be: after adding 100 new blocks to the current block, the current block is stable , can be regarded as guaranteed determinism and will not fork.We can look at an example of Ethereum (still using POW consensus) at this stage:
The proxy chain on Peg-Zone can also send tokens to the original chain of Ethereum, using a similar mechanism. At this time, the token on Peg-Zone will appear as an ERC20 token on Ethereum.
summaryHowever, the proxy chain model of Peg-Zone also has its own problems: it needs to be specially customized for each connected chain. It is relatively easy to build a Peg-Zone proxy chain for Ethereum, because Ethereum is based on account types and has smart contracts. If you want to make a Peg-Zone proxy chain for Bitcoin, it will be very complicated-although it is feasible, it will require a lot of extra work.
summary
Cosmos believes that in addition to reducing the development cost of the blockchain and allowing different chains to have interoperability, this concept has another important advantage: scalability.
scalability
text
scalability
The improvement of cosmos in terms of scalability is divided into two aspects:
Vertical expansion: The performance improvement in the vertical direction, on the one hand, is reflected in the abandonment of the consensus algorithm of pow, and the adoption of pos+Byzantine consensus algorithm, and on the other hand, it is reflected in "blockchainization of applications" - on a virtual machine of a blockchain Developing a dapp, the efficiency of this kind of dapp operation is slower than running directly on a blockchain with built-in transaction types, data structures, and state transition functions required by this application.
Horizontal expansion: In addition to the consensus algorithm and the vertical expansion of the blockchain itself, scalability can also be attached to the multi-chain system that Cosmos wants to provide in the future. This future concept is as follows: there are a group of public verification nodes in the network, responsible for ensuring the security of a transaction, and then multiple parallel chains execute a small part of the transaction respectively, so as to achieve faster transaction processing speed.Cosmos believes that most developers now tend to develop smart contracts on Ethereum rather than develop their own chains, mainly because it is too difficult to develop a chain. But with the popularity of tendermint, the cost of developing a chain will become as simple as developing a smart contract.
interview dialogue
Cosmos' understanding of blockchain and ecology is very interesting. There may be many people, like the Orange Book, who are curious about the concept that Cosmos firmly believes that "everyone should own a chain". At the previous Shanghai Wanxiang Blockchain Summit, Orange Book happened to have the opportunity to interview Jae Kwon, the founder of Cosmos, and the core technology development team. We focused on this concept. The following is an excerpt from the conversation:Orange Book: If you use a simple paragraph to introduce what Cosmos is, what do you think are the main differences of Cosmos?
Christopher Goes, tendermint core developer
: With the development of blockchain, we see many public chains appearing. If these blockchains want to talk to each other and exchange tokens, values, assets, and even codes with each other, they need to have relevant protocols to communicate. Cosmos proposed the IBC cross-chain protocol to solve the problem of dialogue between different chains. On the other hand, public chains like Ethereum allow developers to develop their own applications, such as virtual cats, decentralized exchanges, etc., which is very cool, but these applications must run on a general-purpose virtual machine, This will actually limit the expansion of the application. Cosmos solves this problem by making many applications their own chains. The application runs on a chain specially tailored for itself, so as to increase the capacity of expansion. At the same time, with the help of the IBC protocol, these application-oriented chains can have cross-chain interoperability.Orange Book: Will we have many chains in the future? I feel that if it is compared to the Internet, we may have different website applications, but under these website applications, we may only have a tcp/ip protocol?
founder jae
jae: If you want to compare it from this angle, the ibc protocol may become the tcp/ip protocol. In the long run I agree with you that we probably won't have many chains. When the Internet first appeared, there were many different website applications. Later, a unified system emerged. Finally, Google appeared in search, only wordpress remained in the blog service, and facebook was used by everyone in social networking. There may be similar loops. But in the short term, such as the last 10 years, each project will be different because of consensus algorithms, programming languages, and communities. What is the best consensus algorithm, the best development language, and the best way to implement the blockchain are difficult to determine. Therefore, we may still need many different chains in the early stage, and a large public chain will appear in a very mature period later, which undertakes different applications. Still, I believe that even with these large public chains, everyone will still want to have their own chain.
cosmos cso jimOrange Book: I'm curious why you would believe that people would have their own chain? Because if you want to maintain a chain by yourself, it is actually very difficult?
jae: It is indeed difficult. But I think there is something similar to human instinct, the so-called "bootstrapping" ability of human beings, which tends to achieve success through their own efforts. Whenever people feel that the mainstream chain cannot meet their needs, there will be some potential value behind it. Once you have a community and a self-incentive chain, these values will grow. I think there will always be two forces that keep pushing each other: one is towards centralization and clustering, and the other is that people want some kind of substitutability, or the third Two choices.
: If you take facebook apart, there are already many chains in it. A blockchain version of Facebook may require an advertising chain, a relationship chain, an xx chain, and so on. Each of these chains is only responsible for one thing, and there are specific applications on it, while Facebook needs to optimize and adapt these chains in a unified way, controlling how fast they run and how they are upgraded. This is a very concrete application case of cosmos.: To use another example to answer why people need many chains, you can go to the financial field. If you look at some financial systems, there are many cases in which banks need to master a lot of sensitive data and control the corresponding tools due to regulatory requirements. Therefore, in addition to general-purpose public chains, these fields need to have many chains that can be controlled by themselves.
cosmos researcher sunny aggarwal
: We met a team before who believed in a concept called Local Currency very much. This idea believes that each community should have its own local currency, which can perfectly meet the needs of local residents, build a local financial system, coordinate the organization of the entire community, and achieve the " autonomy". In this scenario, each local community may need a chain of its own.
Orange Book: What challenges will Cosmos encounter in the future?
https://blog.cosmos.network/understanding-the-value-proposition-of-cosmos-ecaef63350d | Understanding the value proposition of Cosmos – Cosmos Blog
jae: We must think deeply about the security of the entire ecosystem. How to ensure the security of a system in a modular design is a challenge. So we designed a set of diverse independent storage, and a logical control component called keeper, because it is responsible for hiding the logic behind the data. These isolations are good for the security of the system, because when you build an application, you can clearly know which parts the application is composed of and how they are connected to each other. If something goes wrong, you can Very easy to locate. In the future, we may need to do more language adaptations for many different modules. The challenge we will encounter may be how to optimize these modules better, such as supporting hot plugging of different modules directly on the real-time network. Dial, wait.
Reference source:
https://tendermint.com/docs/introduction/introduction.html#abci-overview | What is Tendermint? | Tendermint Core
https://blockgeeks.com/guides/what-is-cosmos-blockchain/ | What is Cosmos Blockchain ? Most Comprehensive Guide
https://zhuanlan.zhihu.com/p/31131214 | Cosmos Interchain Communication Technical Specification [Part 1]
https://zhuanlan.zhihu.com/p/43898294 | Cosmos project and SDK introduction
https://cosmos.network/docs/sdk/core/intro.html







