Inspiration

To build something fun for the crypto community while learning smart contract integration with Chainlink. I wanted something unexpected to truly show how Chainlink enables any sort of real world data into Smart Contracts, and how blockchain really enables trustless applications. You could place a bet with any player (friend or not) and for any amount, knowing that bet will be settled in a fair and risk free way. During Covid-19 lockdown all my spare time went to learning blockchain technology, Ethereum development, and also playing COD =), so as a first ever full dApp development...it kind of made sense!

What it does

It allows players to place bets against each other (challenges) in a Smart Contract, prior to playing a CoD MW multiplayer match. The only requirement is that both players are present on the same match, even if they are on the same team. Whoever scores more (based on metrics such as kills, k/d ratio) wins the bet, and the Dapp pays the winner the bet amount without further interaction with the Dapp or Contract.

How we built it

We used Scaffold-eth as a boilerplate which is a great tool to learn and try different things. Then using the Activision API, we fetch the match information using Chainlink to settle the bets. We built an External Adapter based on the NodeJS template from the docs, and hosted it in our own Chainlink Node. Everything is deployed on Kovan Testnet. We also have a back-end service (we call it the match collector) that queries the API in order to find the first match that both players in a bet participate in, and after finding it, it calls a function on the contract to settle the bet through the Chainlink Oracle.

Challenges we ran into

The Chainlink documentation is awesome! Everything is clear and accessible, there are tons of videos and articles and also people on the Discord server showing real support. I guess the main challenge was deciding between the match collector feature or simply notifying the winner on the Dapp front-end to claim the bet. Maybe there's a third approach in which we could move all the API logic to the external adapter. What I couldn't anticipate was that Kovan is apparently not yet supported in ENS: that's a shame for the live demo.

Accomplishments that we're proud of

  • Building a real dApp that users can find fun and useful
  • Having a live demo working on time, hosted on IPFS
  • Building an external adapter!
  • Hosting a Chainlink node on Kovan!
  • Learning a lot of new skills :)

What we learned

  • Scaffold-eth is a great resource!
  • Hardhat and Ethers.js are great tools
  • Chainlink is a well documented project and the community is great!
  • How to use GCP tools, Cloud Functions, Cron.jobs, VMs, DBs
  • How to setup and tweak a Chainlink Node, create Jobs, do testing and monitoring.
  • How to integrate with the Chainlink contracts, make requests, and build external adapters

What's next for Cod Bets!

We hope to get some feedback from judges and other teams, the dApp needs more iterations on both ends, and there are several features already in mind:

  • Support for Warzone matches
  • Support for ERC20 bets
  • Multi-party bets
  • Mainnet deployment

Built With

Share this project:

Updates