Blaize
Contact us
  • Home
  • Services
    • Back
    • Blockchain ecosystems
    • Decentralized application
    • Smart contracts
    • Developer tools
    • Enterprise solutions
    • Blockchain integration
    • NFT Development Services
    • GameFi Development
    • Token Development Services
  • Blaize.Security
  • Solutions
    • Back
    • Blockchain Consulting Services
    • For enterprises
  • Team
  • Cases
  • Blog
  • Careers
  • fb
  • LinkedIn
  • Twitter
info@blaize.tech +38 095 53 72 031

Kyiv, Ukraine

26 Metalistiv St

Dnipro, Ukraine 20

Sichovykh Striltsiv St

Smart contract based betting platform development for SocialBets

2 months

Share:

Share on FacebookShare on TwitterShare on TelegramShare on WhatsApp

SocialBets provides a smart contract-based betting platform where users are able to place a wager in ETH on the outcome of any event they choose. Depending on the events’ results, the winner grabs his bet and money of his opponent as a winner prize. 

What was the task ?

Blaize was involved in decentralized betting platform development from the initial project planning to the mainnet deployment. This project required complex solutions involving both front-end and contract developers teams. 

The client request was such that neither back-end nor Subgraph should be used in order to simplify the systems’ work and keep it completely decentralized. Consequently, we need to organize smart contract architecture on the blockchain part which will interact with the front-end directly. 

One of the main tasks before starting the development was the depiction of the bet status change. So we needed to design smart contracts’ scheme for their future implementation. 

Ethereum blockchain was chosen due to its large toolset and a wide list of ready-made solutions that considerably faster the development. In addition, Ethereum is a trustable and well-know solution that helps to gain more credit from users in terms of delivering a new product to the market. 

The Development Process 

The project was held by the team of Solidity and front-end developers supported by QA and DevOps desks. 

Primarily, we have divided the development process into three main milestones: 

1. Smart contract development 

2. Front-end development

  • smart contracts integration
  • Metamask integration

3. Project testing with contracts in the testnet

4. Mainnet deployment and project delivery

The first milestone was dedicated to the architecture planning and implementation of the smart contracts system. 

While developing smart contract logic for the betting platform, the developers need to concentrate on providing the proper storage handling for betting and mediation flow as well as ensure safety in admin methods. We used Standard Ethereum development kit – Solidity smart contracts within Truffle Suite for SocialBets smart contracts set. 

The next step was to develop the front-end parts and connect it with the contracts’ methods. The application layer is built on React with Web3 provider (for MetaMask) integration.

smart contract based blockchain platform smart contract developers
Social Bets web app optimization: the process of creating a new bet

Metamask integration 

To ensure application interaction with Ethereum blockchain the platform needs MetaMask integration. This eliminates unwanted frictions and makes the performance process smoother. 

The betting platform interface uses MetaMask for dApp logging, sending the transactions, staking ETH and checking info about the user’s holdings. Also, it stores the actual user account which is used for receiving the funds and rewards.

Timeout handlers

The absence of back-end in this case contributed to creation of a few interesting and challenging features that helps replacing automatic and time-dependent solutions. 

For example, each bet has a voting timeout and a mediation timeout – time periods that should be followed by an automatic bet cancellation or bet finishing. Since there is no possibility to implement such timeout handlers on the blockchain part, we needed to translate this functionality to the front-end. 

Such implementations allow users to manage certain events by themselves and process transactions (for instance send them for moderation or cancel a bet). 

The last milestone was concentrated on platform testing and testnet/mainnet deployment. We used Ganache node for the local testing as a universal solution for smart contract based applications. We performed 100% unit-test coverage of smart contracts and the full set of manual tests for frontend and frontend-vs-contracts interactions. 

Blaize’s team of QA engineers strongly recommend providing manual testing, even if the project has passed all automated tests and has shown great performance. Manual testing often helps to detect the bugs or defects connected to the user experience as a prior. 

