MCPcopy Index your code
hub / github.com/Chia-Network/chia-gaming

github.com/Chia-Network/chia-gaming @0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.3.0 ↗ · + Follow
2,852 symbols 8,280 edges 224 files 155 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

chia-gaming

This project enables two-player games for real money over Chia state channels, with no trusted intermediary. Play can usually be done in real time. Players fund a shared channel coin on the Chia blockchain, then play games entirely off-chain by exchanging signed messages (the "potato protocol"). The blockchain is only touched for opening, closing, or resolving disputes.

The reference games are California Poker — a poker variant using commit-reveal randomness, and Space Poker, a Texas Hold'em variant.

For production builds, tarballs, and step-by-step build instructions, see DEVELOPMENT.md.

Documentation

  • OVERVIEW.md — How state channels, the referee, the potato protocol, and Calpoker work. Links to detailed docs.
  • DEVELOPMENT.md — Build, debug, and run the player app and lobby tracker locally or in production.
  • FRONTEND_ARCHITECTURE.md — Player app and tracker: React components, WASM bridge, WebSocket relay protocol.

Project Structure

src/
  channel_handler/  — State channel management and the potato protocol
  referee/          — Referee coin logic (on-chain move validation, slashing)
  potato_handler/   — High-level game orchestration and on-chain actions
  games/            — Game registration (calpoker, spacepoker, test-only debug game)
  peer_container.rs — Peer-to-peer game cradle (synchronous wrapper)
  simulator/        — Chia blockchain simulator and integration tests
  test_support/     — Shared test utilities
  common/           — Shared types, CLVM utilities, standard coin logic
  shutdown.rs       — Clean shutdown conditions

clsp/
  games/calpoker/   — Calpoker chialisp (handlers, validators, handcalc)
  games/spacepoker/ — Space Poker chialisp (handlers, validators, hand eval)
  referee/onchain/  — Referee puzzle (on-chain arbitration)
  unroll/           — Unroll puzzle (state channel dispute resolution)
  test/             — Chialisp test programs

wasm/               — WebAssembly bindings for browser use
front-end/          — Player frontend (React + WASM bridge)
lobby/              — Lobby frontend and tracker service

Extension points exported contracts — how you extend this code

SpendWalletReceiver (Interface)
Spend wallet receiver [7 implementers]
src/potato_handler/types.rs
ErrToError (Interface)
(no doc) [8 implementers]
src/common/types/error.rs
ManagedCradle (Interface)
The minimal interface the [`TransactionManager`] needs from the cradle it wraps. Implemented by [`SynchronousGameCradle [3 …
src/transaction_manager.rs
PeerHandler (Interface)
(no doc) [5 implementers]
src/peer_container.rs
ErrIntoJs (Interface)
(no doc) [4 implementers]
wasm/src/mod.rs
InternalBlockchainInterface (Interface)
(no doc) [3 implementers]
front-end/src/types/ChiaGaming.ts
HasStateUpdateProgram (Interface)
(no doc) [1 implementers]
src/channel_handler/types/state_update_program.rs
LobbyConnMeta (Interface)
(no doc)
lobby/lobby-service/src/index.ts

Core symbols most depended-on inside this repo

allocator
called by 232
src/common/types/alloc_encoder.rs
to_clvm
called by 143
src/test_support/debug_game.rs
into_gen
called by 118
src/common/types/error.rs
log
called by 105
front-end/src/services/log.ts
bytes
called by 98
src/common/types/aggsig.rs
to_coin_id
called by 85
src/common/types/coin_string.rs
proper_list
called by 84
src/utils.rs
hash
called by 65
src/common/types/puzzle_hash.rs

Shape

Method 1,249
Function 1,130
Class 260
Interface 154
Enum 59

Languages

Rust64%
TypeScript36%

Modules by API surface

wasm/src/mod.rs105 symbols
src/peer_container.rs104 symbols
src/channel_handler/mod.rs102 symbols
front-end/src/types/ChiaGaming.ts90 symbols
front-end/src/hooks/WasmBlobWrapper.ts75 symbols
front-end/src/hooks/save.ts74 symbols
src/transaction_manager.rs71 symbols
src/tests/calpoker_validation.rs65 symbols
src/simulator/tests/potato_handler_sim.rs62 symbols
src/tests/spacepoker_handlers.rs55 symbols
bencodex/src/de.rs55 symbols
src/potato_handler/mod.rs54 symbols

For agents

$ claude mcp add chia-gaming \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact