Cosmos / Tendermint explained for real idiots

I’m a big fan of Cosmos. So far so easy. Many people ask me “what is this Cosmos, why do you get a boner speaking of it?” and I have often explained it or tried to explain it. Here, I will try to explain it another time, hoping for a document, I can send friends in the future. I’m not part of the devs, team or foundation and I’m not going to explain it in precise technically correct terms, because there are a lot of documents doing so. Read the whitepaper, read the blog of Cosmos, watch the video made by Sunny Aggarwal, all of that is nice and technically correct. Unfortunately, I see all of this is too complicated for many folks. That’s why I try to explain for real idiots. Don’t take this as an insult, I’m also a real idiot, but once in my life I sat down and tried to understand this stuff, but being an idiot myself, I can explain it in the words of an idiot.

What makes the thing so complicated is that there are so many things that Cosmos does. One reason for that is because Tendermint. Tendermint is the software and Cosmos is the blockchain. Or more precisely the main hub for the internet of blockchains, being created by the creators of Tendermint. So let’s start understanding what Tendermint is. It describes itself as “ Byzantine fault-tolerant replicated state machines in any programming language”, so let’s decipher this stuff. Byzantine fault-tolerant means that we don’t need a single, trusted entity. Like a central bank, which releases coins and we trust it to release these coins in a sensible manner. It is called Byzantine fault, because there were some guys with some camels and they wanted to conquer the byzantine empire. Therefore they had to attack the city of Constantinople simultaneously. So far so easy. All they had to do was all attack at the same time from all sides and since they brought sabres as well as the already mentioned camels, it sounded like a possible plan. But they had no cell phones, so they could not call everyone else or send snaps around. To make it even worse some of the generals might be traitors and also the camel’s shit was quite smelly. So the traitors wanted to send some other loyal generals to death by giving false information. In contrast the leader of all the troops does not want to lose and therefore wants to prevent misleading information being spread by traitors. Unfortunately nobody knows who are the traitors and at some point it is not possible to know if information can be trusted. This whole dilemma is called the byzantine generals problem and is the prototypical/example problem, which blockchain is solving.

The siege of Constantinople. Attributed to Philippe de Mazerolles [Public domain], via Wikimedia Commons

A solution to this problem allows for decentral organized systems. The generals are a good example for a decentralized system, because it is technically not possible to connect all generals to a central authority. Therefore fast enough communication is only possible through a mesh network, but this opens up to the byzantine fault. One solution is for the leader to put signatures in their messages, but what happens if you get 6 messages with 2 different types of signatures, 3 are fake and 3 are the real ones? In this case even byzantine fault tolerant protocols fail to work. But if there is only a minority of traitors there are ways to determine, who is loyal and who is a traitor.

The next thing is “replicated state”, that is what networks of blockchains actually do. They replicate states across all nodes. It doesn’t matter if you run your node in Australia, China or the North Pole, you end up with the very same blockchain. We don’t want to argue here what you replicate for example with bitcoin, some would say it is not a state but rather unspent transactions. This is important for the developers but we are idiots and don’t want to dive too deep into hairsplitting. Now that we have mentioned bitcoin, we can also note that bitcoin has a special solution to achieve byzantine fault tolerance. The solution is called Proof of Work. We’ll come back to this later.

The fall of Constantinople indicating the byzantine generals problem was solved back then. Attribution: Jean-Joseph Benjamin-Constant [Public domain], via Wikimedia Commons

So now we have an idea what Tendermint is. A software to distribute a state of something across the globe without any central authority. This something can be anything. It can be a ledger, it can be a database of pictures, it can be a list of unresolved trade orders. It doesn’t matter. And this is awesome. It means with Tendermint you can create whatever blockchain system you need and everything is already done, except your application logic. How all nodes connect, how they reach consensus, how the blockchain is written, all of this stuff is already solved, you only need to program the desired economy of your token, if you want to make a token. You can also create a decentralized application (dapp) without a token. There are some limits, the most important one means that your application has to be deterministic. That means whatever input you give, the output can be predicted exactly or in other words, all nodes calculate the exact same next state from a given set of transactions and an initial state. Obviously this is necessary, otherwise there would be forks all the time. All of that means that Tendermint separates consensus and network layer from the application layer of a blockchain solution. That means anybody can program a blockchain without writing all the crypto and networking related code. This makes it really easy for developers to build solutions. What about big companys, maybe they want their private blockchain? No problem, Tendermint leaves it up to you, who becomes a node and how contribution is incentivized.

