The Cosmos Blockchain is a novel answer to “sidechains,” which aims to enable users to traverse a galaxy of blockchains with ease. Cosmos wants to offer multiple parallel blockchains to interoperate while retaining their security properties. Previous attempts with proof-of-work were not as successful as expected because a child chain could be attacked when the majority of the mining power was allocated to the parent chain or another child chain. Cosmos is focused on interoperability between blockchains and a low-energy consuming version of a blockchain with great scaling flexibility.
The Cosmos whitepaper describes the current blockchain related problems:
To date, blockchains have suffered from a number of drawbacks, including their gross energy inefficiency, poor or limited performance, and immature governance mechanisms. Proposals to scale Bitcoin’s transaction throughput, such as Segregated-Witness and BitcoinNG, are vertical scaling solutions that remain limited by the capacity of a single physical machine, in order to ensure the property of complete auditability. The Lightning Network can help scale Bitcoin transaction volume by leaving some transactions off the ledger completely, and is well suited for micropayments and privacy-preserving payment rails, but may not be suitable for more generalized scaling needs.
There is no doubt blockchain will play a key role in our future, however, we have to acknowledge the existing problems. The Cosmos project acquired Tendermint blockchain consensus algorithm as it’s very efficient and uses the more mature Byzantine Fault Tolerance.
Cosmos is using proof-of-stake, which means that there is no computational race for securing the blockchain as with proof-of-work. The larger stake of coins you own, the larger amount of coins you will receive. However, Cosmos uses a slightly different approach as it’s using a proof-of-stake version of Tendermint blockchain consensus.
To put it simply, Tendermint is a software which can be used to achieve Byzantine Fault Tolerance (BFT) in any distributed computing platform. The idea behind BFT is decades old, but the interest has only increased since the blockchain trend has started. Blockchain technology is nothing more than BFT in a modern setting, with an emphasis on cryptography and p2p networks.
Why do we need Tendermint?
For a decentralized system, it’s technically not possible that all nodes communicate through one central node. Therefore, fast enough communication is only possible through a mesh network. However, a mesh network allows the Byzantine Fault where false information is spread and nobody knows who’s speaking the truth. This is where Tendermint is needed as it has several mechanisms to determine the trustworthiness of nodes. Tendermint relies on a group of semi-trusted nodes to vote on blocks; as long as more than two-thirds of the voting nodes are honest, the protocol will remain active.
In short, Tendermint is responsible for:
- Validating transaction signatures.
- Preventing malicious transactions from being added to the world state.
- Updating and managing the world state of your blockchain.
- Offering query functionality against the world state. Blockchains like Bitcoin are not designed to offer querying functionality.
- Sending transactions to Tendermint Core via a simple to use API.
Cosmos Hubs and Zones
Cosmos allows multiple blockchains to run concurrently while retaining this interoperability. The Cosmos Hub is responsible for managing different Zones. Through using Hubs and Zones, Cosmos has created inter-blockchain communication (IBC) which is fairly unique. Each Zone accepts a stream of recent block commits which are forwarded to the Hub. The Hub is responsible for maintaining the world state. Validation occurs by communicating Merkle-proofs between zones to prove to other zones the information was correctly processed.
A Hub hosts a multi-asset distributed ledger, where tokens can be held by both users or zones. The cool thing here is that it’s possible to move tokens from one zone to one another. This is again accomplished through IBC communication of a coin packet. Basically, the Hub is as well a routing mechanism.
A Zone is an independent blockchain that is capable of exchanging these IBC messages with the corresponding Hub.
We mentioned earlier Cosmos is using proof-of-stake. The Cosmos network requires you to stake Atoms, the platform’s internal currency. A validator is tied to one zone of the Cosmos hub for which he is validating transactions. Your voting power is calculated by the amount of staking Atoms. Validators that act maliciously will be penalized and so lose all their staked Atoms and their share of the reserve pool. In addition, he will lose all credibility within the network.
When more than one-third of the nodes act maliciously or go down, the network will be halted, because Tendermint prefers the safety property above liveness. The only way to restart the network is by recovering it with a hard-fork reorganization proposal.
It is important to know Tendermint limits the number of validators by nature as it was discovered that blockchains become slower when there are more validators, due to the increased complexity of communicating with each other. In the first year, the number of validators is set to 100. This number will increase by 13% each year over a period of ten years, settling at 300 validators.
The Atom Token
The Atom token is the native asset to the Cosmos Hub, which can be used across the different distributed ledgers of each zone. Atoms give users the right to vote, validate, or delegate to other validators. Like Ethereum, the Atom token is considered to be the gas for paying for transactions. This fee is implemented to mitigate spam.
A distributed exchange is one of the cool concepts which is possible with Cosmos. By using the hubs and zones architecture, this mass-replicated ledger is less vulnerable for internal and external hacking attempts.
A distributed exchange is not exactly the same as a decentralized exchange (DEX). A DEX makes use of atomic swaps, which are cross-chain transactions. The downside of a DEX is that both users have to be online for the trade to succeed. A distributed exchange doesn’t require this as the trade-matching service will take care of the transaction.
A distributed exchange's added value is its high transaction throughput and capacity using the zones and Tendermint core. According to the Cosmos whitepaper, the commit latency of a transaction is comparable with those of centralized exchanges.
Bridging to Other Cryptocurrencies
A certain zone can act as a bridge token to be traded for another cryptocurrency, creating a link between a foreign and a Cosmos native cryptocurrency. In order to accomplish this, a bridge zone has to keep up with both the internal zone and the foreign cryptocurrency.
Scaling Ethereum Dapp on Cosmos Stack
If you are held back by the Ethereum performance, there are different approaches to scale your Dapp using the Cosmos stack.
The peg zone - called ‘Peggy’ - allows users to transfer ERC20 tokens to the Cosmos Hub where they can be exchanged at a much faster rate. In addition, the Cosmos Hub provides special EVM zones for ERC20 tokens. Once users are finished, they can withdraw their tokens back to the Ethereum network.
Plasma allows developers to use the Cosmos SDK for developing Dapps while their tokens are staked on the Ethereum network. These projects can rely on much faster transaction times within Tendermint zones.
The Cosmos SDK v0.10.0 was announced on the 28th of February, 2018. The Cosmos SDK is providing Dapp developers another way of building secure blockchain applications besides the EVM smart contracts. It is now possible to have different chains with different coins, enabling a true Cosmos Ecosystem.
Cosmos provides an example of a coin, called BaseCoin, that makes use of the Cosmos Ecosystem. You see here an example of the code where we set some options for our new coin like a supply and token name.[/caption]
As you can see, the code is written in Golang. The Cosmos SDK shows us as well some code for users, to be used to send messages containing arbitrary information.
At this time, the documentation on the Cosmos SDK is not great yet. Let’s hope this will change in the future.