Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
cn fix cn docs (#121) Jul 19, 2019
README.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jul 18, 2019
alias.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jul 18, 2019
app-complete.md some doc fixes Aug 1, 2019
app-design.md Merge PR #120: Update to SDK v0.36.0-rc1 Jul 25, 2019
app-init.md some doc fixes Aug 1, 2019
build-run.md Add git clone step to build instructions (#130) Aug 12, 2019
buy-name.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jun 17, 2019
cli.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Aug 2, 2019
codec.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jun 17, 2019
delete-name.md Resolved a minor formatting issue. Jun 21, 2019
dep.md hotfix name breaks build Jun 7, 2019
entrypoint.md Merge PR #120: Update to SDK v0.36.0-rc1 Jul 25, 2019
errors.md Incorporated review comments. Jun 19, 2019
genesis.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jun 17, 2019
gomod.md make docs up to date (#112) Jun 29, 2019
keeper.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jun 20, 2019
key.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jul 18, 2019
module.md some doc fixes Aug 1, 2019
msgs-handlers.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jun 18, 2019
queriers.md Update tutorial to match recent code changes (#98) Jun 14, 2019
rest.md Merge remote-tracking branch 'origin/master' into aayushijain23/add-n… Jul 18, 2019
run-rest.md Updated the tutorial, mainly build-run.md and run-rest.md with detail… Jun 18, 2019
set-name.md Update tutorial to match recent code changes (#98) Jun 14, 2019
types.md tutorial .mds update (#104) Jun 21, 2019

README.md

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!

Requirements

Tutorial

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

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

Start by creating a new git repository:

mkdir -p $GOPATH/src/github.com/{ .Username }/nameservice
cd $GOPATH/src/github.com/{ .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. Define the keys needed for your module key.
  5. Define errors that are custom to your module Errors.
  6. Create the main core of the module using the Keeper.
  7. Define state transitions through Msgs and Handlers.
  8. Make views on your state machine with Queriers.
  9. Create the alias file
  10. Register your types in the encoding format using sdk.Codec.
  11. Create CLI interactions for your module.
  12. Create HTTP routes for clients to access your nameservice.
  13. Implement the AppModule interface
  14. Configure your Genesis state.
  15. Import your module and finish building your application!
  16. Create the nsd and nscli entry points to your application.
  17. Setup dependency management using go.mod.
  18. Build and run the example.
  19. Run REST routes.

Click here to get started with the tutorial!

You can’t perform that action at this time.