Skip to content

The Oasis Gaming SDK

To simplify development of turn-based multiplayer games, Oasis provides a framework that automatically handles the core aspects of games including state management and game flow. The core bits of our gaming SDK are modelled after, a popular JS/React-based game framework, making it easy to reuse their library of frontend components.

To build a new game with this framework, developers simply write a small Rust module that defines the core game logic—how moves are made, how to check victory conditions—and the framework handles all the other details, such as converting your rules into a smart contract and making them testable in-browser. Since the game logic running in browser is identical to what's running in your contract, you can be confident that once it's working locally, it's going to work when deployed!

The framework and game logic are deployed together on the blockchain. This allows for truly decentralized blockchain games without the need for additional components like game servers.

Features of the game framework include:

  • State synchronization: The framework synchronizes state in realtime between the browser and the blockchain by communicating over web3 and listening for events emitted by the game. When the on-chain game state changes (e.g. because a player made a move), the framework automatically updates the browser view for each player. It also comes with a game manager library, so you'll never need to interact with web3 directly.

  • Secret state: This framework can leverage Oasis's confidentiality features to keep game state hidden from players and miners.

  • Optimistic execution: When a user makes a move, it is immediately executed in the browser while the transaction processes on the blockchain. This provides a more responsive user experience since moves are reflected immediately in UI. Note this is just an optimization: the blockchain is always authoritative about game state, and the library will automatically resynchronize if the browser state differs from the blockchain state.

  • Development mode: A mode in which the game engine and your smart contracts run entirely in the browser. This is useful for development since you don't need to worry about deploying the smart contract or interacting with the blockchain until you're ready to publish your game. Development mode also includes a browser-based debugging panel to inspect the game state and trigger game actions.


  • MetaMask installed and configured for Oasis. See our Getting Started guide for instructions.
  • Familiarity with React, a web development framework.
  • Familiarity with Rust a programming language.

Next Steps

To get started using the Gaming SDK, we recommend you first check out our tutorial, which walks you through building a simple game (Tic-Tac-Toe) using our gaming Truffle box. Once you're comfortable with the basics, take a look at two more complex games to see how to build games with confidential state and pseudorandomness:

  • Connect Four: A simple game that reuses many frontend components from the Tic-Tac-Toe, to demonstrate how the example might be extended.

  • Battleship: Battleship requires that each player's ship layout remains secret. Our implementation also assigns each player a random layout at the beginning of the game, skipping the placement step. Take a look at this repo if you want to build a game with confidential state and/or pseudorandomness.

  • Poker: Like Battleship, Poker depends on keeping each player's confidential. In addition, it requires a more complex turn-order (our other demo games all use Round Robin), and uses more advanced flow methods to achieve this.