Realm

gno.land/r/moul/x/daily/rpsduel/v1

Rendered output

Rock-Paper-Scissors Duel

Challenge another address to rock-paper-scissors, async and fair: you commit your move as a hash, they reply in the open, then you reveal to settle it. Stall on revealing a losing round and your opponent can claim a forfeit win once the window expires.

  • Total duels resolved: 0
  • No champion yet -- be the first to win a duel.

How to play

  1. Pick a move and a random salt, e.g. rock + xyz123.
  2. Compute your commitment: ComputeCommit("rock", "xyz123") (read-only call).
  3. Open(opponentAddr, commit) -- opens the duel, returns its ID.
  4. The opponent calls Accept(id, "paper"|"scissors"|"rock").
  5. You call Reveal(id, "rock", "xyz123") -- must match your commitment exactly.
  6. If you never reveal, the opponent can call ClaimForfeit(id) after 50 blocks.

View a duel at this realm's path plus its ID (e.g. .../rpsduel:3), or a player's record plus their address (e.g. .../rpsduel:g1youraddress...).

Open duels

none right now

Query (read-only)

non-crossing functions · no tx, no wallet needed
ComputeCommit(moveStr string, salt string) → string

Call functions (state-changing)

signs a tx via Adena
Accept(id string, moveStr string)
Cancel(id string)
ClaimForfeit(id string)
Open(opponentAddr string, commitHex string)
Reveal(id string, moveStr string, salt string)

All exported functions (7)

show raw signatures
NameParamsReturns
ComputeCommit [{"Name": "moveStr", "Type": "string", "Value": ""}, {"Name": "salt", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]
Open [{"Name": "cur", "Type": "interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}", "Value": ""}, {"Name": "opponentAddr", "Type": "string", "Value": ""}, {"Name": "commitHex", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]
Accept [{"Name": "cur", "Type": "interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}", "Value": ""}, {"Name": "id", "Type": "string", "Value": ""}, {"Name": "moveStr", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]
Reveal [{"Name": "cur", "Type": "interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}", "Value": ""}, {"Name": "id", "Type": "string", "Value": ""}, {"Name": "moveStr", "Type": "string", "Value": ""}, {"Name": "salt", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]
ClaimForfeit [{"Name": "cur", "Type": "interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}", "Value": ""}, {"Name": "id", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]
Cancel [{"Name": "cur", "Type": "interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}", "Value": ""}, {"Name": "id", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]
Render [{"Name": "path", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]

Files

Storage

{
  "raw": "storage: 20720, deposit: 2072000"
}