Introduction to Blockchain | Introduction to Cosmos that Xiaobai can understand

Foreword: This article introduces what Cosmos is in plain language, and also explains the basic knowledge of many blockchains, suitable for beginners to read.

I am a big fan of Cosmos. It's so easy so far. Many people ask me "What is Cosmos, why do you talk about this seriously?", I often explain to them or try to explain them to them. Here, I tried to explain it again, I hope to write a document, so I can send it to my friends later.

I am not a developer, a team, or a member of a foundation. I will not explain it with precise technical terms, because there are already a lot of documents to do this. Read the white paper, read the Cosmos blog, and watch the video taken by Sunny Aggarwal, all of which are great and technically correct.

Unfortunately, I found that all of this is too complicated for many people. That's why I tried to explain to the real little whites. Don't be humiliated, I am also a little white, but once I sat down and tried to understand these things, because I am also a little white, so I can explain it in a small white language.

Cosmos did a lot of things, so it made things complicated. One reason is because of Tendermint. Tendermint is software and Cosmos is a blockchain. Or rather, the main hub of the blockchain Internet created by the creators of Tendermint.

So let's start to understand what Tendermint is. It describes itself as "byzantine fault-tolerant replication state machine in any programming language", let us decipher this thing. Byzantine fault tolerance means that we don't need a single trusted entity. Like the central bank that issues currency, we believe it will issue money in a reasonable way. It is called Byzantine fault tolerance because some people are riding camels and want to conquer the Byzantine Empire.

Therefore, they need to attack the city of Constantinople at the same time. It's so easy so far. All they have to do is launch attacks from all sides, because they bring the saber and the camel mentioned earlier, which sounds like a viable plan. But they don't have a mobile phone, so they can't call or take snapshots. To make matters worse, some generals may be traitors, and the camel's droppings are hard to smell.

Therefore, the traitors want to send other loyal generals to the guillotine by providing false information. On the contrary, all the leaders of the army do not want to lose, so it is necessary to prevent the traitors from spreading misleading information. Unfortunately, no one knows who is a traitor, and to some extent, it is impossible to know if the information is credible. The whole dilemma is called the Byzantine general problem, which is also a typical/example problem that the blockchain is working on.

01

(The siege of Constantinople. Philippe de Mazerolles [public copyright] works from Wikimedia Commons)

One solution to this problem is to allow decentralized organizational systems. The generals are a good example of a decentralized system because it is technically impossible to connect all the generals to a central authority. Therefore, only fast enough communication can be done through the mesh network, but this will lead to Byzantine errors.

One solution is for the leader to add a signature to their message, but what happens if you get 6 messages with 2 different types of signatures, 3 are fake, and 3 are true? In this case, even the Byzantine fault-tolerant agreement will not work. But if there are only a few traitors, there is a way to determine who is loyal and who is a traitor.

Next is the "replication state", which is what the blockchain network actually does. They replicate state between all nodes. Whether you run your node in Australia, China or the North Pole, you end up with the same blockchain. We don't want to discuss here what you copied with bitcoin. Some people would say that this is not a state, but an unspent transaction.

This is very important for developers, but we are white and don't need to be too particular about the details. Since we mentioned Bitcoin, we also noticed that Bitcoin has a special solution to achieve Byzantine fault tolerance. This solution is called a proof of workload. Let's talk later.

02

(The fall of Constantinople shows that the problem of General Byzantine was resolved at the time. Jean-Joseph Benjamin-Constant [public copyright] works from Wikimedia Commons)

So now we know what Tendermint is. It is software that distributes a state globally without any central authority. The "some" here can be anything. It can be a book, an image database, or a list of unfilled transaction orders. It doesn't matter. This is really great.

This means that with Tendermint, you can create any blockchain system you need, and everything is done for you except for the application logic. How to connect between nodes, how to reach a consensus, how to write a blockchain, all these problems have been solved, if you want to create a token, you only need to write the required token economic model. You can also create a decentralized application (dApp) that does not use a token.

