Skip to content
Branch: master
Find file Copy path
5 contributors

Users who have contributed to this file

@gamarin2 @zramsay @jackzampolin @sunnya97 @okwme
76 lines (61 sloc) 3.26 KB

Getting Started

In this tutorial, you will build a functional Cosmos SDK application and, in the process, learn the basic concepts and structures of the SDK. The example will showcase how quickly and easily you can build your own blockchain from scratch on top of the Cosmos SDK.

By the end of this tutorial you will have a functional nameservice application, a mapping of strings to other strings (map[string]string). This is similar to Namecoin, ENS, or Handshake, which all model the traditional DNS systems (map[domain]zonefile). Users will be able to buy unused names, or sell/trade their name.

All of the final source code for this tutorial project is in this directory (and compiles). However, it is best to follow along manually and try building the project yourself!



Through the course of this tutorial you will create the following files that make up your application:

├── Gopkg.toml
├── Makefile
├── app.go
├── cmd
│   ├── nscli
│   │   └── main.go
│   └── nsd
│       └── main.go
└── x
    └── nameservice
        ├── client
        │   ├── cli
        │   │   ├── query.go
        │   │   └── tx.go
        │   ├── rest
        │   │   └── rest.go
        │   └── module_client.go
        ├── codec.go
        ├── handler.go
        ├── keeper.go
        ├── msgs.go
        ├── querier.go
        └── types.go

Start by creating a new git repository:

mkdir -p $GOPATH/src/{ .Username }/nameservice
cd $GOPATH/src/{ .Username }/nameservice
git init

Then, just follow along! The first step describes the design of your application. If you want to jump directly to the coding section, you can start with the second step

Tutorial parts

  1. Design the application.
  2. Begin the implementation of your application in ./app.go.
  3. Start building your module by defining some basic Types.
  4. Create the main core of the module using the Keeper.
  5. Define state transitions through Msgs and Handlers.
  6. Make views on your state machine with Queriers.
  7. Register your types in the encoding format using sdk.Codec.
  8. Create CLI interactions for your module.
  9. Create HTTP routes for clients to access your nameservice
  10. Import your module and finish building your application!
  11. Create the nsd and nscli entry points to your application.
  12. Setup dependency management using dep.
  13. Build and run the example.
  14. Run REST routes.

Click here to get started with the tutorial!

You can’t perform that action at this time.