This is a demo of Gno smart contract programming. This document was constructed by Gno onto a smart contract hosted on the data Realm name "gno.land/r/demo/boards" (github).
gnoland
node node/validator.NOTE: Where you see --remote test3.gno.land:36657
here, that flag can be replaced
with --remote localhost:26657
for local testnets.
git clone git@github.com:gnolang/gno.git cd ./gno make
./build/gnokey add test1 --recover
Use this 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
./build/gnoland
(This can be reset with make reset
).
go run ./gnoland/website
./build/gnokey maketx addpkg test1 --pkgpath "gno.land/p/demo/avl" --pkgdir "examples/gno.land/p/demo/avl" --deposit 100ugnot --gas-fee 1ugnot --gas-wanted 2000000 > addpkg.avl.unsigned.txt ./build/gnokey query "auth/accounts/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5" ./build/gnokey sign test1 --txpath addpkg.avl.unsigned.txt --chainid "test3" --number 0 --sequence 0 > addpkg.avl.signed.txt ./build/gnokey broadcast addpkg.avl.signed.txt --remote test3.gno.land:36657
./build/gnokey maketx addpkg test1 --pkgpath "gno.land/r/demo/boards" --pkgdir "examples/gno.land/r/demo/boards" --deposit 100ugnot --gas-fee 1ugnot --gas-wanted 300000000 > addpkg.boards.unsigned.txt ./build/gnokey sign test1 --txpath addpkg.boards.unsigned.txt --chainid "test3" --number 0 --sequence 1 > addpkg.boards.signed.txt ./build/gnokey broadcast addpkg.boards.signed.txt --remote test3.gno.land:36657
./build/gnokey maketx call test1 --pkgpath "gno.land/r/demo/boards" --func CreateBoard --args "testboard" --gas-fee 1ugnot --gas-wanted 2000000 > createboard.unsigned.txt ./build/gnokey sign test1 --txpath createboard.unsigned.txt --chainid "test3" --number 0 --sequence 2 > createboard.signed.txt ./build/gnokey broadcast createboard.signed.txt --remote test3.gno.land:36657
Next, query for the permanent board ID by querying (you need this to create a new post):
./build/gnokey query "vm/qeval" --data "gno.land/r/demo/boards GetBoardIDFromName(\"testboard\")"
./build/gnokey maketx call test1 --pkgpath "gno.land/r/demo/boards" --func CreatePost --args 1 --args "Hello World" --args#file "./examples/gno.land/r/demo/boards/README.md" --gas-fee 1ugnot --gas-wanted 2000000 > createpost.unsigned.txt ./build/gnokey sign test1 --txpath createpost.unsigned.txt --chainid "test3" --number 0 --sequence 3 > createpost.signed.txt ./build/gnokey broadcast createpost.signed.txt --remote test3.gno.land:36657
./build/gnokey maketx call test1 --pkgpath "gno.land/r/demo/boards" --func CreateReply --args 1 --args 1 --args "A comment" --gas-fee 1ugnot --gas-wanted 2000000 > createcomment.unsigned.txt ./build/gnokey sign test1 --txpath createcomment.unsigned.txt --chainid "test3" --number 0 --sequence 4 > createcomment.signed.txt ./build/gnokey broadcast createcomment.signed.txt --remote test3.gno.land:36657
./build/gnokey query "vm/qrender" --data "gno.land/r/demo/boards testboard/1"
The contents of https://gno.land/r/demo/boards:
and https://gno.land/r/demo/boards:testboard
are rendered by calling
the Render(path string)
function like so:
./build/gnokey query "vm/qrender" --data "gno.land/r/demo/boards testboard"
GetBoardIDFromName
CreateBoard
CreateThread
CreateReply
CreateRepost
DeletePost
EditPost
Gnoland Space is a community initiative.
Disclaimer