There are various betting app in the market. But since most of them are run by centralized authority, there is a risk of losing your bet money if suddenly company collapses or thinks of changing betting policy. So, I created Smart Contract that will let me bet on various games and utilizes off chain data fetching using chainlink to verify the games result and return the money automatically without relying on central authority.
Here are some challenges I faced while working and how I got over it:
- Firstly I came across problem of getting off chain data to on chain. Tried various things like finding oracle on chainlink with my specific requirements, searched for other method to get off chain data. But after trial and error I found that I needed to create my own external adapter to fetch API of my like with custom parameters. And hosted the adapter on Azure VM and then used node service of chainlink from naas.link to create my node and also to create a bridge and job to get data from my API.
- There was no contract specific on betting. So I created the contract from scratch. I ran on problems like how to create Bets and how to bet user money and claim accordingly. This was solved by creating tests and running the project live and trying various ways that will make the contract consume less gas fee.