Skip to content

chain.wtf SDK

Build games for chain.wtf, from solo wagers against the house to multiplayer battles for a shared pot. Pick an SDK, spin up a simulator, and start dealing.

Docs for building iframe games compatible with Chain protocol and that run inside the Chain.wtf host application.

For a casino game, prefer the Slot Engine or the Graph Engine to a contract of your own. An engine game needs no Solidity, only its frontend is reviewed, and it joins the offering as soon as it deploys.

Create a game from an example with the chain command, then play it in the SDK simulator:

Terminal window
npx @chain-protocol/cli init casino my-game
npx @chain-protocol/cli init pvp my-game

With Bun, use bunx instead of npx. Getting Started walks through a casino game from an empty directory to a played round, and the PvP Local Simulator page does the same for a PvP game.

To add an SDK to an existing project, install it with the CLI at the same version:

Terminal window
npm install @chain-protocol/casino-sdk # or @chain-protocol/pvp-sdk
npm install --save-dev @chain-protocol/cli

With Bun, run bun add @chain-protocol/casino-sdk and bun add --dev @chain-protocol/cli.

  • Casino: @chain-protocol/casino-sdk, @chain-protocol/casino-sdk/guest, @chain-protocol/casino-sdk/contracts/*, @chain-protocol/casino-sdk/slot-engine and @chain-protocol/casino-sdk/graph-engine.
  • PvP: @chain-protocol/pvp-sdk, @chain-protocol/pvp-sdk/guest, @chain-protocol/pvp-sdk/liveness, @chain-protocol/pvp-sdk/spectator and @chain-protocol/pvp-sdk/contracts/*.

./host, ./simulator and ./conformance are internal to both SDKs. They serve the Chain.wtf host, chain dev and game-verify, sit outside semver and can change in any release.