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

poker source realm

Package poker is a trustless no-limit Texas Hold'em realm. See docs/protocol.md for the normative protocol and API.

Overview

Package poker is a trustless no-limit Texas Hold'em realm. See docs/protocol.md for the normative protocol and API.

Functions 21

func Accept

crossing Action
1func Accept(cur realm, tableID, handNo uint64)
source

Accept agrees with the result; when all hand players accept, the hand is finalized without waiting for the window.

func Act

crossing Action
1func Act(cur realm, tableID, handNo uint64, action string, amount int64)
source

Act applies a betting action by the player to act.

func Challenge

crossing Action
1func Challenge(cur realm, tableID, handNo uint64, accused int, kind string, index int, inB64, inProofHex, outB64, outProofHex string)
source

Challenge disputes one element of a shuffle or rekey pass during the challenge window (protocol.md section 5).

func CreateTable

crossing Action
1func CreateTable(cur realm, smallBlind, bigBlind, minBuyIn, maxBuyIn int64, maxPlayers int, actionTimeoutBlocks, challengeWindowBlocks, challengeBond int64) uint64
source

CreateTable creates a table and returns its id.

func Finalize

crossing Action
1func Finalize(cur realm, tableID uint64)
source

Finalize settles the hand once the challenge window has passed.

func GetDeck

Action
1func GetDeck(tableID uint64) string
source

GetDeck returns the latest deck pass of the current hand as standard base64, or "" before the first pass.

func GetTable

Action
1func GetTable(tableID uint64) string
source

GetTable returns the full table and hand state as JSON.

func Join

crossing Action
1func Join(cur realm, tableID uint64, session string, gasAllowance int64)
source

Join takes a free seat with the attached ugnot minus gasAllowance as stack and forwards gasAllowance to the session address.

func Leave

crossing Action
1func Leave(cur realm, tableID uint64)
source

Leave pays out the stack, or marks the seat leaving until the hand ends.

func Render

1func Render(path string) string
source

Render shows the newest renderMaxTables tables, or one table at path "<id>".

func RevealSeed

crossing Action
1func RevealSeed(cur realm, tableID, handNo uint64, seedHex string)
source

RevealSeed opens the caller's seed; published card keys are checked at once.

func ShareKeys

crossing Action
1func ShareKeys(cur realm, tableID, handNo uint64, keysHex string)
source

ShareKeys publishes the caller's card keys for the current deal step.

func SitIn

crossing Action
1func SitIn(cur realm, tableID uint64)
source

SitIn makes the caller eligible again from the next hand.

func SitOut

crossing Action
1func SitOut(cur realm, tableID uint64)
source

SitOut skips the caller from the next hand on.

func StartHand

crossing Action
1func StartHand(cur realm, tableID uint64)
source

StartHand moves the button, posts blinds and opens the shuffle.

func SubmitRekey

crossing Action
1func SubmitRekey(cur realm, tableID, handNo uint64, deckB64 string)
source

SubmitRekey records the caller's re-keyed deck.

func SubmitShuffle

crossing Action
1func SubmitShuffle(cur realm, tableID, handNo uint64, commitHex, deckB64 string)
source

SubmitShuffle records the caller's commitment and shuffled deck.

func Timeout

crossing Action
1func Timeout(cur realm, tableID uint64)
source

Timeout applies the stall rules once the current deadline has passed.

func TopUp

crossing Action
1func TopUp(cur realm, tableID uint64)
source

TopUp adds the attached ugnot to the caller's stack between hands.

Types 6

type ChallengeRecord

struct
1type ChallengeRecord struct {
2	Challenger int
3	Accused    int
4	Kind       string
5	Index      int
6	Guilty     bool
7}
source

ChallengeRecord is one resolved challenge.

type Hand

struct
 1type Hand struct {
 2	No       uint64
 3	Phase    int
 4	Players  []*HandPlayer
 5	Bet      *holdem.Betting
 6	Roots    []string // hex root per accepted deck pass
 7	Owing    []bool   // per player, for deal steps
 8	Deadline int64
 9	Cards    []int // official card per position, after reveal
10	Result   *Result
11	Settled  bool // contributions have been paid out or refunded
12}
source

Hand is the state of the current or last hand of a table.

type HandPlayer

struct
1type HandPlayer struct {
2	Seat     int
3	Owner    address
4	Commit   string         // hex
5	Seed     string         // hex, after reveal
6	Keys     map[int]string // position -> hex card key
7	Revealed bool
8	Accepted bool
9}
source

HandPlayer is a seat's participation in one hand.

type Result

struct
1type Result struct {
2	Aborted    bool
3	Convicted  []int
4	Stallers   []int
5	Credits    []int64
6	Scores     []int
7	Challenges []ChallengeRecord
8}
source

Result is the outcome of a hand. Credits are what settlement adds to each hand player's stack (winnings, or refund plus penalty share on abort).

type Seat

struct
1type Seat struct {
2	Owner      address
3	Session    address // empty when the owner acts directly
4	Stack      int64
5	SittingOut bool
6	Leaving    bool // pay out and free the seat when the current hand ends
7	Waiting    bool // joined during a hand, plays from the next one
8}
source

Seat is an occupied table seat.

type Table

struct
 1type Table struct {
 2	ID              uint64
 3	SmallBlind      int64
 4	BigBlind        int64
 5	MinBuyIn        int64
 6	MaxBuyIn        int64
 7	MaxPlayers      int
 8	ActionTimeout   int64
 9	ChallengeWindow int64
10	ChallengeBond   int64
11
12	Seats    []*Seat
13	Button   int // seat index of the last button, -1 before the first hand
14	HandNo   uint64
15	Hand     *Hand
16	Deck     string // raw bytes of the latest deck pass of hand DeckHand
17	DeckHand uint64
18}
source

Table is a persistent cash table.

Dependencies

Source Files 6