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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

qrcregistry/v1 package

Overview

Package qrcregistry keeps the Quantum Recovery Commit of user accounts.

A commit is a pair of Merkle roots, each standing for at least 64 Lamport one-time keys, one tree hashed with SHA-256 and the other with Keccak-256 (see package qrc). An account registers its commit once, with an ordinary transaction, while its usual key can still be trusted. From then on the one-time keys, and nothing else, can speak for the account in this realm:

  • Bind registers new public key bytes of any kind for the account,
  • Rotate replaces the commit before its keys run out,
  • Authorize lets another realm spend a key on a request of its own.

Bind and Rotate are open to any sender, and Authorize to any realm, for approvals made out to that realm's package path. What they check is a pair of hash-based signatures, one per tree, never who signed the transaction. An account whose usual key has been broken can therefore still name a new public key here, and whoever broke that key cannot touch the commit. This realm only records that key: for it to sign for the account would take a change to the chain.

Each one-time key signs once. Once every key of a commit is spent, the account can never bind, rotate or authorize again here, and the key bound last stays for good, so a wallet keeps the last key of a commit for a rotation. A commit is never deleted: what it stores keeps its storage deposit.

The realm has no owner, no administrator and no parameter that can change after deployment.

Functions

Authorize

func Authorize(cur realm, account address, leaf int, payload, proofSHA256, proofKeccak256 []byte)
Ask AI Claude ChatGPT

Authorize spends one-time key number leaf of account on payload, on behalf of the calling realm. It returns only if both proofs are valid signatures of qrc.AuthorizeMessage for the caller's package path and payload, and panics otherwise. account must be written as the chain writes it, in lower-case bech32, so that the calling realm holds exactly the account whose keys signed.

It lets a realm act for an account on the sole strength of its recovery keys. A proof made for one realm is useless to any other, and what the payload means is entirely up to the caller. An approval stays valid until its leaf is spent or the account rotates: the registry gives it no deadline and no nonce, so an app must put both in the payload and check them. The approval names a package path, not code: check what runs at that path before signing.

The calling realm sees the proofs before its transaction ends and may still make it fail, which leaves the leaf unspent here although its signature is public. A wallet must treat a leaf as spent as soon as a signature made with it leaves the wallet, and never sign anything else with it.

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/nym-rootlatch001/qrcregistry/v1" -func "Authorize" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-rootlatch001/qrcregistry/v1" -func "Authorize" -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 "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Bind

func Bind(cur realm, account address, leaf int, keyType string, key, proofSHA256, proofKeccak256 []byte)
Ask AI Claude ChatGPT

Bind registers key as the new public key of account, under the free label keyType (for instance "ML-DSA-65"). key holds 1 to MaxKeySize bytes; a scheme with a longer public key can bind a digest of it, under a label that says so.

The request must be signed with one-time key number leaf of both trees of the account: proofSHA256 and proofKeccak256 are the proofs of qrc.BindMessage for these arguments, with the account written as the chain writes it (lower case), whatever spelling the account argument uses. The leaf is spent.

A signed request stays valid until its leaf is spent or the account rotates, and whoever holds it may send it at any time: requests take effect in the order they land, not the order they were signed. To replace a key while an earlier Bind for another key may still be pending, rotate first, bind in the new generation, then check Key. After a failure, send the same signed request again rather than sign for another key.

Anyone may send the transaction. Whoever sends it pays the storage deposit of the bytes it adds and receives the refund of the bytes it frees. In a transaction, the three byte arguments are written in base64, which the chain decodes before the call.

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/nym-rootlatch001/qrcregistry/v1" -func "Bind" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-rootlatch001/qrcregistry/v1" -func "Bind" -args $'' -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 "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Count

func Count() (accounts, withKey int)
Ask AI Claude ChatGPT

Count returns the number of accounts that hold a commit and, among them, the number that bound a new public key.

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-rootlatch001/qrcregistry/v1.Count()"

Result

Has

func Has(account address) bool
Ask AI Claude ChatGPT

Has reports whether account has a commit.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-rootlatch001/qrcregistry/v1.Has()"

Result

IsUsed

func IsUsed(account address, leaf int) bool
Ask AI Claude ChatGPT

