Inspiration

Basket-bets is a betting platform inspired by fiat betting sites like Betdaq and on-chain solutions like Augur and aims to simplify the customer experience of betting with cryptocurrency, while behind the scene being supported by a elaborate and highly advanced Chainlink driven, trustless mechanism for settlement of binary prediction markets. I believe that an easily accessible and welcoming UX, a solid engine and a strong sports related brand and business model will help to facilitate adoption of cryptocurrency betting, as well as heighten the awareness of Chainlink as a foundation for such solutions, in addition to being a trusted price feed provider.

What we solve

Most other betting solutions aims at providing the broadest possible selection of different sports and events, which can both be good and bad. The good part is that we can bet on anything we want, but seen from a business and social interaction perspective, the site brand “punch” suffers, and most often assumes a bland, diluted identity due to the generic nature that inherently comes with offering a vast selection of betting objects across many different sports. This is where Basket-Bets tries something completely different, and, in focusing in one specific sport, aspires to be a noise-free social gathering and gambling site for people interested in a specific sport. A possible long term business plan could be to “white-label” it, enabling a modular, betting-portal-as-a-service business, including branding, social media aspects, news, live feeds and sponsorships, - for any given sport, aimed directly at customers interested in that particular sport. Secondly, the Basket-Bets backend ID Supervisor aims to solve the problem of settling based on trust aggregation of heterogenous data from multiple sperate data sources, and EasyAdapter provides code-less external adapters configurable with a json file.

What it does

Basket-bets offers a betting-exchange and a parimutuel pool betting experience in one simple interface, as well as a crude but promising odds-based pool staking mechanism, that automatically calculates and yields transaction fee share rewards to LP holders upon settlement. Basket-Bets offers between 20-100 daily Basketball match fixtures, which are automatically injected into the contract from the API’s on a daily basis without any manual intervention. Basket-Bets uses an advanced qualification algorithm for match eligibility, where only matches that can be verified in the ID Supervisor (e.g., are available in both the Master and the Reference APIs) are made available for betting, as only those matches can be truly trustlessly settled, using the agreement synthesis of multiple separate API’s. BasketBets aims at providing near-instant settlement upon match completion, a real-time API for high-frequency feedback, as well as fully transparent transactions.

How we built it

Basket-Bets is a 100% autonomous system, supported by a Chainlink integrated backbone contract deployed to the Polygon Mumbai chain, a react.js front-end, an Amazon AWS Serverless Backend, a complete Chainlink environment with a 0.10.6 node, - and an advanced json-configurable External Adapter with the ID Supervisor module built-in for the hackathon. The Basket-Bets DAPP UI is built using react, Web3 and Web3React. The web application is installed on a number of EC2 instances managed by an Amazon AWS Autoscaling Group behind a Load Balancer and can be configured to automatically scale horizontally to any imaginable load when needed. The Chainlink node environment is a simple docker-based installation, supported by an AWS RDS Serverless PostgreSQL database instance, and do not currently utilize any fail-over or scaling mechanisms. The off-chain backend is built in a server-less environment using AWS Lambda functions and DynamoDB Tables, supported by DynamoDB Stream Triggers, AWS SQS, AWS EventBridge and AWS API Gateway. The External Adapter used by Basket-Bets is a highly advanced EA called “EasyAdapter”, that has been further enhanced with support for “ID Supervisor” queries, and also operates as AWS lambda functions. EasyAdapter can be found in the orzdk\node-exiguous repo in a local version that will run on node.js. ID Supervisor is a subsystem of Basket-Bets that maintains a database of true-identities (id’s) of fixtures and teams across heterogenous APIs in order to merge and validate data to obtain trustless data feeds for settlement of bets in the system.

Challenges we ran into

As with any full stack DAPP system, the biggest challenge is crafting the data structures in Solidity in such a way that they are effective in receiving, gathering, calculating, and displaying the information that drives the frontend as well as the contract logic itself, while not guzzling up 10 trillion billion gas doing it. Probably the absolutely most important mantra for any EVM development. As follows indirectly from the above, meeting such challenges is a matter of gently balancing mappings, index mappings, arrays, and hints, all while ensuring maintenance of both referential integrity and operational security, which can be challenging. Things tend to end up in a mess if a strict storage design patterns are not followed from the get-go. As for the application logic in itself, I had a good deal of challenges crafting the LP stake mechanism which is still very crude. Solidity only know of integers, which does not make floating point operations on odds-fraction numerals any easier.

Accomplishments that we're proud of

I am generally happy with the individual parts, - DAPP, Contract and AWS Backbone, and while none of these may stand out as truly exceptional in their own right, I am very satisfied that I was able to prioritize and keep everything tied together and functional along the way, and happy that my submission to the hackathon is a fully running system primed for developing a more mature product. I also like the betting portal-as-a-service white-label idea, though its general viability should be up to others to evaluate.

What I learned

160++ hours of Solidity, React, Javascript, AWS and Gambling formula know-how.
Being a one man team is rough, will do a team project next time. 12 hours a day for a full month in front of a screen eating junk is not healthy for neither body nor soul.

What's next for BasketBets

Mainnet Refinement of LP stake mechanics. ID Supervisor Database moved to IPFS and Oraclized. Take bets, earn fees, sell and run branded sports betting websites for fun and profit. Enabling 1X2 bets AWS Code signing Audit

Share this project:

Updates