project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

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.

Bonsai

Created At

ETHGlobal Singapore

Winner of

Pyth Network - Most Innovative use of Pyth Pull Oracle (Price Feeds)

Project Description

Key Features

  1. Exact 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.
  2. 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 Functionality

  1. User Staking:
    • Users can stake variable amounts of USDC on price predictions
    • Minimum stake: 10 USDC, Maximum stake: 1,000 USDC
    • Each 10 USDC represents one "ticket" in the prediction pool
  2. Price Prediction Mechanism:
    • Users predict prices for specific assets at future timestamps and price points
    • Each 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 slot
  3. Winning 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.
  4. 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.
  5. Engagement Mechanisms (Future):
    • The reserve pool will be used for engagement mechanisms:
      • Dynamic reward multipliers for low-participation periods
      • Cumulative jackpot for consecutive low-participation rounds
      • Streak bonuses for consistent participation

Example Scenarios

  1. Exact Match Winner
    • Alice stakes 500 USDC (50 tickets) on BTC at $50,000
    • Total pool: 10,000 USDC (1000 tickets)
    • BTC settles at $50,000
    • Alice wins 50% of pool: 5,000 USDC
    • Alice's profit: 4,500 USDC
  2. Proximity Winner
    • Bob stakes 1,000 USDC (100 tickets) on ETH at $2,500
    • Total pool: 20,000 USDC (2000 tickets)
    • ETH settles at $2,502
    • Bob wins share of 25% proximity pool: 5,000 USDC
    • Bob's profit: 4,000 USDC
  3. Fortune Winner
    • Carol stakes 10 USDC (1 ticket) on ADA at $0.45
    • Total pool: 30,000 USDC (3000 tickets)
    • ADA settles at $0.37
    • 100 tickets win lottery (10% of pool)
    • Carol's share: 3,000 * 1 / 100 = 30 USDC
    • Carol's profit: 20 USDC

How it's Made

Frontend

  1. Wallet connection relies of Dynamic.
  2. NextJS + Tailwind CSS for frontend development
  3. Viem + Wagmi is used for blockchain + smart contract interaction
  4. Graphql client is used for fetching data from subgraph

Smart contract

  1. Hardhat + ether js for smart contract development and testing
  2. Chainlink VRF is used for random number generation. This is mainly for lottery (fortune) prize distribution
  3. Pyth price feed is used as price data reference

Data Indexing

  1. Subgraph and the graph studio is used for implementing on-chain data indexing
background image mobile

Join the mailing list

Get the latest news and updates