npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bitboss/game-integration

v1.0.42

Published

![BitBoss Logo](https://user-images.githubusercontent.com/2952481/71929859-c8dc0680-3157-11ea-8335-27979acd2d40.png)

Downloads

101

Readme

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.