Skip to content Search Apps Documentation Source Content 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.

gnoslinger/v0 package

Overview

Package gnoslinger is the on-chain lobby and referee of Gunslinger showdowns (the 1982 Avalon Hill gunfight game) of two to four players. Players create and join games and play their turn plans hidden: each commits the hash of its plan, then reveals it once every plan is committed (DESIGN_HIDDEN_PLANS.md); the realm resolves each turn with the pure engine package and keeps the result for the web client to animate.

Function

Reveal

func Reveal(cur realm, id string, turn int, seat int, salt string, plan string) int
Ask AI Claude ChatGPT

Reveal puts a seat's salt and plan for the given turn on chain and returns the game revision. Anyone may send it while the game collects the reveals: the salt and plan must match the seat's commit (PlanHash). The last seat to commit may also reveal straight away, without committing: the others' plans are already fixed by their hashes, so its plan in clear helps nobody; that is only accepted from the seat itself, before the deadline, once every other character still in the fight committed (a refused transaction still shows its plan). The plan is a comma-separated list of "<card><f|b>[:<choice>]" entries, e.g. "1f:ahead_left,2f:ahead,3f"; an empty string passes. The reveal that completes the turn resolves it in this same transaction and the next turn starts.

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/g1th0masp67zfs9lg6d34qhghldhg6kjcqjuv7c2/gnoslinger/v0" -func "Reveal" -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/g1th0masp67zfs9lg6d34qhghldhg6kjcqjuv7c2/gnoslinger/v0" -func "Reveal" -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