A technical deep-dive into the chia-gaming architecture.
Every blockchain must choose how to track the state of its network — what to use as its first-class object. Ethereum chose accounts, for their programmability. Bitcoin chose UTXOs, for their simplicity. Chia chose coins, because they provide the best of both worlds. The coin-set model embodies both the programmability of Ethereum, coupled with the simplicity of Bitcoin.
We built the Chia Gaming platform as proof — it allows you to use your own coins, in your own wallet, to play games of skill against anyone on Earth, with nothing but the immutable blockchain to ensure fairness. No casinos, no rakes, no central entities to call the shots. Just you and another player, one on one, competing for real money, with no way to cheat.
Play Off-Chain, Enforce On-Chain
State channels let two parties transact off-chain at full speed and only touch the blockchain to open, close, or resolve disputes. Chia’s coin set model makes this especially powerful for gaming: because every coin carries its own programmable logic, game state lives inside the channel as ordinary coins. No custom infrastructure needed, just the same UTXO mechanics that make Lightning work, generalized.
Two players fund a state channel. They play a game entirely off-chain by exchanging signed messages, only touching the blockchain if someone tries to cheat, or when they’re ready to settle up.
The blockchain isn’t a bottleneck, it’s the auditable backstop that keeps everyone honest.
Chia state channels share an architectural similarity in its core mechanisms with Bitcoin’s Lightning payment channels: lock funds in a multisig, exchange signed commitments off-chain, settle or dispute on-chain. The difference is what you can do inside the channel.
Bitcoin Lightning channels move funds back and forth. Chia channels can do that too. But Chia’s coin-set model also supports programmable coins, the key channel infrastructure that enables real-time gameplay without any special channel logic for gaming. The channel doesn’t know or care that it’s running a game vs. a simple transaction. Context on transactions come from the Coin layer, not the channel layer.
Visualizing the Architecture
In Chia gaming, the on-chain structure is a coin hierarchy. Each coin has a “puzzle” (a script) that defines exactly who can spend it, and how. Off-chain, players use the Potato Protocol, a turn-taking system, to keep mutually signed commitments on how the channel coin should eventually be spent.
As detailed in the gaming documentation, this flow ensures that if a dispute arises, the system “unrolls” the state until the most recent, valid game move is reached and enforced.
Why Chia Gaming Works
1. The Channel is a Coin, Not a Database Row
In account-based designs, a channel is a piece of storage inside a contract. In Chia, the channel is a specific coin. Bitcoin devs will recognize this immediately as it’s the same UTXO-based model that Lightning uses, extended with programmable spend conditions.
- Clean Shutdown: Spend the coin to a payout address.
- Dispute: Spend the coin toward an “Unroll” coin. Auditing is straightforward, you’re looking at a specific coin and its spend conditions, not a storage slot in a global contract.
2. The “Unroll” State Machine
The Unroll Coin handles disputes through optimistic rollback. If an opponent tries to settle using an old game state, you can “preempt” them with a newer signed state which is conceptually similar to Lightning’s penalty mechanism, but generalized beyond simple balance updates. Because this is handled at the coin level, there is no “hot global mutex” problem where everyone is fighting to update one central contract. Each channel is independent, just like each Lightning channel is independent.
3. “Virtual” Coins: Where Gaming Becomes Possible
Off-chain, game coins are “virtual.” They don’t exist on the blockchain ledger yet, but we validate them using the exact same Chialisp code that runs on-chain. If the channel unrolls, these virtual coins “materialize” into real on-chain coins.
This is what separates Chia channels from Lightning. Bitcoin’s scripting is currently too constrained to represent game state as a coin so Lightning channels can only shuffle balances. Chia’s coin model is scalable enough that a coin can represent a game board, a hand of cards, or any arbitrary state. The channel infrastructure doesn’t need special game logic, so Bitcoin could adapt Chia Gaming simply by supporting OP_CAT. The referee (the on-chain dispute resolver) validates moves using the game’s own Chialisp code so it doesn’t know or care what specific game is being played.
Key Benefit: We don’t have to write two versions of the game logic (one for the app and one for the chain). The code is identical.
4. Parallel Play
Each game in a channel is its own coin, structurally isolated. Multiple games run simultaneously in the same channel. If Game A has a dispute, it doesn’t block the payout or progress of Game B. This is a direct benefit of the coin set model: independent coins, independent state.
What’s Next?
The chia-gaming repo is currently a Proof-of-Concept for gaming (check out our Calpoker implementation!). The engineering path forward builds directly on Lightning-style infrastructure:
- Payment Routing: Multi-hop settlement using the coin set model; the same fundamental approach as Lightning Network routing, extended to support atomic cross-asset swaps.
- CAT Support: Bringing Chia Asset Tokens into channels so you can wager more than just XCH.
- Scalability: Moving routine transfers off-chain to keep fees low even during peak congestion.
The Takeaway
Account-based chains excel at shared global state (AMMs, lending pools). For peer-to-peer protocols; payments, gaming, any bilateral interaction; the coin-set model adapts, scales, and enables better peer-to-peer transactions, and gaming serves as a great tool to demonstrate how powerful the coin-set model can be.