Inspiration

Have fun onchain! Super Bowl boxes (aka Super Bowl Squares) are played in offices, bars, and other communities but they are typically constrained to pen & paper. We are using the power of Chainlink Functions and Chainlink VRF to make Super Bowl boxes a fun onchain activity.

What it does

Contest creators pick an NFL game to base their contest on (it can be any NFL game, not just the Super Bowl!). Players claim boxes at random on a 10x10 grid. Once all boxes are claimed, VRF assigns a pair of random numbers (0 - 9) to each box.

According to the rules of Super Bowl Boxes, these numbers correspond to the last digit of the Away and Home Team's scores, respectively. For example, if my box was assigned 3 & 7, I would be a winner if one of the quarters ended with a score of Away: 3, Home 7. I would also win if the score was 23 - 17 because all that matters is the last digit of the scores.

Users can kick-off a Chainlink Function that reaches out to ESPN's free sports API and writes the last digit of the scores onchain. Once scores are onchain, winning boxes can claim their prize.

How we built it

There is a solidity smart contract that uses Chainlink VRF for assigning random scores to boxes and Chainlink Functions for fetching real-world sports data. The front end is a Next.js application with Thirdweb's SDK for authentication (including Social Login) and connecting to the blockchain.

Challenges we ran into

Finding gas-efficient ways to store the real-world sports data onchain after fetching them with Chainlink Functions was a blast. Ultimately, each digit is a packed each digit as bytes and then turn them into uint8's to be stored in the contract. Since multiple contests might rely on the data of the same game, we allow this data to be shared across contests.

Accomplishments that we're proud of

I blasted my twitter network to help test for me and we were able to sell out 2 games with some notable crypto builders such as Jesse Pollak from Coinbase's Base L2 team! https://x.com/mykcryptodev/status/1726772161447121359

Testers were airdropped a commemorative NFT for their efforts https://x.com/mykcryptodev/status/1731412556898783486?s=20

What we learned

Functions opens up a whole new world of possibilites for onchain apps.

What's next for Onchain Boxes

We will be polishing the dapp in preparation for this year's Super Bowl in February. We will be using the product feedback we received from the test users to make it the go-to onchain experience for Super Bowl boxes this year!

Built With

Share this project:

Updates