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

ActiveJSON

func ActiveJSON(offset, limit int) string

ActiveJSON returns {"now":<unix>,"games":[...]}: Open and Playing games in id order, skipping offset and returning at most limit (clamped to 1-100).

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/nym-mikecito001/connect4_v2.ActiveJSON(,)"

Result