The automatic tools in the majority of cases are not able to recognize for ex. the size of the image on the pop-up messages or the rightfulness of text provided into it. That is why manual tests execution is highly appreciated. 

Challenges we confronted 

The absence of a backend surely simplifies the system but leads to storing an extensive amount of data on the blockchain part. Smart contracts are overloaded with information (like bet descriptions and metadata, extra number of events emitted etc.) that may considerably slow the application work and make them costly. 

That is why we can define the optimization of communication between smart contracts and the web app interface (on the front end part) as one of the main challenges of this development. In further explanation, without the right front-end reorganization the dApp might have worked very slow and have difficulties with querying data from the blockchain. 

In order to solve this problem, we needed to reorganize the process of data receiving. For the SocialBets case we organized the logic so that contracts communicate directly with the front-end and get the data from various events and getters. In order to perform this, we added a few extra storage structures and view methods in the contracts with an event emitted on every action. 

smart contract ethereum smart contract development
The dashboard interface implementation for SocialBets web application

We brought the main functions (supposed to be on the back-end part) to the user interface in the web app. We distributed them into tabs – for example for closed, created or funded bets – like on the picture above. 

The implementation of blockchain represented by smart contracts allows for omitting the back-end and configure the software so that it communicates with the front-end. Thus, the end-user may interact with the contracts directly from Etherscan.

Result 

As a result we get a smart-contract based betting platform that allows its users to make bets for any events. The lack of back-end part enables the simplification of the system along with its full independence and decentralization. The usage of Ethereum framework ensures the proper work of smart contracts and allows creating bets in ETH.

Service

  • Smart contracts

Blockchain

  • Ethereum

Project stage

Finished product

Technologies

  • Ethereum
  • React
  • Solidity
  • Truffle
  • Web3.js

Other cases

FANTASY BASKETBALL APP DEVELOPMENT: NOMO FANTASY BASKETBALL LEAGUE CASE STUDY

Service

  • Blockchain based platforms
  • Crypto games
  • GameFi
  • Smart contracts
  • Staking platforms
  • Token emission and distribution

Blockchain

  • Polygon
3 months
SMART CONTRACT SECURITY AUDIT FOR CUPCAKE – NFT APP

Service

  • Security audits

Blockchain

  • Ethereum
3 weeks
DECENTRALIZED APP DEVELOPMENT FOR THE CRYPTO GAME

Service

  • Blockchain based platforms
  • Crypto games
  • Smart contracts
  • Staking platforms
  • Token emission and distribution

Blockchain

  • Ethereum
  • Polygon
6 months
SMART CONTRACT SECURITY AUDIT FOR LIQUIDACCESS

Service

  • Security audits

Blockchain

  • Ethereum
1 week
NFT GAME DEVELOPMENT – FANTASY FOOTBALL LEAGUE

Service

  • Blockchain based platforms
  • Crypto games
  • Smart contracts

Blockchain

  • Polygon
5 months
PeakDeFi: Case Study For Smart Contract Security Audit

Service

  • Security audits

Blockchain

  • Ethereum
2 weeks
SMART CONTRACT SECURITY AUDIT FOR NEMUS

Service

  • Security audits

Blockchain

  • Ethereum
2 weeks
SMART CONTRACT SECURITY AUDIT FOR CRYPTO COLLECTIVE

Service

  • Security audits

Blockchain

  • Ethereum
1 day
Blaize

Address

Kyiv, Ukraine26 Metalistiv St

Dnipro, Ukraine20 Sichovykh Striltsiv St

Contactкее

Tel.: +34 624 45 15 40 E-mail: info@blaize.tech

Follow

  • Facebook
  • Twitter
  • LinkedIn
  • twitter
  • facebook
  • linkedin

Subscribe news

    top blockchain developers
    GoodFirms Badge

    Copyright © Blaize - blockchain development company 2018-2023

    B2B inbound marketing with