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

v2 source realm

Package advent is Gnoël, an on-chain advent calendar with sealed guesses.

Readme View source

Gnoël

Twenty-four riddles, sealed guesses, and one very small VM. Gnoël is an Advent calendar for Gnomes: the organizer opens each door with a transaction, and every opened door stays playable. GnoWeb serves the calendar, a page for each riddle, its public seals, and the Nice List. The rich app adds the wallet flow, personal progress, and a live calendar.

GnoWeb on Onyx · GnoWeb beta · Rich app beta

Play

Connect Adena or use a local gnokey account. Get test GNOT from the Onyx faucet. Choose an open door and type an answer. Outer ASCII whitespace is ignored. Spelling, accents, and case matter.

Each address can have one pending guess per door. A player can replace it before review. A miss allows a new guess. A solve earns one point and closes that door for the solver. The Nice List shows the first 24 scores, with address order breaking ties. A day’s solve count is the number of addresses that solved it.

Open doors and review seals

On Onyx and Moul’s GnoDev, the dedicated organizer is the testnet deployment account. Other chains default to the home realm’s admin. The organizer can delegate door publishing and corrections through SetPublisher and delegate verdicts through SetOracle. Both roles initially belong to the organizer. The companion lives in tools/gnoel. It prints commands by default and invokes gnokey interactively with -run.

Create a private key and its public companion outside the checkout:

1go -C tools tool gnoel keygen -key /path/to/private/gnoel.pem

Open a door with one transaction. The tool schedules the first review one hour after the door opens. Use absolute paths because Go executes the tool from tools/.

1go -C tools tool gnoel publish -day 1 -title 'A Tiny Runtime' \
2  -clue /path/to/door-01.txt -public /path/to/private/gnoel.pem.public -run

For a typo in an open door, send the corrected clue as a text file. The title, review schedule, oracle key, attempts, and scores are kept.

1go -C tools tool gnoel edit -day 1 -clue /path/to/door-01.txt -run

Keep a private solutions JSON file beside the PEM. Each entry contains the winning strings and the key used for that door. You can reuse the key across doors or rotate it for a new door.

1{
2  "1": {"key": "gnoel.pem", "answers": ["example answer", "accepted variant"]}
3}

Run the oracle every 15 minutes. Its first observation of each seal starts a one-hour waiting period. A replacement restarts the hour. The oracle keeps its observation timestamps alongside the private solutions file and reviews consecutive eligible guesses in order. Supply -day N to review only one door. Omit -run to inspect the proposed transactions.

1go -C tools tool gnoel review -solutions /path/to/private/solutions.json -run

For the GnoDev beta, add -chain moulstaging-1 -rpc https://rpc.gno-staging.moul.p2p.team -realm gno.land/r/moul/advent/v1. On a paused GnoDev, a review becomes available once a new block carries a timestamp past the cutoff. Use -signer for your gnokey name. A terminal-only player can use gnoel seal -day N -address g1… -answer /path/to/guess.txt. Add -replace for a pending guess.

What the public sees

The browser generates a fresh 32-byte random salt for every guess. SHA-256 binds the answer and salt to the network, realm, door, and wallet address. RSA-OAEP encrypts only the salt for the oracle, with the commitment as the OAEP label. The transaction contains the hash and ciphertext. The wallet sees those same fields.

The oracle decrypts the salt and tests the organizer’s accepted strings against the commitment. It publishes only a verdict for each ID. Anyone can read the commitments and verdicts. The oracle’s attestation is trusted. The private key can reveal the salts, so keep it and the solutions file out of Git and retain them for late guesses.

Calendar(), Leaders(), Progress(address), and paginated Attempts(day, start) give clients a public view of the same state as GnoWeb. The oracle includes a fingerprint of each batch in its review transaction, so replacing a pending guess invalidates any review computed against the old seal.

Versions

