Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

markovdemo/v0 package

Overview

Package markovdemo is a small on-chain demo of the Markov-chain text generator provided by the p/moul/x/daily/markov(/p/nym-moultest123/x/daily/markov/v0) library.

It holds a single package-level markov.Chain as the corpus and wires it to the chain: Feed appends words to that persistent chain (a crossing function, since it mutates on-chain state), while Generate and Render walk it with a seed derived from runtime.ChainHeight() — so babbling is a pure, reproducible query that still varies block to block. It contains no Markov logic of its own — build/walk math all lives in the library.

Functions

Feed

func Feed(cur realm, text string) string
Ask AI Claude ChatGPT

Feed appends text to the on-chain corpus, extending the Markov chain. Any caller may enrich the corpus — this is the open-membership demo model.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-moultest123/x/daily/markovdemo/v0" -func "Feed" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-moultest123/x/daily/markovdemo/v0" -func "Feed" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Generate

func Generate(nWords int) string
Ask AI Claude ChatGPT

Generate babbles up to nWords of Markov text from the current corpus, seeded deterministically by the chain height. Read-only.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-moultest123/x/daily/markovdemo/v0.Generate()"

Result

Render

func Render(path string) string
Ask AI Claude ChatGPT

Render shows a freshly generated sample plus corpus stats. The path may carry a word count, e.g. Render("/60").

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-moultest123/x/daily/markovdemo/v0.Render()"

Result

Stats

func Stats() (int, int)
Ask AI Claude ChatGPT

Stats returns (totalWords, prefixCount) for the current corpus.

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-moultest123/x/daily/markovdemo/v0.Stats()"

Result