8.1 Example of Betting Game

We’ll introduce to the development process with an example of a dice program with specific source code: cocos-dice-sample。This includes contract development, deployment, debugging, and front-end contract call.

We hope the community have a complete understanding of DApp development based on Cocos-BCX.

Game Rules

The game rules of Dice are very simple, with the following specific steps:

  1. Set the bet amount
  2. Adjust the slider to bet on the upper limit of the dice number and change the chance of winning
  3. Click “Roll” to place a bet. If the result is less than your bet number, you will be awarded immediately. The program will make the settlement based on the winning rate.

Development Environment

Environment
Version
Description

MacPro

10.14.2 (18C54)

VSCode

1.32.3 (1.32.3)

Node

v10.13.0

JS SDK

1.3.2.2

8.1 Example of Betting Game


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.