There are some limitations here, and the most important thing is that your application must be deterministic. This means that no matter what input you provide, you can accurately predict the output. In other words, all nodes will calculate the exact same next state based on the given set of transactions and the initial state. Obviously this is necessary, otherwise there will always be a fork.

All of this means that Tendermint separates the consensus and network layer from the application layer in the blockchain solution. This means that anyone can write a blockchain program without writing encryption and network-related code. This makes it easy for developers to build solutions. Big companies, maybe they want their own private blockchain? No problem, Tendermint gives you the decision, who can be a node, and how to motivate contributors.

Now, we realize that Tendermint can create new tokens every day, even faster than before, all of which are built on the same foundation. Maybe it makes sense to relate them. This is where Cosmos comes into play.

Cosmos is built using Tendermint, which has a proof of tokens and uses commissions to allow anyone, even non-verifiers, to participate in the pledge. We call this the Cosmos equity certificate. This is another crazy term that we can't understand.

Let's first take a look at the proof of work (PoW). This is the way to ensure bitcoin security. Remember, at the beginning of the article, we need a way to determine who is a traitor and who is loyal. In the world of cryptocurrencies, this means who is creating new blocks with valid deals, and who may fake fake transactions for personal gain.

PoW is based on the idea of ​​doing a difficult job and whoever you trust to do it. Therefore, the network agrees to solve this difficult task, and the results are easy to verify, and once the problem is solved, a new task will be created. In addition, the difficulty of the task can be adjusted. No matter who solved the problem first, I found a new block and then started looking for the next block.

However, these things are decentralized. So how do we know who to trust? In this case, you can trust the longest chain. Because the longest chain solves the most difficult work, it is the most trustworthy. Aha, but isn't this a spiraling rise in the speed of the block and a reduction in the time of the block? Yes, but as we mentioned, the difficulty of the work can be adjusted.

Therefore, the network will increase the difficulty of the problem, so it takes an average of 10 minutes to find a new block. Now we may ask ourselves, how does this stuff guarantee network security? Just do some random arbitrary work? Ok, the problem is that you have to buy hardware to do this. You have to use electricity to do this.

If you decide to do evil, buy a lot of hashing power, complete all PoW work and control the network, then you can steal all the bitcoins. One reaction may be bitcoin depreciation, which is not too bad for you, because you have stolen Bitcoin anyway, but your mining hardware is now worthless. You spent a lot of money on hardware.

Therefore, those who have a large amount of hashing power invest a lot of money, and they also hope that Bitcoin can flourish. In addition, it is hoped that the value of mining hardware will be commensurate with the market value of Bitcoin. This is achieved through fees and block rewards, which means that when the valuation of Bitcoin is higher, the miners' income will be higher.

Therefore, this will inspire more miners and thus increase hardware capital. With this clever mechanism, the cost of destroying Bitcoin through this carrier can be as much as billions of dollars. Unfortunately, PoW has two very critical flaws. A key flaw is wasting power. Bitcoin wastes a lot of power. These calculations are arbitrary and only meaningful for protecting network security, but the numbers they calculate are not intended to achieve a certain purpose. Waste is always bad, and in the context of global warming, wasting energy is even worse.

The second key issue for PoW is the power of miners. Miners don't need to keep bitcoin. For them, it doesn't matter how useful Bitcoin is. They care about the benefits of mining. It would be better if the miners wanted Bitcoin to be more useful, but I don't want to discuss the benefits of Bitcoin here.

What I want to say is that miners may follow a certain strategy, increase the handling fee so that they cannot be used as currency, become a value store, or even worse, just a collectible. For example, for daily payments, you won't use currencies with transaction costs greater than $10. If you buy a piece of chewing gum at a kiosk, but the transaction cost is much higher than the product itself, then we are not only white, but also an absolute fool. We can be white, but we don't want to be a fool.

However, many years ago people were determined to solve the PoW problem. The most popular solution is proof of interest (PoS). The network no longer passes the workload difficulty, but relies on high shareholding to obtain security guarantees. So, in order to reach consensus and find new blocks, you no longer need hardware, but you need to hold a lot of tokens.

