Search Apps Documentation Source Content File Folder Download Copy Actions Download

memba_quest_attestation_v1 package

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.

Functions

GetAttestedXP

func GetAttestedXP(addr string) int

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/samcrew/memba_quest_attestation_v1.GetAttestedXP()"

Result

GetRecordedCompletions

func GetRecordedCompletions(addr string) string

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/samcrew/memba_quest_attestation_v1.GetRecordedCompletions()"

Result

RecordCompletion

func RecordCompletion(cur realm, addr, questId string, xp int, nonce, sigHex string)

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.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/samcrew/memba_quest_attestation_v1" -func "RecordCompletion" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/memba_quest_attestation_v1" -func "RecordCompletion" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

Render

func Render(path string) string

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/samcrew/memba_quest_attestation_v1.Render()"

Result

SetSigner

func SetSigner(cur realm, pubKeyHex string)

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).

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/samcrew/memba_quest_attestation_v1" -func "SetSigner" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/memba_quest_attestation_v1" -func "SetSigner" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx