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

connect4_v2 package

Overview

package connect4_v2 is a staked Connect 4 game. A creator posts an offer with a ugnot stake; anyone (or a named opponent) accepts with the same stake; the winner takes the pot minus a flat house fee.

The first mover is picked by commit-reveal: the creator offers with sha256(passphrase) and must Reveal the passphrase within 90s of Accept, or forfeit. Randomness computed in Accept could be re-rolled by an acceptor who bundles [Accept, Play] in one atomic tx and lets it revert.

Every move has a 90s clock measured in block time. Nothing on-chain fires by itself, so an expired clock is settled by anyone calling ClaimTimeout: an unrevealed game is won by the acceptor, a game whose first mover never moved is void and both stakes are refunded, otherwise the player who ran out of time forfeits.

Function

Reveal

func Reveal(cur realm, id int, passphrase string)

Reveal discloses the creator's passphrase, which picks the first mover. It must come within 90s of Accept.

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-mikecito001/connect4_v2" -func "Reveal" -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-mikecito001/connect4_v2" -func "Reveal" -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