In PoW, everyone has the opportunity to find a new block that is proportional to the amount of work invested. In the PoS simulation, everyone has the opportunity to find a new block that is proportional to the number of shares invested. This means that you can pledge your tokens so that they are frozen and participate in the round of consensus.

Remember the expensive hardware that keeps your network secure? Here, the same thing happens on the tokens of the pledge. If you fake a fake transaction, then the cryptocurrency you pledge becomes worthless, so you won't do it. At first glance, PoS sounds simpler and more sensible than PoW, but it also has some drawbacks.

A prominent example is the "nothing-at-stake" problem. It applies to the fork, so when the network splits into two separate parts, a single PoS encourages the shareholder to follow all the forks. In PoW, you can't do this because your mining machine is limited by the amount of work it can do. But if the tokens you pledge exist on all the forks in the same way, you won't lose anything on the forks, and in order to get more profit, you will encourage the fork.

Unfortunately, forks are unhealthy for the web, they stop growing, confuse users, and slow down the development process. Another problem is that all these equity pledgers must communicate and synchronize their views on the evolution of the chain. For PoW, this doesn't matter. Someone will find the next block, and everyone else can verify that the solution is correct.

For PoS, you must determine who will propose the next block, and then everyone must agree that the block is valid. If we insist on 10 minutes of block time like Bitcoin, this is not a problem, but we know that the scalability issue is one aspect, and on the other hand we don't want to wait for the trade confirmation. In fact, there is no need to wait for 6 block confirmations (=1 hours) like Bitcoin to ensure the deal is valid. This is just the result of PoW.

Sorry, this text is too long. Maybe this is also a good time to have a cup of coffee. I will try to shorten the time, but I don't know what to do because many people don't know all these inner problems. But the good news is: Now I can talk about Cosmos 😀

So Cosmos solves this "no interest" problem by introducing the concept of "subtraction" punishment. As far as I know, this idea was put forward by Jae Kwon, head of Tendermint. Their idea is that misconducted pledge holders will be deducted from tokens. When you misbehave, you lose your token. When you fake a fake transaction, you will lose a lot of tokens.

Therefore, if you follow the fork #2, your token will be deducted at the fork #1. Similarly, equity pledges may also be forced to participate in the regulatory process. This also solves some of the problems that arise in the DAO disaster. The next thing is, if you are lazy and don't participate in the process of producing new blocks, then you will also be deducted from the tokens. Engaging equity pledges in the creation of new blocks is important for cybersecurity.

In addition, people are encouraged to pledge their tokens instead of letting them do nothing or trade daily. Therefore, there is a dynamic inflation in Cosomos. Pledging your tokens will account for a corresponding percentage of inflation, so that you won't lose anything because of inflation. This is necessary to keep the handling fee low and still encourage token pledge.

The next thing is (trusted) Cosmos Proof of Entitlement (CPoS), which solves another problem mentioned earlier. For example, when there are 10,000 equity pledges, each person must check each new block, and if there are no problems, everyone must be notified.

There are two limitations, one is latency and the other is bandwidth. For delays, the physical limit of signal transmission is the speed of light, which takes approximately 66 milliseconds to travel to the other side of the Earth. In the medium, the speed of light is reduced, the speed of propagation in the fiber is different from that in the copper cable, but we say 100 milliseconds.

Now it depends on the network topology. For a simple example, let's assume that one participant in the consensus sends his knowledge to the other two participants. Then 14 iterations (stages) are required to inform all participants (because 214 > 10000), which requires 1.4 seconds. After all participants have been notified, they must send a reply for a total of 2.8 seconds. The problem with this calculation is that it is wrong. Because in this case, there can be no traitor. For example, if there is a traitor in the first phase, then half of the network will get the wrong message.