Now, that we realize that Tendermint makes it possible to create new shitcoins everyday even faster than before, we realize that all of these coins are built on the same foundation. Maybe it makes sense to connect these as well. This is where Cosmos comes into play. Cosmos is built with Tendermint and it is a Proof of Stake coin that uses delegation to allow anyone, even non-validators to participate in staking. We call this Cosmos Proof of Stake. This is again one of these crazy words that we as real idiots do not understand. Let’s try to understand Proof of Work (PoW) first. This is the approach that secures bitcoin. We remember from the beginning of the article that 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 transactions and who might be forging fake transactions for one’s personal benefit. PoW is based on the idea that there is hard work to be done and whoever solves this work is trustworthy. So there is a hard task that the network agrees to solve but it is easy to check and with every solution found there can be a new task spawned. Furthermore how hard the task is can be adjusted. Whoever solves the hard task first finds a new block and starts the search for the next block. Still, this stuff is decentralized. So how do we know who to trust? In that case you can just trust the longest chain. Since the longest chain has solved the most hard work, it is most trustworthy. Aha, but doesn’t this create an upward spiral of ever faster blocks and a decrease of block times? Yes it would, but as we have mentioned how hard the work is, is adjustable. Therefore the network increases how hard the the problem is, so that it always takes 10 minutes to find a new block on average. Now we might ask ourselves how this bullshit is securing the network? There is just some random arbitrary work to be done? Well, the thing is you have to acquire hardware to do that. You have to spent electricity to do that. If you decide to become malicious, buy a lot of hashpower, do all the PoW and troll the network, then you might be able to steal all the bitcoin. One reaction might be bitcoin losing its valuation, which is not too bad for you, since you stole the bitcoin anyway but your mining hardware is now worthless as well. And for that hardware you paid a lot of money. Therefore the folks with a lot of hashpower have invested a lot and thus want bitcoin to prosper. In addition it is desired that the worth of the mining hardware scales with the market cap of bitcoin. This is achieved with fees and block reward meaning that miners earn more when bitcoin has a higher valuation. As a result this incentivizes setting up more miners and therefore increasing the hardware capitalization. With this clever mechanism it is always secured that it costs many billions to destroy bitcoin via this vector. Unfortunately PoW has two very critical drawbacks. One critical drawback is that electricity is wasted. Bitcoin wastes tremendous amounts of electricity. The calculations are arbitrary and only necessary for securing the network, but they do not fulfill a purpose regarding the numbers that are calculated. Waste is always bad, but in the context of global warming wasting power is even worse. The second critical issue with PoW is the power of the miners. The miners do not need to keep bitcoin. For them it doesn’t matter how useful bitcoin is, for them only profit from mining counts. It is nice if the miners want to make the currency useful and I don’t want to discuss here how good this works for bitcoin. All I want to say is that it is possible that the miners follow a policy which drives up the fees and making a currency unusable as a currency, reducing its utility to a store of value or even worse just a collector’s item. For example for daily payments you don’t want to use a currency with transaction costs above $10. If you buy a chewing gum at a kiosk and the transactions costs much more than the item, well than we are not just real idiots but rather absolute dipshits. It is ok to be an idiot, but we don’t want to be dipshits.

Typical reaction to bitcoin’s fees

