> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inco.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Inco for Games

> Build hidden-information games on Inco with the ConfidentialDeck template

Card games, raffles, and hidden roles all need the same thing: state that stays
secret until the rules say otherwise. A deck no one can predict. A hand only its
owner sees. A reveal at showdown that everyone can trust.

The [ConfidentialDeck template](https://github.com/Inco-fhevm/confidential-deck-template)
gives you that as one base contract. You inherit it and write only your game
rules. The shuffle, the private deals, the public reveals, and trustless
settlement come with it.

> [card] [Play the live demo](https://confidential-deck.vercel.app)
>
> All four games running on Base Sepolia. Connect a wallet and play.

It is built on Inco Lightning v1. Inco is confidential compute for the EVM, not
FHE and not zk. "Secret" means the value is decrypted by Inco. "Provably fair"
means a covalidator attestation, not a proof.

## The five moves

Everything confidential is one call on `ConfidentialDeck`.

| Move | Kit call | Under the hood |
| - | - | - |
| Shuffle | `_newShuffledDeck(n)` | `e.shuffledRange(1, n+1, ETypes.Uint256)`, one Inco op |
| Draw | `_draw()` | `e.getEuint256(deck, i)` plus auto `allowThis` |
| Deal (private) | `_dealTo(player)` | `card.allow(player)`, only they can decrypt it |
| Reveal (public) | `_revealCard(c)` / `_dealFaceUp()` | `e.reveal(c)` |
| Settle | `_verifyValue(c, value, sigs)` | `e.verifyDecryption(...)`, bound to the handle |

## A whole game in about 15 lines

Inherit the kit and write only your rules. This is a simplified sketch; the real
`War.sol` adds matchmaking and settlement.

```solidity theme={null}
import {euint256} from "@inco/lightning/src/Lib.sol";
import {ConfidentialDeck} from "./kit/ConfidentialDeck.sol";

contract War is ConfidentialDeck {
    mapping(address => euint256) public myCard;

    function startRound() external payable {
        require(msg.value >= deckFee(52), "fee");
        _newShuffledDeck(52);
    }

    function draw() external {
        myCard[msg.sender] = _dealTo(msg.sender); // only the caller can peek it
    }
    // showdown: reveal both cards and settle with _verifyValue(...)
}
```

The frontend half reads cards back.

```ts theme={null}
import { getZap, peekMyCards, decodeCard } from "./client/incoDeckClient";

const zap = await getZap({ local: true });
const [c0] = await peekMyCards(zap, wallet, [handle]);
console.log(decodeCard(c0.value).label); // e.g. "A♠"
```

## What is in the box

> [card] [The ConfidentialDeck kit](https://docs.inco.org/games/confidential-deck.md)
>
> The five confidential moves, the fees, and the rules that break new projects.

> [card] [Worked examples](https://docs.inco.org/games/examples.md)
>
> Four full games: War, Blackjack, Raffle, and Mafia.

> [card] [Run it](https://docs.inco.org/games/quickstart.md)
>
> Install, test against a local node, deploy, and wire the frontend.

> [card] [Source](https://github.com/Inco-fhevm/confidential-deck-template)
>
> The full Hardhat project plus a Next.js demo dApp that plays all four games.

Building with an AI assistant? First set it up with [Build with AI](https://docs.inco.org/build-with-ai.md),
the Inco agent skill that gives your assistant game-design sense. Then hand it the
template: the repo ships an `AGENTS.md` explaining the kit, the per-game privacy
model, and the frontend, so it can start fast.

## More Inco games

More full game apps, built on Inco but not on the deck template. Read them for
different confidential patterns.

> [card] [Incasino](https://docs.inco.org/games/incasino.md)
>
> A six-game casino powered by `e.rand()`. The cleanest look at the
> play-then-settle pattern.

> [card] [Mines](https://docs.inco.org/games/mines.md)
>
> Minesweeper with an encrypted board. Bombs placed by one shuffle, O(1) per
> click, attested cashout.

> [card] [Hangman](https://docs.inco.org/games/hangman.md)
>
> The secret word stays encrypted on-chain. Every guess is resolved with core
> encrypted operations.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.