Chomp, a gamified social consensus platform that gets you best-in-class insights.
For the user, it's a fast-play quiz, polling or trivia game that gets you the most likely answers to a question. Under the hood, we implement a set of social consensus mechanisms adapted from empirical research around the wisdom of the crowd problem. Through first giving your own answer, and then your perception of others’ answer to the same question, we can obtain the true state of the world, even when most players of the game do not know what that true state is.
Chomp is the first mini-game product created by Gator Labs. We intend to build out more gamified applications that feed into Gator's underlying reputation graph and data layer, which would be composable with businesses looking to build with a reputation graph or highly accurate information that benefits their end users.
- Live Demo
- Frame API
- Frame Demo (Warpcast login required)
- Frame Code
Prerequisites:
- Install Docker
- Create a Dynamic account
- Solana RPC like Helius
# install dependencies
$ yarn
# setup environment variables
$ cp .env.example .env.local
# start DB
$ yarn compose:db:up
# run migrations
$ yarn prisma:migrate
# start the app
$ yarn dev
Chomp takes your responses of the 1st Order Question (your response to the statement/question), and the 2nd Order Question (your perceived sentiment of how others would respond to the statement/question), and puts them through Gator's novel mechanism that infer the most likely right answer of the question.
Chomp's mechanism is driven by empirical research around the "Wisdom of the Crowd" problem. We are adapting this mechanism for several question formats and rolling them out gradually on Chomp
The components of Chomp include:
- Next JS dapp frontend
- Dynamic Wallet for auth and signing
- Integrated with SPL for token transfers and burning
- Farcaster Frame built with Frog.fm
Chomp is two sided, including people who ask questions and people who answer questions. Question askers are often representing a company that wants to engage the public with their brand. Question answerers are often regular people with some amount of knowledge.
- Question asker deposits capital to fund engagement rewards
- Question asker asks questions
- Question answerer answers one or more questions
- At some point in the future, the question answer can be revealed after burning $BONK
- User rewarded if they got the answer correct
This is the code used in the "Suprisingly Popular" algorithm underlying our current prediction algorithm:
def get_SP_answer_binary(first_order_percent_A, first_order_percent_B, second_order_percent_A, second_order_percent_B):
a = first_order_percent_A - second_order_percent_A
b = first_order_percent_B - second_order_percent_B
if a > b:
answer = 'A'
elif b > a:
answer = 'B'
else:
answer = 'Tie'
return answer
We are in the process of adapting another set of "Wisdom of the Crowd" mechanisms for multiple-choice questions.
We will be doing a closed alpha in Dubai next week with FOMO Mag + MonkeDAO, and then an open beta through DRiP in mid-May. Q2+Q3 are all about experimentation and validation, where we will aim to understand our users better, hone in on a few use cases, improve product features, and gather enough data to improve on our mechanism and tokenomics design.
On the technical front:
- Finish off the UI for the dapp.
- The BONK transfer and burn values are currently hardcoded and not tied to the database.
- Add multi-token support.
- Implement more complex scoring mechanisms from Wisdom of the Crowd.
SPL token interaction is thoroughly tested for transfer and burn correctness. Bankrun is used for testing on-chain transactions. See __tests__
for code.
# Setup test environment
cp .env.example .env.test
# Run tests
yarn test
- Browse open questions
- Select a question and submit first order answer
- Select a question and submit second order answer
- Reveal to start Bonk burn
- Burn bonk to reveal
Demo environment is used for testing flow of application in easy and repeatable way so users can see how app works before using production version. Only feature that differentiates demo from production environment is Reset data button in Profile section that allows user to reset all changes made to demo profile like answers to questions, question reveals and claims.
Data in demo environment is composed of 3 questions in daily deck that user can answer when they open app and 3 answered questions that user is able to reveal from home or history page. Daily deck can be set up from admin dashboard in the same way as on production app and small change is made to the backend to disable that daily deck expiring on demo environment.
For setting up answered questions, the process is a bit more difficult. We first
need to add records in Question
and QuestionOption
tables that contain
question and option data (note that reveal date has to be in past so users can
reveal those question immediately). After that, pre made user's answer records
need to be added to QuestionAnswer
table. Note that all demo answer records
can be set to dummy account, in this case I've set up user with id app
in
User
table that owns all of the answers.
Demo environment is accessible on app-demo.chomp.games.
- Enable workflow migrations in
.github/workflows/migrations.yml
- Create DB in Vercel Storage
- Add
DATABASE_PRISMA_URL_{ENVIRONMENT}
andDATABASE_URL_NON_POOLING_{ENVIRONMENT}
to Github
To restore the database from the backup file, follow the below steps:
- Add a backup file in the scripts folder
- Rename it to
backup.sql.gz
- Make sure that DATABASE_URL env is set to the target database for restoration
- Verify that the DATABASE_URL is clean, without extra parameters (e.g., it should look like postgresql://postgres:postgres@localhost:5432/chomp-db). Please remove
?schema=public
too.
Run the following command
yarn dev:restore-db
If you see a “restore successful” message, you can safely ignore some errors. After verifying the restored database, don’t forget to remove the backup file.