War
The smallest game. One private card each, higher rank wins.- Each player’s card is dealt with
_dealTo, so only they can peek it. - Both cards reveal at showdown, then settle by comparing verified values.
- Matchmaking uses a rooms array.
join()seats you at an open table or opens a new one, so a busy table never blocks a newcomer.
contracts/examples/War.sol
Blackjack
Solo play against the house. Private hand, hit loop, public dealer upcard, reveal-all, attested settle, and a pull payout.- The player’s hand is dealt face-up on purpose. There is no opponent to hide it from, and it keeps the UI free of signature prompts.
- The confidential part is the dealer’s hole card and the undealt shoe, hidden
with
_drawuntil the player stands. - Scoring lives in
BlackjackMath.sol, pure Solidity with no Inco calls, so it unit-tests without a covalidator.
contracts/examples/Blackjack.sol
Raffle
The kit is not just for cards. One shuffle picks a hidden winner, revealed at the draw.- The winning ticket is a hidden draw, unknowable even to the deployer until
draw()reveals it. - Entrant addresses and ticket numbers are public by nature. Only the outcome is secret until reveal.
newRound()reopens for a fresh draw.
contracts/examples/Raffle.sol
Mafia
Selective reveal. Each player privately learns only their own role.- Each role is dealt with
_dealToto its owner, so only that player can decrypt it. - No role is ever revealed on-chain. Social play happens off-chain.
reset()reopens for a fresh round.
contracts/examples/Mafia.sol
What stays secret
No plaintext card or role value is ever emitted in an event or stored in the clear. Contracts hold onlybytes32 handles. Plaintext appears on-chain only at
a deliberate e.reveal or _verifyValue settlement point. e.verifyDecryption
binds the signed value to the stored handle, so a valid attestation for a
different handle cannot be substituted.