In addition, we did not consider that the computer must also perform calculations. Suppose that a calculation takes 50 milliseconds, for example, to actually check if a block is valid. But there is also room for optimization, so you don't have to send new blocks to only the other 2 network members. We can send it to all 10,000 participants. Therefore, the person who produced the new block was sent to all 10,000 participants, and they calculated it to see if it was correct. It has passed 150 milliseconds. Then all 10,000 participants were sent to all the other 10,000 participants who calculated who might be a traitor and passed 150 milliseconds. Then all 10,000 participants agreed to the new block, raised their concerns about the traitors, and suggested the producers of the next block. Plus 150 milliseconds for a total of 450 milliseconds.

Great, we can get block time less than 1 second. Compared with Bitcoin's 10 minutes, it is quite good. In addition, the block is final confirmed. With this approach, there is no need to wait for 6 or 32 blocks to ensure that everything is valid. This is because we no longer trust the longest chain, but we agree on our interests. Ok, let's check out another limitation, which is bandwidth.

For the first calculation, we assume the same size as the original bitcoin block, 1MB. Assuming we have to send the entire block to all 10,000 participants every 150 milliseconds, we need a 67 GB/s bandwidth internet connection. Usually this is expressed in bit/s instead of byte/s, so this will be 532 Gbit/s. This is a pretty good connection. Some people have a bandwidth of 100 Mbit/s. Some lucky people have 1 Gbit/s of bandwidth in the student residence, but no one has 532 Gbit/s of bandwidth, at least not anywhere in the world.

However, it is possible in the initial example where there are only 2 receivers at each stage. If we calculate at 150 ms intervals, then only about 100 Mbit/s of bandwidth is needed. In fact, we need less because we don't need to transfer the entire block in all rounds.

In the last round, we only need to send a confirmation. However, the first round cannot be delayed too much. We have retreated to 2 recipients per round, but another problem has arisen. Using this value we calculated the result is 2.8 seconds. Unfortunately, we made a mistake and did not consider Byzantine fault tolerance. In order to achieve this, there must be more stages, so that the block time cannot be limited to 1 second.

So here we have a real dilemma. For 10,000 network participants, we either didn't have enough bandwidth to broadcast to all participants at the same time, or the delay was too high to distribute multiple stages of information, and we couldn't limit the block time to a few seconds.

Remember that the network participants mentioned here refer to those who participate in the consensus. Blockchain users who have just read and sent transactions do not need to participate in this process. The final confirmed block can be broadcast to millions of users because there is no need for two-way synchronization.

The solution to this problem is to commission. Therefore, it is called to entrust the Cosmos equity certificate. The rights pledgeers are divided into two groups, the principal and the verifier. The verifier is a participant in the consensus mechanism, and the principal is not directly involved in network communication. In this case, we can limit the number of verifiers to a fixed number, for example 100.

Now, even if 10,000 or even 100,000 people want to pledge, the problem of synchronizing all of these nodes no longer exists. Synchronizing 100 participants is not a big problem. Our initial example is a power of two. If there are 10 receivers that need to acquire new blocks, then 7 phases are needed. For simple information transfer, 2 phases are sufficient.

For Byzantine fault tolerance, we need some extra rounds, but under normal internet connection, we can create new blocks in seconds. So what does the client need to do? They voted for the verifier. They still use their tokens to protect their network security. It makes sense to choose a certifier that pledges a lot of tokens so that they don't do evil, but the principal can decide which credential to support.

Therefore, you can participate in obtaining a pledge token reward, but you do not need to set a strong node. This is the work of the verifier, and their work will get more rewards. But just as the annual inflation in Cosmos is dynamic, the Certifier Committee is also dynamic.

The former is adjusted to ensure more than 66% of the token pledge (in the proof of work, 50% of the hash calculation must be honest, 66% in practical Byzantine fault tolerance), the latter is adjusted In order to keep the committee at a reasonably low level, the verifier still has the motivation to run the node. This is achieved by verifying the competition authority between people.

