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 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 Gno-mes: 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, the dedicated organizer account is the testnet deployment account. On other chains, the organizer defaults 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 at the next midnight in Europe/Paris. 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 at the end of the day and rerun it on subsequent days to catch late solves. 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.


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/v1 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 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.

func SetPublisher

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

SetPublisher delegates publishing and clue corrections to another account.

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.

Imports 12

Source Files 6