Local setup

Gnolang comes with cli toolsuite to help developers test their code and interact with the chain:

  1. gnodev which provides multiple utilities to develop in Gnolang

    $ gnodev --help available subcommands: build - build a gno package precompile - precompile .gno to .go test - test a gno package repl - start a GnoVM REPL
  2. gnokey to create local wallets, sign/broadcast transactions and make RPC queries

    $ gnokey --help available subcommands: add - add key to keybase delete - delete key from keybase generate - generate a new private key list - list all known keys sign - sign a document verify - verify a document signature broadcast - broadcast a signed document query - make an ABCI query maketx - compose a tx document to sign

Install Gnodev & Gnokey

$ git clone ... $ cd ./gno $ make install Installing gnodev go install ./cmd/gnodev Installing gnokey go install ./cmd/gnokey

This will install gnodev and gnokey on your system. Run gnodev --help and gnokey --help to verify the installation.

Run a local node

To test deployments and interact with your contract locally, it is recommended to run a local gnoland node.

$ git clone ... $ cd ./gno $ make ... $ ./build/gnoland

Note that your local gnoland node cache is stored in the gno/testdir directory. You can rm it to clean your cache (and therefore all deployments and actions made in your local environment)

Setup Example: Deploy a Realm

In this example, we will deploy locally a Realm we developed and interact with using CLI and Gnoland web interface. For this setup we will have the following structure:

$ ls gno # official gno repo gno-test # our playground
  1. Import pre-defined local wallet set with a default balance
gnokey add test --recover # Use the following mnemonic: # source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast
  1. Run local gnoland node
  1. Create a Realm in a gno-test/hello/hello.gno file
package hello func world() string { return "world!" } func Render(path string) string { return "Hello, " + world() }
  1. Deploy the realm on your local gnoland
gnokey maketx addpkg test --pkgpath "" --pkgdir "gno-test/hello/" --gas-fee 5000000ugnot --gas-wanted 1000000 --broadcast true --chainid "dev" --remote localhost:26657
  1. Run gnoland website on local env
cd gno && go run ./gnoland/website/main.go
  1. Head to to see your deployed realm!

Previous doc: Gnolang Introduction

Next doc: Realms Development