Each version asks r/moul/releases whether it is still the latest, under the project name advent. Its pages open with the registry's banner when it is not, and the home page links the stage of every version. From v2 on, Publish, UpdateClue, Submit and ReplaceGuess refuse once the version is past a deprecation sunset, yanked or vulnerable. Review only stops when the version is yanked or vulnerable, so the seals sent before a sunset still get their verdict. SetPublisher and SetOracle never stop, so a leaked key can be rotated on any version.

v0 and v1 predate the guard and cannot gain it: they are listed and labelled, and only the stage page says they are old. The project is opened by an owner call, not seeded, because the registry's code is frozen. On each chain, the address that should administer the calendar sends, in order:

NewProject("advent", "Gnoël, the advent calendar")
AddRelease("advent", "v0", "<v0 path>", "", "first calendar, its seals carried over to v1", "supported")
AddRelease("advent", "v1", "<v1 path>", "", "agent-managed doors, replaceable seals, first-solve points", "supported")
Deprecate("advent", "v0", "superseded by v1, which carried its seals over", <height>)
SetSuccessor("advent", "v0", "v1")
AddRelease("advent", "v2", "<v2 path>", "", "asks the registry for its banner and write guard", "draft")

v2 stays a draft until it carries the game. Then SetStatus("advent", "v2", "supported", "") makes it the latest, and Deprecate("advent", "v1", ...) gives v1 its sunset.


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

On mainnet: deployment status transactions unique callers deployed revision

Dependency graph:

gno.land/r/moul/advent/v2 dependency graph

⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.

Overview

Package advent is Gnoël, an on-chain advent calendar with sealed guesses.

Constants 1

Functions 14

func Attempts

Action
1func Attempts(day, start int) string
source

Attempts returns one bounded page of the public record, starting at a 1-based ID.

func Calendar

Action
1func Calendar() string
source

Calendar returns tab-separated rows for open doors, with title and clue in base64.

func CarryOver

crossing Action
1func CarryOver(cur realm, player address, commitment, sealedSalt string)
source

CarryOver records a pending seal from the first deployment on Onyx.

func FinishCarryOver

crossing Action
1func FinishCarryOver(cur realm)
source

FinishCarryOver closes imports and opens regular submissions and reviews.

func Leaders

Action
1func Leaders() string
source

Leaders returns the top 24 addresses with their confirmed solves.

func Progress

Action
1func Progress(player string) string
source

Progress lists the latest status of an address across all 24 doors.

func Publish

crossing Action
1func Publish(cur realm, day int, title, clue, publicKey string, reviewFrom int64)
source

Publish opens a case. The RSA-2048 SPKI public key is pinned for that case so that rotating the key for a new door leaves old doors playable.

func Render

1func Render(path string) string
source

Render prepends the release banner, "" while this version is the latest or unlisted, so an old copy tells its readers where the game moved.

func ReplaceGuess

crossing Action
1func ReplaceGuess(cur realm, day int, commitment, sealedSalt string) int
source

ReplaceGuess reseals the caller's current guess while it awaits review.

func Review

crossing Action
1func Review(cur realm, day, start int, verdicts, snapshot string)
source

Review records one verdict per consecutive attempt, starting at the first pending ID. A stale batch fails before it can apply verdicts to other guesses.

It asks only that this version be readable, not writable: past a deprecation sunset no new guess gets in, but the seals already sent are still owed a verdict. A yanked or vulnerable version refuses it too.

func SetPublisher

crossing Action
1func SetPublisher(cur realm, signer address)
source

SetPublisher delegates publishing and clue corrections to another account. Like SetOracle it ignores the release status: rotating a leaked key must still work on a version that is yanked or vulnerable.

func Submit

crossing Action
1func Submit(cur realm, day int, commitment, sealedSalt string) int
source

Submit publicly records the commitment and its encrypted random salt.

func UpdateClue

crossing Action
1func UpdateClue(cur realm, day int, clue string)
source

UpdateClue corrects the text of an open door while keeping its review schedule, oracle key and submissions intact.

Dependencies

Source Files 5