IsUsed reports whether one-time key number leaf of account was spent. It is false for an account without commit and for a leaf out of range. It only knows of keys spent by a transaction that succeeded: a signature made public in a failed one leaves its leaf unspent here, yet no wallet should sign with that leaf again.

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-rootlatch001/qrcregistry/v1.IsUsed(,)"

Result

Key

func Key(account address) (keyType string, key []byte, ok bool)
Ask AI Claude ChatGPT

Key returns a copy of the public key last bound to account, with its label. ok is false if the account has no commit or never bound a key.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-rootlatch001/qrcregistry/v1.Key()"

Result

KeyBase64

func KeyBase64(account address) string
Ask AI Claude ChatGPT

KeyBase64 returns the public key last bound to account, base64 encoded, or an empty string if there is none.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-rootlatch001/qrcregistry/v1.KeyBase64()"

Result

Latest

func Latest() string
Ask AI Claude ChatGPT

Latest returns the accounts that registered last, newest first, at most latestKept of them, as a JSON array of objects. Each object holds the account, its rank, the height of its trees, the number of one-time keys spent in its current trees, its generation and, once a key was bound, the label of that key. The rest of what the registry holds about an account is served by Lookup.

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-rootlatch001/qrcregistry/v1.Latest()"

Result

Lookup

func Lookup(account address) string
Ask AI Claude ChatGPT

Lookup returns what the registry holds about account as a JSON object, or the JSON value null if the account has no commit. It leaves out the roots of earlier generations.

registeredAt, rotatedAt and keyAt are block heights, rotatedAt being 0 before any rotation; registeredTime is in Unix seconds. "used" is the bitmap of the one-time keys spent in the current trees, in hexadecimal: key number n is spent when bit n%8, counting from the least significant, of byte n/8 is set. The key fields are only present once a key was bound; keyLeaf is a leaf of generation keyGeneration, which a later rotation retires. The key itself is served by KeyBase64.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-rootlatch001/qrcregistry/v1.Lookup()"

Result

Register

func Register(cur realm, rootSHA256, rootKeccak256 string, height int)
Ask AI Claude ChatGPT

Register stores the Quantum Recovery Commit of the calling account: the roots of its SHA-256 and Keccak-256 trees, hex encoded, and their height.

An account registers once. Its usual key has no say over the commit afterwards; only the one-time keys can replace it, through Rotate.

A registration can never be corrected or withdrawn, and nothing here checks that the roots are a SHA-256 tree and a Keccak-256 tree of the given height: derive both roots and the height from the kit, in this order, and check them before sending. The caller must be the account itself, in a direct call or in a script it runs; a session key is refused.

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/nym-rootlatch001/qrcregistry/v1" -func "Register" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-rootlatch001/qrcregistry/v1" -func "Register" -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 "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Render

func Render(path string) string
Ask AI Claude ChatGPT

Render shows the registry: its home page for an empty path, the page of an account for "<address>" or "account?address=<address>".

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-rootlatch001/qrcregistry/v1.Render()"

Result

Rotate

func Rotate(cur realm, account address, leaf int, rootSHA256, rootKeccak256 string, height int, proofSHA256, proofKeccak256 []byte)
Ask AI Claude ChatGPT

Rotate replaces the commit of account by a new one: two new roots, hex encoded, and their height. The public key bound to the account stays. Nothing checks the new roots any more than Register checks the first ones.

The request must be signed with one-time key number leaf of both current trees: the proofs are those of qrc.RotateMessage for these arguments, with the account written as the chain writes it (lower case). Proofs against the replaced trees are refused afterwards. The registry cannot see inside new roots: new trees must not reuse the old keys. The Rotated event reports the new generation; its leaf belongs to the one before.

A signed rotation stays valid until its leaf is spent or the account rotates: only another rotation can cancel it.

Anyone may send the transaction. Whoever sends it pays the storage deposit of the bytes it adds and receives the refund of the bytes it frees. In a transaction, the two proofs are written in base64, which the chain decodes before the call.

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/nym-rootlatch001/qrcregistry/v1" -func "Rotate" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-rootlatch001/qrcregistry/v1" -func "Rotate" -args $'' -args $'' -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 "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Gno Expression Evaluator

Evaluate any read-only Gno expression against gno.land/r/nym-rootlatch001/qrcregistry/v1, for example a function call with arguments.