However, people have made up their minds about the problems of PoW years ago already. The most popular solution is Proof of Stake (PoS). The network is no longer secured by hard work but rather by high stakes. So to make consensus and find new blocks you no longer need hardware but rather a lot of currency in the respective currency. In PoW everyone has a chance finding a new block proportional to the amount of work being committed. Analog in PoS everyone has a chance finding a new block proportional to the amount of stake being committed. That means you can put your coins at stake, which makes them immovable and lets you participate in the consensus rounds. Remember how expensive hardware made the network secure? Here, the same happens with coins at stake. If you forge faked transactions, then the crypto currency you have staked into becomes worthless, therefore you don’t want to do that. At first glance PoS sounds so easy and much more sensible than PoW, but it comes with a some drawbacks. A prominent example is the nothing-at-stake problem. It applies to forks, so when the network splits up in two separate parts, simple PoS incentivizes stakers to just follow all forked chains. In PoW you cannot do that, because your mining hardware is limited in the amount of work it can solve. But if your staked coins just exist the same way on all forks, you have nothing to lose in a fork, just to win, thus incentivizing forks. Unfortunately forks are not very healthy for a network, they stop growth, they confuse users and slow down development process. Another problem is that all these stakers have to communicate and synchronize their opinion on the evolution of the chain. For PoW it didn’t matter all that much. Someone is going to find the next block and all others can verify that this solution is correct or not. For PoS someone must be determined who will propose the next block and then all have to agree that this block is valid. If we stick to block times in the range of 10 minutes like for bitcoin, this is not a real issue, but we know scalability is an issue on the one hand and we dont want to wait for transaction confirmation on the other hand. In fact it is not necessary to wait 6 confirmations (= 1 hour) like in the case of bitcoin to be sure a transaction is valid. This is just a consequence of PoW.

A completely unrelated funny image to allow for a refreshing interruption

I’m very sorry that this text is so long already. Maybe this also a good point to get a coffee. I’ll try to keep it as short as possible, but I don’t know how to do that, since so many people don’t know of all these intrinsic problems. But here is the good news: Now I can talk about Cosmos :D

So Cosmos solves this nothing-at-stake problem by introducing the concept of slashing. As far as I know this idea is from Jae Kwon, the head of Tendermint. The idea is that misbehaving stakers get their coins slashed. When you misbehave you lose your coins. When you forge fake transactions you lose a lot of coins. Therefore if you follow fork #2, you will get your coins slashed at fork #1. Also stakers can be forced to partake in governance processes. This also solves some problems that occurred with the DAO disaster. The next thing is if you are lazy and don’t participate in the process of forging new blocks, then you get slashed as well. It is important for network security that the stakers do participate in the creation of new blocks. Furthermore it is desired to have people stake their coins rather than having them do nothing or being traded daily. Therefore there is a dynamic inflation happening in Cosmos. Staking your coins gives you a proportional share of the inflation, causing you to not lose anything due to inflation. This is necessary to be able to keep fees low and still have an incentive for staking. The next thing is (delegated) Cosmos-Proof of Stake (CPoS), which solves the other mentioned issue. When there are 10k stakers for example, then everyone has to inspect each new block and communicate to everyone if it is ok. There are two limitations, one is latency and the other is bandwidth. For latency the physical limit for a signal to travel is the speed of light, giving roughly 66 ms time to travel to the other side of the globe. In media the speed of light is reduced, in fibre not as much as in copper, but let’s just say 100 ms. Now it depends on the network topology, for a simple example, let’s assume one participant in the consensus sends its knowledge to two others. Then it takes 14 iterations (stages) to inform all participants (since 2¹⁴ > 10k), these 14 stages take 1.4 seconds and after all are informed, they have to report back, in total 2.8 seconds. The problem with this calculation is, that it is wrong. Because in this scenario there must not be a single traitor. If there is just a single traitor for example at the first stage, then half of the network gets false information. Furthermore we have not taken into account that computers also have to do calculations. So let’s assume a calculation takes 50 ms, this is for example the actual check if a block is valid. But there is also room left for optimization, there is no need to send the new block to just 2 other network members. We can just send to all 10k. So the one who forged the new block, sends it to all 10k, they calculate if it is correct, 150 ms have passed. Then all 10k send to all other 10k and they calculate who might be traitors, another 150 ms have passed. Then all 10k agree on the new block and raise their concerns about the traitors and propose the forger of the next block. Another 150 ms, totalling at 450 ms. Great, we can get block times of less than 1s. Pretty decent compared to bitcoin’s 10 minutes. Furthermore blocks are final. With this approach there is no need to wait for 6 or 32 blocks to have passed to be sure that everything is valid. That is because we no longer trust the longest chain but rather agree all according to our stakes. Ok, so let’s just check the other caveat and that is bandwidth. For a first calculation let’s assume a block size of the original bitcoin, 1 MB. Assuming we have to send out the whole block every 150 ms to all 10k participants, we need an internet connection with 67 GB/s bandwith. Normally this is denoted in bit/s and not byte/s, so this would be 532 Gbit/s. Quite a decent connection. Some people have 100 Mbit/s or some lucky guys in student dorms have 1 Gbit/s, but nobody has 532 Gbit/s especially not to any location in the world. Our initial example with 2 recipients at each stage is possible though, there we only need roughly 100 Mbit/s, if we calculate with 150 ms intervals. In reality we need less, because we do not need to transfer the whole block in all rounds. In the last rounds, we only need to send confirmation. However, the first round cannot be delayed too much for latency reasons. But here comes another problem, we have reverted back to the 2 recipients per round. With that value we ended up at 2.8s. Unfortunately we have made the mistake there that there is no byzantine fault tolerance. To get that there have to be many more stages and there is no way to have block time in the range of 1s. So here we have a real dilemma. With 10k network participants, we either have not enough bandwidth to broadcast to all participants at the same time or the latency is too high to have many stages of information distribution and block times in the range of a few seconds are not possible. Keep in mind that talking of network participants we mean the people who participate in the consensus. The users of the blockchain who just read and send transactions do not need to partake in this process. The finalized blocks can be broadcasted to millions because there is no necessity of two way synchronization.

