BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

Dialogue with Cosmos: In the future, will everyone use a public chain, or will everyone have their own chain?

橙皮书
特邀专栏作者
This article is about 10137 words, reading the full article takes about 15 minutes
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.
AI Summary
Expand
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.

This article is from:Orange Book (ID: chengpishu), author: orangefans, forwarded with authorization.


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

This article is from:

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.

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:

  • 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.

Next, let's look at these two parts in detail:

tendermint core

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 ourThe 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.

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

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.

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.

The algorand introduced before is the same.

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.

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

ABCI agreement

The abci protocol includes several different message types. Tendermint core will create 3 ABCI connections to the application layer: one for verification of broadcast transactions in the memory pool; one for consensus engine operation and new block proposals; the last one for querying the status of the application layer.

Let's use a more concrete example to see the relationship between the abci protocol and the application layer, which may be more intuitive.

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:

  • We need to use abci to make a system that conforms to a similar definition. Then Tendermint Core is mainly responsible for these things:


  • 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

Cosmos SDK

Ok, we have a general idea of ​​what tendermint is.

As you can see, writing an abci is quite troublesome. In order to further facilitate users' blockchain development, Cosmos also provides a tool called Cosmos SDK. This tool standardizes some common modules in the blockchain. These common modules cover most of the functions required by the application layer, such as: staking (mortgage mechanism), slashing (punishment mechanism), IBC (cross-chain function), accounts, governance, rewards & fees, etc.

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.

The 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.

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: https://github.com/cosmos/cosmos-sdk/tree/master/docs/spec/ibc

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?

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.

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:

So, can chains that are not based on tendermint also be interconnected?

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.

However, 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

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.

secondary title

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

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?

The improvement of cosmos in terms of scalability is divided into two aspects:

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?

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.

Orange 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?

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.

secondary title

interview dialogue

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.

Orange Book: What challenges will Cosmos encounter in the future?

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://blog.cosmos.network/understanding-the-value-proposition-of-cosmos-ecaef63350d | Understanding the value proposition of Cosmos – Cosmos Blog

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://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

Cosmos cso jim: 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.

jae: To use another example to answer why people need many chains, you can look at 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.

https://cosmos.network/docs/sdk/core/intro.html

Cosmos
Welcome to Join Odaily Official Community