Ai & Web3 Builder.

Ai & Web3 Builder.

I'm a Ai & Web3 Builder and Developer.
twitter
telegram
github
github
youtube
email

Gnoland Smart Contract Platform Testing Task Tutorial

Introduction to the Gno Project

Gnoland is an interoperable high-concurrency smart contract platform founded by Jae Kwon, the former founder of Cosmos. Developers can use the Gno language to build high-concurrency smart contracts on the Gno chain. Gno language is a smart contract development language similar to Go language. With its simple syntax and a large number of Go developers, it significantly reduces the entry barrier for developers compared to languages like Solidity, Rust, and Move. Currently, Gnoland is still in the Test2 test network phase, and there is still a lack of supporting tools in the surrounding ecosystem. The threshold for usage is relatively high, requiring a certain level of technical ability to experience it first. It is also because of this that there are relatively few people currently experiencing it, which naturally means that everyone's opportunities will be greater.

Installation of the Basic Environment

The operating system environment for this tutorial series is based on Ubuntu, but you can also use the WSL version of Ubuntu for Windows on your own computer.

First, create a new directory named "/data" under the "/" directory on your server to store the unified directory for software operations. This is mainly to facilitate the unified management of server resources. Different software will have their own default installation directories. If they are not managed uniformly, it can easily become messy.

sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install curl build-essential jq git -y

cd /

mkdir data

cd /data

mkdir app software soft source blockchain

Directory Explanation

/data/app: Mainly stores installed software (mainly linked to the software in the /data/soft directory)

/data/software: Mainly stores software downloaded from the internet

/data/soft: Mainly stores installed software (the actual installation directory of the software)

/data/source: Mainly stores source code cloned from GitHub

/data/blockchain: Mainly stores blockchain-related tools and services

Of course, you can define the directory structure according to your own preferences.

Installation of the Go Development Environment

cd /data/software
wget https://go.dev/dl/go1.18.5.linux-amd64.tar.gz
tar -xzvf go1.18.5.linux-amd64.tar.gz
tar -xzvf go1.18.5.linux-amd64.tar.gz -C/data/soft
cd /data/soft
mv go go1.18.5
ln -s /data/soft/go1.18.5 /data/app/go

cat << 'EOF' >> /etc/profile
export PATH=$PATH:/data/app/go/bin
EOF

source /etc/profile

go version
Download and Compile Gno Source Code
cd /data/source
git clone https://github.com/gnolang/gno
cd gno
make

If there is a network timeout error when downloading and installing packages during compilation, configure a Goproxy proxy. Use the following command, and then recompile.#

export GO111MODULE=on
export GOPROXY=https://goproxy.cn

Alternatively, you can set the proxy like this (this way it will be permanently effective)#

echo "export GO111MODULE=on" >> ~/.profile
echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
source ~/.profile

cat << 'EOF' >> /etc/profile
export PATH=$PATH:/data/source/gno/build
EOF

source /etc/profile

Creating a Wallet

gnokey generate

Please save your wallet address and mnemonic phrase. If you don't save the mnemonic phrase, you will not be able to recover your wallet later. Remember not to casually leak your mnemonic phrase.

Restoring a Wallet from a Mnemonic Phrase

gnokey add --recover
Replace with your chosen wallet name, without the <>, and all subsequent commands do not require <>, only replace the content inside <>. This command will also prompt you to set a wallet password. Please remember the password you set for wallet login. If you forget the password later, you can also use the mnemonic phrase to recover the wallet.

Viewing the Existing Wallet List

gnokey list
Claiming Test Coins
Open the faucet website: https://test2.gno.land/faucet

Enter your Gnoland wallet address (e.g., g1f68ckw5yy8nccke6kva0mnf3sg2qv4qm8cf0u0) to claim test coins.

Currently, the faucet can only provide 50 GNOT. If you want to claim more test coins, you need to change your VPN's IP address. A simple method is to change the region of your VPN because the faucet checks your IP address each time you claim, limiting frequent claims.

Checking Wallet Balance

gnokey query auth/accounts/ --remote test2.gno.land:36657
Creating a Registered Account
cd

mkdir gnoland

cd gnoland

account_number=$(gnokey query auth/accounts/ --remote test2.gno.land:36657 | grep account_number | sed 's/[^0-9]//g')

echo $account_number

sequence=$(gnokey query auth/accounts/ --remote test2.gno.land:36657 | grep sequence | sed 's/[^0-9]//g')

echo $sequence

Creating a Tx for Registering an Account

Your custom username must be at least 6 lowercase letters and can include underscores#

gnokey maketx call --pkgpath "gno.land/r/users" --func "Register" --gas-fee 1000000ugnot --gas-wanted 2000000 --send "200000000ugnot" --args "" --args "" --args "" > unsigned.tx

# Signing the Transaction Tx

gnokey sign --txpath unsigned.tx --chainid test2 --number $account_number --sequence $sequence > signed.tx

# Broadcasting the Transaction Tx

gnokey broadcast signed.tx --remote test2.gno.land:36657
After the transaction is successfully broadcasted, you can see your username at https://test2.gno.land/r/users.

If the broadcast fails, it may be because the balance is not enough (204 GNOT). Please make sure you have claimed from the faucet 5 times.

rm unsigned.tx
rm signed.tx
It may also be an incorrect sequence. Please check and use the latest account_number and sequence. Delete unsigned.tx and signed.tx, and complete the above two steps again (getting account_number and sequence, creating a tx for registering a user, signing the tx, broadcasting the tx), and try again.

Creating Your Own Message Board

Note that the board name can only be in English and cannot contain Chinese characters (hopefully this bug will be fixed in future versions)#

gnokey maketx call --pkgpath "gno.land/r/boards" --func "CreateBoard" --gas-fee 1000000ugnot --gas-wanted 10000000 --send 1000000ugnot --broadcast true --chainid test2 --args "" --remote test2.gno.land:36657

Getting the ID of the Newly Created Message Board

BoardID=$(gnokey query "vm/qeval" --data "gno.land/r/boardsGetBoardIDFromName("")" --remote test2.gno.land:36657 | grep data | sed 's/[^0-9]//g')
echo $BoardID

Creating a Post

cd gnoland
sudo cat <<'EOF' >> /gnoland.md
This is a demo of Gno smart contract programming.
EOF

# Posting

gnokey maketx call --pkgpath "gno.land/r/boards" --func CreateThread --args $BoardID --args "" --args#file "<xxx.md>" --gas-fee 1000000ugnot --gas-wanted 2000000 --chainid test2 --broadcast true --remote test2.gno.land:36657

Claiming a Task

test2.gno.land
test2.gno.land
Write an article (at least 250 words) on your favorite media platform (Twitter, Medium, or Mirror) describing why you are interested in gno.land and Gnoland. You can refer to:

Gnoland High-Concurrency Smart Contract Platform Introduction
Introduction
medium.com
Reply to this comment with the URL link to your article to receive a reward.

After successfully publishing the article introducing Gno, use the following command to submit:

gnokey maketx call --pkgpath "gno.land/r/boards" --func "CreateReply" --gas-fee 1000000ugnot --gas-wanted 2000000 --send "" --broadcast true --chainid test2 --args "1" --args "4" --args "4" --args "

" --remote test2.gno.land:36657

After the article chain is successfully broadcasted, you will be able to see your post at https://test2.gno.land/r/boards:gnoland/4.

This completes the first task of Gnoland. Looking forward to more tasks.

If you found this article useful, please follow my Twitter: https://twitter.com/tujiao

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.