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

rpsduel/v0 package

Overview

Package rpsduel is an asynchronous, two-player rock-paper-scissors duel with a commit-reveal handshake. The challenger locks in a move as a sha256 commitment up front so the opponent can't peek at it; the opponent then replies in the clear (seeing only a hash gives them no edge); the challenger reveals last to settle the round. A challenger who tries to dodge a losing reveal can be forfeited by the opponent once the reveal window expires.

Function

ComputeCommit

func ComputeCommit(moveStr, salt string) string

ComputeCommit hashes a move and salt exactly the way Reveal checks it, so a caller can compute their commitment (e.g. via a read-only query) before calling Open, then remember the salt to pass to Reveal later.

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/rpsduel/v0.ComputeCommit(,)"

Result