There is one more important sentence here. If your verifier is punished, the token you pledge will be lost. That's why it's important to spin off your proxy tokens and keep an eye on the verifier. This is an incentive to monitor what's happening to keep your network safe. The 1 MB block size is just an example here, and of course this is also dynamic. But the purpose of choosing it here is to prove that Cosmos can process 600 times more information than Bitcoin without wasting power.

03

(Cosmos is the hub of many zones that represent specific blockchains.)

Ok, so Cosmos is technically well considered and improves vertical scalability to some extent. This is great, but a lot of tokens are doing this, right? Completely correct. There are a lot of tokens doing this. Honestly, this is not a great thing in Cosmos. So please fasten your seat belts and we are now approaching a delicious dinner. Prepare your fingers.

Cosmos is also a multi-token platform. Cosmos not only has Atom (atomic), but also Cosmos's pledge token, and also photon (photon), which is Cosmos's fee token. Therefore, one token is used for the entire consensus mechanism and the other token is used for payment transactions. These Photon are not pledged, so there is a strong liquidity in the exchange.

In addition, Photon is also the native token of the ethermint network. Ethermint is an Ethereum hosted on Tendermint. Same function as Ethereum, but using the consensus as described above. This solves the vertical part of the scalability issue. Since Cosmos is not intended to be a competitor to other ecosystems, the creation of ethermint is called "hard spoon." This means that all ETH holders can get Photon and use ethermint like Ethereum, but with much less commissioning and it is connected to the Cosmos network. Cosmos network?

In fact, Cosmos describes itself as the internet of blockchains. This is because in this Cosmos, the zones are connected by the hub. These areas can be anything created with Tendermint. Ethermint is obviously one of the zones. Another area can also be an area linked to Bitcoin. This means you can store the real bitcoin in exchange for the bitcoin token in Cosmos. (Blue Fox Note: This achieves a decentralized cross-chain token circulation.)

Once you have these tokens, you can transfer them to the Cosmos hub and trade them to other tokens, such as Photon or any other available token. Another area may also be an area anchoring the euro, where you can deposit the euro in a bank account in exchange for some euro tokens in Cosmos. Now you can trade with these Euro tokens and Bitcoin tokens. After the transaction is completed, redeem the real Bitcoin in the Bitcoin Link Zone. Then, your opponent will redeem the Euro in the Euro Link Zone. The two of you are doing a decentralized transaction.

Is this directly feasible in Cosmos? No, but it's easy to create a zone that is connected to Cosmos, allowing decentralized transactions. In fact, creating zones and connecting them through the hub is a prominent feature of Cosmos. Imagine an app on Ethereum that blocks the network by creating more than 10% of traffic, all about cute kittens.

In Cosmos, developers can decide to create a specific zone for these cute kittens. If the kitten is completely out of heat, even if the area handles the transaction fast enough, the developer can generate another kitten area to run in parallel with the first area. Through the Cosmos hub, kittens between zones can be traded in a decentralized manner.

We have heard vertical expansion in this article; there is another way, called horizontal expansion. Horizontal scaling is asynchronous, making things more complicated, but it doesn't have the limitations of vertical scaling (bandwidth and latency…). All of this means that it is possible to establish a tree structure of the hub and the district, opening the door to the great expansion of the blockchain technology.

Many people may have heard of the shards being developed by Ethereum developers. This is different and the shards will work automatically. For the Cosmos hub and zone, developers must sit down and build by hand. But one big advantage of partitioning is that each zone can be built independently. A district can have its own economic model, and private blockchains can also be connected. This has already demonstrated the spirit of the Cosmos project. It does not take over the entire encryption space as many other projects claim.

It just connects everything together. Relying on a single blockchain to solve all problems in the best way is no future. In the future, there will be many application-specific blockchains to meet the needs of its users and developers. Cosmos wants to connect these blockchains to existing blockchains. Tendermint wants to give a base to the blockchains that are specific to these applications. That's why Tendermint and Cosmos can't be separated separately. Both make the other party more valuable.

04

(You can have multiple hubs – all interconnected)

The author is Patrick Wieth, translated by the "Blue Fox Notes" community "Xin Xin".