Skip to content

denchik37/TorchHackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฅ Torch

A decentralized, AI-powered prediction market protocol for crypto price discovery, built on Hedera

License Issues Pull Requests Deploy


๐Ÿ“š Table of Contents


๐ŸŒ What Is Torch?

Torch is a decentralized prediction system for high-resolution, real-time crypto price forecasting.

Unlike conventional markets focused on binary outcomes (like Polymarket), Torch allows users to predict price ranges across future timepoints, creating a dynamic priceโ€“time probability surface.

Torch blends AI agents and human traders in an InfoFi-aligned ecosystem, rewarding early, sharp, and high-conviction predictions.

๐Ÿ’Ž Value Proposition

Problem Torchโ€™s Solution
โŒ Crypto traders lack continuous, high-resolution price forecasts โœ… Torch builds a real-time priceโ€“time signal
โŒ Existing markets (e.g. Polymarket) are binary or categorical โœ… Torch enables continuous predictions on a full probability surface
โŒ Fragmented market signals and incentives โœ… Torch aligns humans and AI agents via economic incentives


Hackathon Scope

Weโ€™re building a working Torch prototype as part of a hackathon.

  • โœ… Core smart contracts for prediction lifecycle and payout logic
  • โœ… Graph subgraph indexing for event querying
  • โœ… Wallet authenticated frontend
  • โœ… Realistic price resolution and reward distribution

๐Ÿ“„ Functional & Contract Specs

Google Doc

๐ŸŽจ Design & Frontend Specs

Google Doc

โš ๏ธ Work in progress


๐Ÿงฑ Monorepo Structure

torchpredictionmarket/
โ”œโ”€โ”€ frontend/          # React Frontend
โ”œโ”€โ”€ smartContracts/    # Hedera-compatible Solidity contracts
โ”œโ”€โ”€ torch-subgraph/    # Subgraph indexing smart contract events
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md          

๐Ÿ“ Projects Overview

Project Description
frontend/ React frontend with wallet connect, core integration of Smart Contract & Subgraph, prediction UI
smartContracts/ Core Solidity smart contracts for placing, resolving, and claiming predictions
torch-subgraph/ Graph protocol subgraph for indexing BetPlaced, BetFinalized, and BetClaimed events

๐Ÿ’ป Tech Stack

Primary Development Framework: Hardhat

  • Hardhat - EVM development environment and testing framework
  • Javascript - Scripts to test smart contracts.
  • Solidity - Smart contract programming language (version ^0.8.0)

Secondary Development Framework: Foundry

  • Foundry - Alternative EVM development toolkit (Rust-based)
  • Forge - Foundry's testing and deployment tool
  • Cast - Foundry's command-line tool for interacting with smart contracts

Blockchain Network: Hedera

  • Hedera Hashgraph - The target blockchain network
  • Hedera JSON-RPC Relay - For interacting with Hedera network
  • Hedera Local Node - For local development and testing
  • HashScan for Transaction Monitoring - Track your smart contract deployments and interactions
  • HashScan for Transaction History - Users can view their betting history and results

Frontend:

  • React.js & Next.js - frontend frameworks for building user interfaces and server-side rendering
  • TypeScript - for typed JavaScript development, improving code quality and maintainability
  • GraphQL Apollo Client - to fetch queries and manage data state in the frontend
  • CoinGecko API - to retrieve real-time cryptocurrency market data and price feeds
  • Clerk - authentication and user management for admin access

Backend:

  • GraphQL/Protocol** - for indexing smart contract data & building Subgraphs.
  • Graph Node** - running on a VPS, to index Hedera network smart contract events.

Data Storage & Querying:

  • PostgreSQL - database for graph-nodeโ€™s indexing data.
  • IPFS - decentralized storage used by the graph for metadata and manifests.

Development/Tools:

  • Typescript & AssemblyScript
  • Node.js
  • Docker / Docker Compose

Version Control & Deployment:

  • Github
  • Hetzner VPS
  • Vercel

Hosting

  • Vercel {frontend} -Hetzner VPS {Subgraph Local Node}

๐Ÿ“š How It Works: TorchPredictionMarket Step-by-Step

Example: Alice, Bob, and Charlie Predict HBARโ€™s Price for Tomorrow

๐Ÿงพ Step 1: Place Bets
User Predicted Range USD Range Bet Sharpness Expected
Alice 2900โ€“3100 BPS $0.29โ€“0.31 10 HBAR Tight โœ… Win
Bob 2700โ€“3300 BPS $0.27โ€“0.33 10 HBAR Wide โœ… Win
Charlie 3500โ€“4000 BPS $0.35โ€“0.40 10 HBAR Off-target โŒ Lose
๐Ÿงฎ Step 2: Weighting Bets Based on Precision
User Width BPS Sharpness Multiplier Net Stake Weight
Alice 200 0.5x 9.95 HBAR 4.975
Bob 600 0.3x 9.95 HBAR 2.985
Charlie 500 0.5x 9.95 HBAR 4.975
๐Ÿ”ฎ Step 3: Oracle Resolves Actual Price
setPriceForTimestamp(targetTimestamp, 3000);
โœ… Step 4: Contract Processes Results
processBatch(targetTimestamp);
๐Ÿ† Step 5 โ€“ Winnings
User Weight Result Winnings
Alice 4.975 โœ… Win 18.66 HBAR
Bob 2.985 โœ… Win 11.19 HBAR
Charlie 4.975 โŒ Lose 0 HBAR


๐Ÿ›  Installation

๐Ÿ” Setup Environment

git clone https://github.com/denchik37/TorchOriginsHackathon
cd TorchOriginsHackathon

๐Ÿ“ฆ Install Dependencies (per folder)

cd smartContracts && npm install
cd torch-subgraph && npm install
cd frontend && npm install

๐Ÿค Team

Name Role Contact / Profile
Denis Igin PM, Marketing GitHub
Balut Catalin-Mihai Smart Contract Developer Github
Sebastien Guibert Blockchain Data Integration/Architect Github
Sebastian Balaj Frontend Developer Github
Mohammad Hatif Osmani Frontend Developer Github

๐Ÿ”— Resources

Resource URL
๐ŸŒ Web https://torch.bet
๐Ÿ“„ Litepaper https://torch-1.gitbook.io/litepaper
โœ๏ธ Blog https://medium.com/torch-token-price-forecasting
๐Ÿฆ X (Twitter) https://x.com/torchbet