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.

doc.gno

1.79 Kb · 35 lines
 1// Package wiki is a Wikipedia-shaped wiki engine for gno.land: namespaced
 2// titles, an append-only revision chain, wikilinks with backlinks, categories,
 3// redirects, protection levels, line diffs, and markdown rendering.
 4//
 5// It is pure: no realm globals, no chain imports. Every call takes the context
 6// it needs (author address, wall clock, block height) from the caller, so the
 7// whole engine is unit-testable off-chain. The live demo realm is
 8// gno.land/r/nym-moultest123/x/wiki/v0.
 9//
10// # Storage model
11//
12// A realm write locks a storage deposit proportional to the bytes it adds
13// (100ugnot per byte since gnolang/gno#6171), so a wiki that kept every
14// revision in full would charge its editors for the whole history forever.
15// This engine instead stores a content-addressed spine plus a bounded body
16// window:
17//
18//   - Every revision keeps its metadata permanently: id, parent, author,
19//     time, height, summary, byte size, and the SHA-256 of the body. That is
20//     roughly 200 bytes, independent of article size.
21//   - Only the newest Retention revisions of a page keep their body. Older
22//     bodies are evicted (set to ""), which releases their deposit.
23//
24// An evicted body is not lost: its bytes were an argument of the transaction
25// that wrote it, so they remain in the chain's transaction history, and the
26// retained hash proves which bytes were the real ones. The realm stops paying
27// rent for deep history; the archive lives where archives belong.
28//
29// # Untrusted markdown
30//
31// Article bodies are attacker-controlled markdown. Render passes every body
32// through gno.land/p/nt/markdown/sanitize/v0 before any wikilink rewriting,
33// never after: sanitize escapes "[" to "\\[", so a rewriter that ran first
34// would hand its own generated links to the escaper. See links.gno.
35package wiki