Bonsai
Bonsai is a blockchain-based price prediction platform that allows users to stake cryptocurrency on future price points of various assets. The platform aims to create an engaging, fair, and rewarding environment for price prediction enthusiasts and market analysts.
Screenshots






Problem Statement
Key FeaturesExact price prediction: the prediction in this platform is not just up or down. But users must specify exact price of assets in any specific time slot. The high performing price predictors are incentives by the majority portion of the prize pool. Yet general users can also enjoy lottery rewards in the same pool.Prediction oracle: in the long run, this platform accumulate human exact price prediction accuracy and serves as a predicted price oracle to other platforms. The price high performing price predictors receive additional incentives from data oracle consumption. They will be paid every time their prediction feed is called.Core FunctionalityUser Staking:Users can stake variable amounts of USDC on price predictionsMinimum stake: 10 USDC, Maximum stake: 1,000 USDCEach 10 USDC represents one "ticket" in the prediction poolPrice Prediction Mechanism:Users predict prices for specific assets at future timestamps and price pointsEach price point contains 100 tickets (10 USDC per ticket)When 100 tickets at each price point (at each time slot) are sold out, users can no longer stake in that specific time and price slotWinning Conditions:When the time is met, anyone can call a settlement function to trigger Pyth price oracle check to validate the result.The first winner is the users holding tickets with exact matched specific price. 50% pool reward is distributed to the winner tickets.Proximity winners are tickets in 0.1% boundaries of the correct price. 25% pool reward is distributed among these ticket holders.Fortune winners are tickets with luck (calculation below). These ticket holders get 10% of the pool.The remaining 15% is transferred to reserve (10%) for future campaigns, and 5% as platform fee.If there is no winner in any pool, the reward is transferred to reserve pool for future distribution.Leaderboard:The smart contract accumulates price prediction result per wallet overtime. Each wallet will be stamped with % accuracy.Each user accumulates their accuracy in the long run (calculation below).Ranking mechanism takes both accuracy and prediction counts into account.Engagement Mechanisms (Future):The reserve pool will be used for engagement mechanisms:Dynamic reward multipliers for low-participation periodsCumulative jackpot for consecutive low-participation roundsStreak bonuses for consistent participationExample ScenariosExact Match WinnerAlice stakes 500 USDC (50 tickets) on BTC at $50,000Total pool: 10,000 USDC (1000 tickets)BTC settles at $50,000Alice wins 50% of pool: 5,000 USDCAlice's profit: 4,500 USDCProximity WinnerBob stakes 1,000 USDC (100 tickets) on ETH at $2,500Total pool: 20,000 USDC (2000 tickets)ETH settles at $2,502Bob wins share of 25% proximity pool: 5,000 USDCBob's profit: 4,000 USDCFortune WinnerCarol stakes 10 USDC (1 ticket) on ADA at $0.45Total pool: 30,000 USDC (3000 tickets)ADA settles at $0.37100 tickets win lottery (10% of pool)Carol's share: 3,000 * 1 / 100 = 30 USDCCarol's profit: 20 USDC
Solution
FrontendWallet connection relies of Dynamic.NextJS + Tailwind CSS for frontend developmentViem + Wagmi is used for blockchain + smart contract interactionGraphql client is used for fetching data from subgraphSmart contractHardhat + ether js for smart contract development and testingChainlink VRF is used for random number generation. This is mainly for lottery (fortune) prize distributionPyth price feed is used as price data referenceData IndexingSubgraph and the graph studio is used for implementing on-chain data indexing
Hackathon
ETHGlobal Singapore
2024
Prizes
- 🏆
Most Innovative use of Pyth Pull Oracle (Price Feeds)
Pyth Network