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

memba_quest_attestation_v1 source realm

Package memba\_quest\_attestation\_v1 is the on-chain quest/XP attestation realm for Memba (audit Q-05, Track A — "Mo...

Overview

Package memba_quest_attestation_v1 is the on-chain quest/XP attestation realm for Memba (audit Q-05, Track A — "Model B" offline-signed voucher).

WHY: Memba quest XP lives in a centralized backend DB; the chain holds no verifiable record. This realm makes a quest completion + its XP an independently verifiable on-chain fact, WITHOUT giving the backend a hot key that can write arbitrary state.

HOW (Model B — offline voucher):

  • The backend holds an OFFLINE ed25519 signing key; it NEVER broadcasts.
  • For a server-verified completion it issues a voucher (address, questId, xp, nonce) + ed25519 signature over the canonical message addr "|" questId "|" itoa(xp) "|" nonce (UTF-8 bytes)
  • The USER broadcasts RecordCompletion(...) with the voucher (they pay gas).
  • This realm verifies the signature against the configured signer pubkey, rejects reused nonces (replay), bounds xp, and records the completion + cumulative attested XP.

TRUST MODEL: the signature is the authority, NOT the caller — anyone may broadcast a valid voucher (it can only record the backend-attested fact). The only privileged action is rotating the signer pubkey (owner multisig).

The canonical message format is a CONTRACT with the backend signer — it MUST stay byte-identical on both sides. See canonicalMsg.

Constants 1

const OwnerAddress, MaxAttestXP, pubKeySize, sigSize, fieldSep

 1const (
 2	// OwnerAddress is the samcrew-core-test1 multisig on test13 (realm owner /
 3	// signer-key rotator). CONFIRM before deploy.
 4	OwnerAddress = "g1x7k4628w93a7wzdhqc06atzx0v50rnshweuxu0"
 5
 6	// MaxAttestXP bounds the XP a single voucher can carry. This caps the blast
 7	// radius if the offline signer key ever leaks: a leaked key can still forge
 8	// vouchers, but cannot mint unbounded XP in one call. Generous vs the real
 9	// max single-quest XP (≤100).
10	MaxAttestXP = 1000
11
12	pubKeySize = 32 // ed25519 public key length (gno crypto/ed25519 exposes no const)
13	sigSize    = 64 // ed25519 signature length
14	fieldSep   = "|"
15)
source

── Constants ────────────────────────────────────────────────

Functions 5

func GetAttestedXP

Action
1func GetAttestedXP(addr string) int
source

GetAttestedXP returns addr's cumulative on-chain attested XP (0 if none).

func GetRecordedCompletions

Action
1func GetRecordedCompletions(addr string) string
source

GetRecordedCompletions returns addr's attested quest IDs as a comma-separated list (empty string if none), in ascending key order.

func RecordCompletion

crossing Action
1func RecordCompletion(cur realm, addr, questId string, xp int, nonce, sigHex string)
source

RecordCompletion verifies a backend-signed voucher and records the completion + its XP on-chain. Idempotent per (addr, questId); replay-proof per nonce. Panics (reverting the tx) on any invalid/again-used/out-of-range voucher.

func Render

1func Render(path string) string
source

Render is the human/gnoweb view; the authoritative reads are the exported Get* funcs (queried via vm/qeval).

func SetSigner

crossing Action
1func SetSigner(cur realm, pubKeyHex string)
source

SetSigner installs/rotates the backend's offline signer PUBLIC key (32-byte hex). Owner-multisig only. This is a crossing function, so PreviousRealm() correctly identifies the immediate caller (see gno interrealm semantics).

Imports 8

Source Files 2