Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Latest commit

 

History

History
90 lines (68 loc) · 2.89 KB

interact-with-gnoland.md

File metadata and controls

90 lines (68 loc) · 2.89 KB

Interact with Gnoland

This tutorial will teach you how to interact with the Gnoland blockchain by creating an account and calling various realms to send transactions on the network.

Prerequisites

Create an Account

In order to interact with Gnoland, you need an account that you will use to sign and send transactions. You may create a new account with gnokey generate or recover an existing one with gnokey add. Confirm that your account was successfully added with gnokey list to display all accounts registered in the key base of your device.

gnokey generate # create a new seed phrase (mnemonic)

gnokey add -recover {your_account_name} # registers a key with the name set as the value you put in {your_account_name} with a seed phrase

gnokey list # check the list of keys

Register As a User

gnokey maketx call \
    -gas-fee="1ugnot" \
    -gas-wanted="5000000" \
    -broadcast="true" \
    -remote="test3.gno.land:36657" \
    -chainid="test3" \
    -pkgpath="gno.land/r/demo/users" \
    -func="Register" \
    -args="" \
    -args="my_account" \ # (must be at least 6 characters, lowercase alphanumeric with underscore)
    -args="" \
    -send="200000000ugnot" \
    my-account

# username: must be at least 6 characters, lowercase alphanumeric with underscore

Note: With a user registration fee of 200 GNOT and a gas fee that ranges up to 2 GNOT, you must have around 202 GNOT to complete this transaction. After registering as a user, you may replace your address with your username when developing or publishing a realm package.

Get Account Information

# Get account information
gnokey query -remote="test3.gno.land:36657" "auth/accounts/{address}"

# Get account balance
gnokey query -remote="test3.gno.land:36657" "bank/balances/{address}"

# Get /r/demo/boards user information
gnokey query -remote="test3.gno.land:36657" -data "gno.land/r/demo/users
my_account" "vm/qrender"

Send Tokens

The following command will send 1,000,000 ugnot (= 1 GNOT) to the address specified in the to argument.

# Creates and broadcast a token transfer transaction
gnokey maketx send \
    -gas-fee="1ugnot" \
    -gas-wanted="5000000" \
    -broadcast="true" \
    -remote="test3.gno.land:36657" \
    -chainid="test3" \
    -to="{address}" \ # g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5
    -send="{amount}{denom}" \ # 1234ugnot
    my-account

Create a Board

Try creating a board called my_board on the gno.land/r/demo/boards realm with the following command:

# Calls the CreateBoard function of gno.land/r/demo/boards
gnokey maketx call \
    -gas-fee="1ugnot" \
    -gas-wanted="5000000" \
    -broadcast="true" \
    -remote "test3.gno.land:36657" \
    -chainid="test3" \
    -pkgpath="gno.land/r/demo/boards" \
    -func="CreateBoard" \
    -args="my_board" \
    my-account