Me reading the whitepaper of Cosmos for the first time

The solution to this problem is delegation. Hence the name delegated Cosmos-Proof of Stake. The stakers are split up in two groups, the delegators and the validators. The validators are the participants of the consensus mechanism, whereas the delegators are not part of the direct network communication. In this case we can limit the number of validators to a fixed number, for example 100. Now even if 10k want to stake or even 100k want to do that, the problem of synchronizing all these nodes is gone. Synchronizing 100 participants is not a big problem, with our initial example of a power of 2, we need 7 stages, if 10 recipients get the new blocks, then 2 stages are enough for simple information passing. For byzantine fault tolerance we need some extra rounds, but it is possible to forge new blocks in a few seconds with normal internet connections. So what do the delegators do? They vote on the validators. They still secure the network with their stake. It makes sense to pick validators that also have a lot of coins at stake, so they don’t become malicious, but the delegators also decide which validators are to support. Therefore you can participate in getting stake rewards, but don’t need to setup a strong node. This is the job of the validators, who get a bit more return for their work. But just as the yearly inflation is dynamic in Cosmos the commission for the validators is also dynamic. The former is adjusted so that at more than 66% of coins are staked (in proof of work 50% of hashing power has to be non-malicious, in practical byzantine fault tolerance 66%) and the latter is adjusted so that commission can be kept reasonably low but validators still have an incentive to run a node. This is achieved through competition between validators for delegation. One more remark is important here, if your validator gets slashed, you also lose your staked coins. That’s why it is important to split your delegated coins as well as keep an eye on the validators, which is an incentive to monitor what is happening, thus keeping the network secure. The 1 MB block size was just an example here, of course this is dynamic again. But it is picked here to show that Cosmos is able to handle 600 times more information than bitcoin without waste of electricity.

Cosmos serves as a hub to many zones, which represent specific blockchains

