
Source: Twitter.com
Introduction to the Cosmos Ecosystem.
Cosmos was one of the first to step into bringing the “Internet of Blockchains” to life. Cosmos consists of multiple independent blockchains running in parallel, backed up by the Proof-of-Stake Byzantine Fault Tolerant Algorithm, such as Tendermint consensus. Cosmos SDK makes use of Tendermint, which keeps check that the system reaches consensus even if a node in the system fails or behaves maliciously. Cosmos SDK aims to provide an open-source framework for developers to create interoperable customized blockchains. Cosmos SDK is powerful enough to tackle scalability, usability, governance, and security related issues. Cosmos has made it so much easier to build on top of the Cosmos network. Moving ahead, let’s have a brief view at some Cosmos tools meant for developer’s ease.
Cosmos SDK Modules: While most of the logic is defined by modules; they are also seen as the building blocks to construct the entire decentralized application. The module consists of the core which provides basic functionalities, the boilerplate implementation is communicated with the underlying consensus engine. Working in modules makes it easier to build complex blockchain applications.
Tendermint: Tendermint, facilitating creation of Proof-of-Stake systems is also known as gold consensus engine. It is the most popular, mainly because of the high security it provides to the developers.
Inter-Blockchain Communication (IBC): This tool lets the distributed ledgers spread across the network communicate with each other for exchange of data and value. IBC defines a set of standards to transmit data and allows compatible supported ledgers to be interconnected without any restrictions.
Let’s learn how to get started with Cosmos.
We’ll run through the initial steps for creating your own blockchain application on top of Cosmos SDK Network.
Prerequisites:
-Golang > 1.15 installed
-GitHub account and GitHub CLI/GitHub Desktop
For this setup we will be using Starport version 0.13.1, an easy tool to use for building blockchains.
To install starport into /usr/local/bin, run the following command:
curl https://get.starport.network/starport@v0.13.1 ! | bash
These are the files that you must create in your system which make up the application.
./nameservice
├── Makefile
├── Makefile.ledger
├── app.go
├── cmd
│ ├── nameservicecli
│ │ └── main.go
│ └── nameserviced
│ └── main.go
├── go.mod
├── go.sum
└── x
└── nameservice
├── alias.go
├── client
│ ├── cli
│ │ ├── query.go
│ │ └── tx.go
│ └── rest
│ ├── query.go
│ ├── rest.go
│ └── tx.go
├── genesis.go
├── handler.go
├── keeper
│ ├── keeper.go
│ └── querier.go
├── types
│ ├── codec.go
│ ├── errors.go
│ ├── expected_keepers.go
│ ├── key.go
│ ├── msgs.go
│ ├── querier.go
│ └── types.go
└── module.go
A blockchain application is just a replicated deterministic state machine which consists of two main parts: state and messages. As a developer you are required to define state machine. Cosmos SDK is a modular framework. Each module contains its own messages. Before we have a close look at what state and messages are. Let’s view the modules which help create the state machine and will be needed for nameservice application.
auth: This module describes accounts and fees, gives access to these functionalities to the rest of your application.
bank: This module allows the application to create and manage tokens and its balances.
staking: This module enables the application to have validators that people can delegate to.
distribution: This module will help to distribute between validators and delegators effectively.
slashing: This module disincentivizes people such as validators with value staked in the network.
supply: This module will contain the total supply of the chain.