YieldWars

On-chain prediction battles using Pyth price feeds & Entropy randomness

YieldWars

Created At

ETHOnline 2025

Project Description

This project is a fully on-chain prediction game powered by Pyth price feeds and Entropy randomness. Players can predict whether a crypto asset’s price will go up or down within the next few minutes. After a fixed countdown, the prediction is resolved on-chain using verifiable Pyth price data.

The core idea is to create a fair, verifiable, and automated prediction system — no off-chain trust or manipulation. The backend orchestrates the flow: when a player submits a prediction, a Node.js server schedules a countdown, then calls the smart contract’s resolvePrediction function using the Pyth data update and pays gas fees using the owner wallet.

The frontend uses Pyth Hermes to fetch live prices and visualize graphs in real-time while the Solidity contract interacts with the Pyth SDK to fetch verified prices on-chain. The Entropy SDK adds provable randomness via commit-reveal between the user and provider, making future multiplayer or random-number-based modes provably fair.

How it's Made

The system has three main parts:

Frontend (Next.js + Pyth Hermes): Fetches live price feeds via Pyth’s Hermes API to show graphs and let players create predictions using current market data.

Smart Contract (Solidity + Pyth + Entropy): Deployed on Sepolia. It consumes Pyth’s on-chain price updates (via updatePriceFeeds and getPrice()) and integrates with Entropy for randomness in future multiplayer versions. Ownership logic ensures the contract owner manages rewards and fee pools securely.

Backend (Node.js Server): Handles automation and gas payments. When a user submits a prediction, it triggers a countdown timer. After time expires, the server fetches updated Pyth price data from Hermes, sends it to the contract to update on-chain prices, and executes resolution logic using the owner’s key to pay for gas.

This design keeps the frontend fast, the backend autonomous, and the on-chain layer fully verifiable.

background image mobile

Join the mailing list

Get the latest news and updates