B

Bet 5 Game

An on-chain betting platform for predicting crypto price movements. Enter pool, predict crypto prices and win up to 15x rewards.

Created on 11th December 2021

B

Bet 5 Game

An on-chain betting platform for predicting crypto price movements. Enter pool, predict crypto prices and win up to 15x rewards.

The problem Bet 5 Game solves

Shortcomings of centralized platforms:

  • The results can be manipulated and made to favor a certain party.
  • User funds can be mishandled as there is no way to track or trace activity.
  • User entries can be hidden to show wrong information to users and steal pool deposits.
  • There is no way to know how points are being calculated and if the winners are actually real winners.

How our platform solves these problems:

  • The Bet 5 platform is decentralized and completely on-chain, making it tamper-proof.
  • Anybody can enter any pool and also view their complete history.
  • All pool funds are stored in the smart contract and their usage is governed by its immutable code.
  • The price data is fetched from ChainLink price feeds and thus cannot be manipulated.
  • The leaderboard is calculated by the smart contract and scores are assigned to users.
  • The score calculation is transparent and winners are decided based upon that score.
  • Rewards distribution is automated by the ChainLink Keeper network.

Challenges I ran into

Automating cancellation and completion of pools

  • We wanted a way to automate the process of pool cancellation and rewards distribution because otherwise we would have to monitor each pool and do a transaction manually every time.
  • First, we thought of a backend that constantly keeps track of the pools and executes transactions when needed. But this would make the platform partially centralized.
  • Also, if the backend was inactive due to some reason, the pools wouldn't end on time and as the scores of the users depend on prices at the end time, it would result in incorrect winners.
  • This was when we found out about the hyper-reliable ChainLink Keeper network and how if we make our contract keeper compatible, the keeper network would do the automation for us.
  • It required a lot of brainstorming to adapt the contract to make it function as intended.

Querying blockchain data efficiently

  • Initially, we used web3 functions to fetch the list of pools and the data for each pool. But as the number of pools started to increase, there was a large increase in the loading time as well. This would be unpleasant for the end-user. So we researched ways to fetch blockchain data.
  • The Graph protocol seemed to provide exactly what we needed and after a few tries, we were able to build our very own subgraph for the contract.
  • Fetching data using GraphQl queries from the indexed subgraph data dramatically reduced the loading time and allowed us to easily filter data as well.

Building a notification system

  • We wanted to improve user experience and create a notification system that updates active users about platform events.
  • We got to know that we use WSS providers to listen for events and then added listeners in the frontend to implement it.

Discussion

Builders also viewed

See more projects on Devfolio