Search Apps Documentation Source Content File Folder Download Copy Actions Download

init package

Overview

Package init provides basic user registration.

SECURITY: every public function in this package is genesis-only. The realm exists to seed initial users into r/sys/users at chain genesis and to register itself as a controller. After genesis (block height > 0), no caller may use these functions.

Without the genesis-only gate, the wide-open `RegisterUser` wrapper would let any EOA land-grab any name (including reserved-sounding names like "administrator" or "vitalik") to any address — for free, without the namereg/v1 payment, blacklist, or canonical-collision checks. The gate closes that bypass.

Post-genesis user registration must go through a whitelisted controller that enforces its own policy (e.g. r/sys/namereg/v1).

Functions

Bootstrap

func Bootstrap(_ realm)

Bootstrap registers this package as a controller in r/sys/users. Genesis-only via AddControllerAtGenesis's own height==0 gate.

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/sys/users/init" -func "Bootstrap" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/sys/users/init" -func "Bootstrap" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

RegisterUser

func RegisterUser(_ realm, name string, addr address)

RegisterUser registers a new user in r/sys/users at chain genesis. PANICS if called after genesis (height > 0).

Uses RegisterUserIgnoreCanonical: the genesis seed set is curated, and any deliberate confusable reservations (e.g. registering both `vitalik` and `vital1k` to two different addresses) must not abort chain bring- up. Decision #14 (later-wins) applies, so order in genesis_txs.jsonl determines which name owns the canonical pointer when stems collide.

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/sys/users/init" -func "RegisterUser" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/sys/users/init" -func "RegisterUser" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx