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

v1 source realm

Package blog is a multi-author on-chain blog realm for gno.land.

Readme View source

Personal Blog

⚠️ Experimental — generated with no human supervision. This realm was produced automatically by an MCP-driven agent to exercise the gno MCP server and tooling, and to generate test content for gno compilers, linters and formatters. Not audited. Not for production. Full context & folder README: r/moul/x/daily


A multi-author on-chain blog realm for gno.land. Anyone can publish a post; each post records its author (the calling address) and the block height at which it was published. Posts are stored persistently and rendered newest-first, with a dedicated page for each post's full text.

Realm path: gno.land/r/REPLACE_ADDR/blog

Example calls

Publish a post (state-mutating, crossing function):

gnokey maketx call -pkgpath "gno.land/r/REPLACE_ADDR/blog" \
  -func Publish -args "My first post" -args "Hello, gno.land!" \
  -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid sapphire-1 KEY

Read views (no transaction needed):

  • Root — list all posts, newest first: render gno.land/r/REPLACE_ADDR/blog
  • Single post by id: render gno.land/r/REPLACE_ADDR/blog:/0

PostCount() returns the total number of published posts.

What changed in v1

State moved from a hand-rolled avl.Tree + nextID + zero-padding helper to p/moul/kit/store, which keys entries by seqid instead of a fixed-width decimal string.

v0 padded ids to width 12. Past that width the padding stops and the tree orders "1000000000000" before "999999999999", so every list this realm renders would be wrong from that entry on. store keys are 8 big-endian bytes whose order is numeric for every uint64, so there is no width left to outgrow.

Ids stay plain integers, and Post loses its ID field, which the store now owns. Two things a reader will notice:

  • Post ids now start at 1. v0 handed out 0 for the first post; the store never assigns 0, so the zero id stays usable as "absent".
  • /0 is no longer a post path. It is rejected as invalid rather than looked up, along with anything else that is not a plain decimal.

This is a storage change, which under this repo's versioning rule is a compatibility change, hence a new version rather than an edit in place. v0 stays live and untouched.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/daily/blog/v1 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.

Overview

Package blog is a multi-author on-chain blog realm for gno.land.

Any caller can Publish a post; posts are stored persistently and rendered newest-first. Each post records its author (the calling address) and the block height at which it was published.

Functions 3

func Publish

crossing Action
1func Publish(cur realm, title string, body string) int
source

Publish creates a new post authored by the caller and returns its id. It is a state-mutating exported function, so it takes `cur realm`.

func Render

1func Render(path string) string
source

Render lists all posts newest-first at the root, or a single post's full text at path "/<id>". Render is NOT a crossing function.

Types 1

type Post

struct
1type Post struct {
2	Title  string
3	Body   string
4	Author address
5	Height int64
6}
source

Post is a single blog entry. It carries no id field: the id belongs to the store, which hands it back on lookup and iteration.

Imports 6

Source Files 4