@bitboss/game-integration
TypeScript icon, indicating that this package has built-in type declarations

1.0.42 • Public • Published

BitBoss Gaming Platform Content Integration

BitBoss Logo

Overview

This document describes how a content provider integrates an html5 game into the BitBoss mobile wallet app. The BitBoss app runs on Android and iOS. It launches games within a webview and therefore the game must be built with html5 and javascript/typescript. The app communicates with the game using DOM window events.

Here is a demo of a Baccarat html/javascript game that is embedded in the BitBoss app. All bets and payouts are done using Bitcoin SV in real time. https://vimeo.com/394213215

Architecture

This diagram shows the high level flow in our platform: Architecture Overview

  • Games are embedded within the BitBoss mobile app
  • A game gets balance information from the BitBoss app and it calls the BitBoss app to submit a bet
  • The BitBoss mobile app sends bets and funds (BSV) to the blockchain
  • A game service specific to a type of game play detects blockchain bet transactions sent to it
  • The game service produces randomness and processes the bet
  • The game service uses an Oracle for external public information such as a lottery drawing result
  • The game service calls into a proprietary math model by calling a compiled binary library that is provided to BitBoss by the content provider. This is only used for certain game types such as Slots
  • The game service sends commissions (in BSV) to the affiliate and content providers
  • The casino gets the funds that are not won by the player
  • The bet result and any payout (BSV) is sent back to the player’s app via the blockchain

Client Game

The game implements a “manager” typescript class that extends the GameManager base class shown below. This is the implementation for communicating between the game and the BitBoss mobile wallet app. This manager class gets called by the game UI code to do things like:

  • Get the player’s current balance in the currency configured in the game wallet (USD, BSV, etc.)
  • Get the min and max bet limits that are allowed
  • Get the player's preferred language
  • Place a bet or a set of bets
  • Process the bet results once they come back from the blockchain
  • Get prior bet and payout information to show on a history screen
  • Get and set favorite bets
  • Exit the game and return to the BitBoss app

The npm package for this GitHub project is located at: https://www.npmjs.com/package/@bitboss/game-integration.

GameManager Base Class

This GameManager base class contains the fundamental methods required to communicate with the BitBoss app. It has the bet and history interfaces defined at the top. The game developer extends this class and overrides the methods as necessary to customize the implementation.

Method Purpose
getBalance Get the player's balance
getBetConfiguration Get configuration details such as the minimum and maximum allowed bets
placeBet Send bet(s) to the Bitboss app to be sumbitted to the blockchain
processBetResults This method must be overridden, it's used in the callback when receiving bet results
getHistory Bet history for each bet placed and the corresponding results
saveFavoriteBets Save favorite bet information in the mobile app local storage
getFavoriteBets Retreive any stored favorite bets
saveGameState Saves game specific state data to local storage
getGameState Retrieves game state data from local storage
clearGameState Clears all game state data for the game
exitGame Call this method from the game UI to exit back to the BitBoss app
launchURL Sends the player to an external website, for example a provably fair page

Example Game UI Class

The GameUIExample class shows an example of how to register a callback handler to receive bet results once the BitBoss app receives them from the blockchain.


Game Service

The game service is a smart contract that reacts to bet transactions sent to its address on the Bitcoin SV blockchain. BitBoss creates a game service for every game type: Baccarat, Slots, Lottery, Roulette, etc. and deploys high available instances of each required game service that a casino wants to run.

Oracle Services

An Oracle service provides data not generated by the casino that is needed for a game, for example the result of a public lottery drawing. The game service can call an Oracle to get such data while processing a bet result.

Content Provider Modules

The game service may also need to invoke a content provider’s proprietary logic that is required to produce the game results. An example of this would be the math model for a Slot game. For this case a local web service is configured with the game server that has the ability to call into the content provider’s code/logic which has been compiled into a software module. The game service sends over the RNG and the content provider’s module returns the game result.

Payouts

The game service packages the bet result and a payout (if the player won the bet) and sends in a transaction to the blockchain addressed to the player’s wallet. The game service will also pay affiliates and content providers their commission when processing each bet. The content provider will have their own BSV crypto wallet to receive payments.

Bet Result to Client

The BitBoss mobile app reacts to the bet result transaction and sends it to the embedded game to then show the game result in the UI. At the same time the player’s crypto wallet balance is updated to show any payouts received.

Readme

Keywords

none

Package Sidebar

Install

npm i @bitboss/game-integration

Weekly Downloads

1

Version

1.0.42

License

ISC

Unpacked Size

24.2 kB

Total Files

7

Last publish

Collaborators

  • uabeseda
  • justin16
  • ford152
  • andrejstarusev
  • maxim-baykalov