GitGuild

Prediction markets for GitHub pull requests: stake ETH on whether a PR merges, built with Solidity contracts on Sepolia and a Next.js frontend.

BlockTrain

🎓 Devfolio

📌 Bangalore, Karnataka > New Delhi, Delhi

🚀 36 hours Hackathon Project

What it is

GitGuild lets people bet on whether a GitHub pull request (PR) gets merged. Users stake ETH on a YES or NO outcome. When the PR resolves, the winning side shares the pool. The repository calls the project BlockSmiths.

The app has two parts: Solidity contracts that hold the money and rules, and a Next.js frontend that reads live PR data from GitHub.

The problem

Open source contributors often cannot tell whether a PR will merge. Maintainers have long review queues and no signal for which PRs matter most. The project tests whether a market price can serve as that signal, and whether payouts can reward people who judge PRs well.

How it works

The repository is an npm workspace with two packages: blockchain/ (Hardhat) and frontend/ (Next.js).

Contracts

The blockchain/contracts/ directory holds three contracts.

ContractRole
ProjectCoinFactory.solDeploys one ERC-20 token per GitHub repository. Costs a 0.01 ETH creation fee and keeps a registry keyed by owner and repo.
ProjectCoin.solThe per-repository token. Minting follows a linear bonding curve: the price starts at 0.001 ETH per 1,000 tokens and rises by 0.0001 ETH per batch. Supply is capped at 10 million.
PredictionMarket.solA standalone YES/NO market for one PR, identified by the hash of the repository name and PR number.

A bonding curve is a rule that sets a token's price as a function of its supply. ProjectCoin splits each mint payment into four shares: 30% treasury, 40% reward pool, 10% project creator, and 20% buyback. The CREATOR-REWARDS.md file in the repo documents this split.

PredictionMarket works as a pool:

  1. The owner account creates a market for a repository and PR number.
  2. Users call takeYesPosition or takeNoPosition with ETH. The contract keeps 5% as a platform fee and records the rest as tokens (1,000 per ETH) on that side.
  3. The owner calls resolveMarket with the outcome.
  4. Holders of the winning side call claimWinnings and receive a share of the whole pool, proportional to their tokens on that side.

Frontend

The frontend lives in frontend/src/ and uses the Next.js App Router. The wagmi command-line tool generates typed contract bindings into src/lib/wagmi-generated.ts from the compiled contracts.

  • app/(app)/dashboard/ has five tabs: overview, token trading, prediction markets, market management, and analytics.
  • hooks/api/useGitHubAPI.ts fetches repositories and PRs from the GitHub REST API.
  • hooks/web3/useProjectCoin.ts wraps the factory and token contracts.
  • lib/prStatusService.ts checks whether a PR is open, merged, or closed.
  • components/prediction-market.tsx sends the YES, NO, resolve, and claim transactions.

What I built

I built the prediction-market contracts, the GitHub pull request integration, and the trading and portfolio dashboard. A teammate (pradyut-das) added the deployment and Hardhat configuration, adjusted the market card and one hook, and wrote documentation.

Design decisions

Pooled payouts instead of priced shares. PredictionMarket pays winners from a shared pool in proportion to their stake. It needs no market maker or liquidity provider and has little code to audit. The cost is that a position has no price before resolution, so the market gives no live probability. If nobody backed the winning side, no one can claim, and only the owner's emergencyWithdraw moves the funds.

Owner-resolved outcomes. A contract cannot read GitHub, so the owner account passes the result to resolveMarket. This avoids building an oracle, which is a service that brings off-chain data on-chain. The trade-off is that users must trust the owner. The repo does not include an automated resolver, although prStatusService.ts shows the PR check the frontend uses.

Factory-first market discovery. Comments in useIntegratedMarkets.ts describe an earlier approach that listed popular repositories first and matched them to tokens. It showed markets nobody could trade and spent GitHub API calls on them. The current hook starts from repositories registered in the factory and fetches PRs only for those.

A token layer plus a market layer. The commit history shows the bonding-curve token contracts came first (21 September 2025). The YES/NO market arrived in the last commit batch (23 September). CREATOR-REWARDS.md lists YES/NO mechanics as a requested next step. The two contracts do not call each other, so the final app has two separate ways to take a position.

Challenges I ran into

These notes are mine.

Contract economics. Designing a sustainable bonding curve was the hardest part. I settled on a linear price rise with a multi-way fee split. Minting in batches reduced gas costs.

GitHub API rate limits. The API allows 5,000 requests per hour for authenticated callers. The frontend accepts a personal access token through an environment variable to stay within that limit.

Web3 user experience. Blockchain concepts are unfamiliar to many developers. I tried to reveal wallet details step by step and to show clear error messages.

Run it locally

You need Node.js and npm, a wallet such as MetaMask, and Sepolia test ETH.

  1. Clone the repository and install dependencies from the root.

    git clone https://github.com/WhyAsh5114/blocksmiths
    cd blocksmiths
    npm install
    
  2. Compile the contracts and generate the typed bindings.

    npm run generate-types
    
  3. Run the contract tests.

    npm test
    
  4. Create frontend/.env.local. Use the addresses from blockchain/deployments/sepolia-deployment.json, or your own deployment.

    NEXT_PUBLIC_GITHUB_TOKEN=your_github_token
    NEXT_PUBLIC_FACTORY_ADDRESS=0x...
    NEXT_PUBLIC_PREDICTION_MARKET_ADDRESS=0x...
    
  5. Start the frontend and open http://localhost:3000.

    npm run dev
    

The frontend's wagmi config lists only Ethereum mainnet and Sepolia, so a local Hardhat node needs a config change first.

Reference

AreaChoiceUsed for
ContractsSolidity 0.8.28, OpenZeppelin 5ERC-20 token, Ownable, ReentrancyGuard
Contract toolingHardhat 2, Ignition, viem toolboxCompile, test, deploy
NetworkEthereum Sepolia testnetDeployment (23 September 2025)
FrontendNext.js 15, React 19, TypeScriptApp Router UI
Web3 clientwagmi, viemWallet connection and contract calls
DataTanStack Query, GitHub REST APIPR and repository data
UITailwind CSS, Radix UI, RechartsStyling, components, charts

The Hardhat tests cover ProjectCoin and ProjectCoinFactory. PredictionMarket has a script, blockchain/scripts/test-prediction-market.ts, instead of a test file.

Outcome

I built GitGuild with a team of three at BlockTrain, a 36-hour Devfolio hackathon on a train from Bengaluru to New Delhi that began on 20 September 2025. The hackathon page records no placement.

The repo's first commit is on 20 September 2025 and its last on 23 September 2025. The contracts are deployed on Sepolia. The leaderboard component still shows an empty state, so some of the planned social features are not built.

Liked GitGuild? Here's my background.

Full-stack TypeScript, shipped to real users.