Ok, so Cosmos is technically well thought through and somehow improves scalability vertically. That’s great, but a lot of coins are doing that, right? Absolutely right. There are many many coins doing this. And to be honest, this is not what is so awesome about Cosmos. So fasten your seat belts, we’re approaching the delicious facts now. Finger licking good. Cosmos is also a multi token platform. You cannot only have atoms in Cosmos, which are the staking tokens of Cosmos, you can also have photons, which are the fee tokens of Cosmos. So one coin for this whole consensus stuff and another coin for paying transactions. These photons are not staked and therefore are very fluid at exchanges. Furthermore photons are also the native token of the ethermint network. Ethermint is Ethereum hosted on Tendermint. Same functionality as Ethereum, but consensus as described above. This solves the vertical part of the scalability issue. Since Cosmos is not meant to be a competitor to other ecosystems, the creation of ethermint is called a hard spoon (read more about it). This means all ETH holders get photons and can use ethermint just as ethereum, but with much less fees and it is connected to the Cosmos network. Cosmos network? Well, actually Cosmos describes itself as the internet of blockchains. That is because in this cosmos there are zones connected through hubs. The zones can be anything that can be created with Tendermint. One zone is ethermint obviously. Another zone can be a bitcoin peg zone for example. That means you can deposit real bitcoin there for bitcoin-inside-cosmos-token. Once you have these token you can transfer them to the Cosmos hub and trade them to some other token, photons for example or whatever is also available. Another zone might be an Euro peg zone, where you deposit Euro to a bank account and get some Euro-inside-cosmos-token. Now you can trade these Euro-token vs. some bitcoin token and after the trade, redeem real bitcoin at the bitcoin peg zone. Your trade partner then redeems Euro at the Euro peg zone. What you two have done then is a decentralized trade. Is this directly possible with Cosmos? No, but it is very easy to create a zone connected to Cosmos that allows decentralized trading. In fact this creation of zones and connecting them through hubs is the outstanding feature of Cosmos. Imagine there is an app on Ethereum that clogs the network by creating more than 10% of the traffic and it is all about cute kittens. In Cosmos the developers can decide to create a specific zone just for these sweet kittens. If the kitten mania breaks out completely and even that zone is not handling transactions fast enough, the developers can just spawn another kitten zone, which runs in parallel to the first one. Through the Cosmos hubs the kittens between zones can be exchanged in a decentralized manner. We have heard of vertical scaling sometimes in this article; this is the other approach and it is called horizontal scaling. Horizontal scaling is asynchronous and makes things a bit more complicated but it is not as limited as vertical scaling (by bandwidth and latency…). All of that means it is possible to build tree like structures of hubs and zones, opening up for enourmous scaling of blockchain technology. Many might have heard of sharding that the ethereum devs are currently working on. It is different, sharding works automatically. For Cosmos hubs and zones developers have to sit down and build it manually. But a big advantage of zones are that every zone can be build indepently. A zone can have its own economy and private blockchains can be connected as well. This already indicates the spirit of the Cosmos project. It is not about taking over the whole crypto space as many other projects are claiming. It is just about connecting everything together. There is no future with a single blockchain solving everything in the best way. The future will have many application specific blockchains tailored to the needs of its users and developers. Cosmos wants to connect these blockchains to the existing blockchains. Tendermint wants to give these application specific blockchains a substrate. This is why Tendermint and Cosmos cannot be looked at separately. Both make the other thing much more valuable.

There can be many hubs — all interconnected

I hope this text wall helps some real idiots. Here are also the answers to the most frequently asked questions:

When ICO?
April 2017

When available at exchanges?
Cosmos will not be usable before mainnet launch. Atoms will still not be tradeable then. They have to be unbounded first. So photons will hit markets before atoms will be available. Atoms will be unbonded some weeks after the launch. So they might be available some weeks after launch.

When moon?
Moon does not matter. The solar system must be left for reaching the cosmos.

Is this ERC20?
Read the text again. How can this be an ethereum token? The only possible thing would be ERC20 token serving as IOUs for atom coins when mainnet launches. This has not been done, because Cosmos team has no interest in crazy speculation and maybe also because of US regulations :>

How many atoms were raised?
168 million in the ICO and 50 million more for team, foundation and strategic partnerships.

How many atoms do I need to stake?
Any.

When is the snapshot for ethermint?
I don’t know. Subscribe to Cosmos blog. I’m sure you’ll be noticed then.

When can I start developing things with Tendermint?
Today. You can build now and integrate into Cosmos later. See this article.

I did not read any of the above, when is ICO?

How will Cosmos change the world?
Please see the image below:

Edit: More FAQ
What was the ICO price?
Actually it is called fundraiser, it was $0.1 per atom, or 450 atoms for 1 ETH. So if you want to take into account that whole cryptospace exploded, you can scale this $0.1 with the rise of ETH and say one atom would be $2 today. This is the comparison to an alternative investing in ETH.

Is the amount of atoms ultimately fixed?
No, there is an ever ongoing inflation. Default value is 7% but it can be adjusted, so that majority stakes. Keep in mind that you get the atoms from inflation if you stake your atoms. Therefore inflation does not dilute your portion of atoms regarding all atoms, as long as you stake.

When is the launch of the mainnet?
It was postponed from end of february to “when it’s done”. See roadmap for how far it’s done https://cosmos.network/roadmap

At which exchange can I buy atoms?
There will be decentralized as well as central exchanges listing atoms. Ethfinex seems to list atoms https://www.ethfinex.com/token_listings/37/social_subcategory/223/whitepaper?parentCid=220

Like what you read? Give Patrick Wieth a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.