BlockSmiths ๐โ๏ธ
Decentralized Prediction Markets for GitHub Pull Requests
BlockSmiths revolutionizes developer collaboration by creating prediction markets for GitHub pull request outcomes. Trade tokens representing the probability of PR merges, backed by real GitHub data and powered by bonding curve economics.
๐ Project Overview
BlockSmiths bridges Web2 development workflows with Web3 economics, enabling developers and stakeholders to:
- Create prediction markets for any GitHub repository's pull requests
- Trade tokens representing PR merge probabilities using bonding curve pricing
- Earn rewards when predictions are correct and PRs resolve
- Incentivize quality contributions through market-driven feedback
๐ฏ Core Concept
The Problem
- Uncertainty in PR outcomes: Contributors and maintainers lack clear signals about which PRs will merge
- Limited incentives for code review: Quality reviewing is undervalued and unrewarded
- Difficulty prioritizing PRs: Maintainers struggle to identify high-impact contributions
The Solution
- Market-driven predictions: Let the crowd wisdom determine PR merge probabilities
- Economic incentives: Reward accurate predictions and quality contributions
- Real-time feedback: Provide immediate market signals for PR quality and likelihood
๐ ๏ธ How It Works
1. Token Creation (Lazy Minting)
GitHub Repo โ Factory Contract โ ProjectCoin Token
- Anyone can create a
ProjectCoin
for any GitHub repository (0.01 ETH fee) - Tokens represent prediction markets for that repo's PRs
- Factory manages all project tokens and provides discovery
2. Bonding Curve Economics
Early Buyers: 0.001 ETH โ 1000 tokens
Later Buyers: 0.002 ETH โ 1000 tokens (price increases)
- Dynamic pricing: Token prices increase with demand via bonding curves
- Early adopter advantage: First buyers get better prices
- Market efficiency: Prices reflect collective sentiment
3. Fee Distribution
Every token purchase splits fees:
- 30% โ Treasury: Platform development and maintenance
- 50% โ Reward Pool: Distributed when PRs resolve
- 20% โ Buyback Fund: Token burns to manage supply
4. PR Resolution & Rewards
PR Merges โ Reward Pool โ Token Holders
PR Rejects โ Buyback & Burn โ Deflationary pressure
- Merge rewards: Successful predictions earn from the reward pool
- Burn mechanism: Failed predictions result in token burns
- Market resolution: Automated via GitHub API integration
๐๏ธ Architecture
Smart Contracts (Blockchain Layer)
ProjectCoinFactory.sol
: Creates and manages project tokensProjectCoin.sol
: ERC20 tokens with bonding curve mechanics- Hardhat setup: Testing, deployment, and verification tools
Frontend (User Interface)
- Next.js application: Modern React-based interface
- Web3 integration: Wagmi + MetaMask for blockchain interactions
- GitHub API: Real-time PR data and metadata
- Responsive design: Mobile-first, accessible UI
Key Features
- Real-time market discovery: Search and explore active prediction markets
- Integrated trading interface: Buy/sell tokens directly from PR pages
- Portfolio tracking: Monitor your positions and performance
- Live GitHub data: Authentic PR information and status updates
๐ Market Mechanics
Token Pricing Model
// Bonding curve formula
nextPrice = currentPrice + priceIncrement
// Where priceIncrement = 0.0001 ETH per batch
Market Resolution
if (PR.status === 'merged') {
distributeRewards(rewardPool, tokenHolders);
} else {
burnTokens(buybackPool);
}
Probability Calculation
probability = calculateFromMetrics({
comments: PR.comments,
reviews: PR.reviews,
labels: PR.labels,
age: PR.createdAt,
authorReputation: contributor.reputation
});
๐ฎ User Experience
For Developers
- Create markets for your repositories to gauge community sentiment
- Trade on PRs you believe will merge based on code quality
- Earn rewards for accurate predictions and quality contributions
For Maintainers
- Discover high-quality PRs through market signals
- Prioritize reviews based on community confidence
- Incentivize contributors through prediction market participation
For Investors
- Speculate on development outcomes using domain expertise
- Support promising projects through token purchases
- Earn returns from successful prediction strategies
๐ก๏ธ Risk Management
Smart Contract Security
- Reentrancy protection: ReentrancyGuard on critical functions
- Access controls: Ownable patterns for admin functions
- Overflow protection: SafeMath and Solidity 0.8+ built-ins
Economic Safeguards
- Supply caps: Maximum token supply prevents infinite inflation
- Fee mechanisms: Multiple revenue streams ensure sustainability
- Burn mechanics: Deflationary pressure maintains token value
๐ Getting Started
Quick Start
# Clone the repository
git clone https://github.com/WhyAsh5114/blocksmiths
cd blocksmiths
# Install dependencies
npm install
cd blockchain && npm install
cd ../frontend && npm install
# Set up environment
cp frontend/.env.example frontend/.env.local
# Add your GitHub token and contract addresses
# Start development
npm run dev
Prerequisites
- Node.js 18+ and npm
- MetaMask wallet with Sepolia ETH
- GitHub personal access token
- Hardhat for contract development (optional)
๐๏ธ Project Structure
blocksmiths/
โโโ blockchain/ # Smart contracts and deployment
โ โโโ contracts/ # Solidity contracts
โ โโโ test/ # Contract tests
โ โโโ scripts/ # Deployment scripts
โ โโโ hardhat.config.ts
โโโ frontend/ # Next.js application
โ โโโ src/
โ โ โโโ app/ # App router pages
โ โ โโโ components/ # Reusable UI components
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ lib/ # Utilities and configurations
โ โโโ package.json
โโโ README.md # This file
โโโ package.json # Root dependencies
๐ฏ Roadmap
Phase 1: MVP (Current)
- โ Core smart contracts (ProjectCoin + Factory)
- โ Basic frontend with wallet integration
- โ GitHub API integration for PR data
- ๐ Sepolia testnet deployment
Phase 2: Enhanced Markets
- ๐ฎ Advanced probability algorithms
- ๐ฎ Multi-outcome predictions (merge time, review count)
- ๐ฎ Automated market makers (AMM) integration
- ๐ฎ Cross-repository prediction baskets
Phase 3: Community Features
- ๐ฎ Reputation systems for predictors
- ๐ฎ Social features (following, leaderboards)
- ๐ฎ DAO governance for platform decisions
- ๐ฎ Integration with development tools
Phase 4: Enterprise
- ๐ฎ Private repository support
- ๐ฎ Enterprise dashboard and analytics
- ๐ฎ API for third-party integrations
- ๐ฎ Mainnet deployment and scaling
๐ค Contributing
We welcome contributions! Please see our contributing guidelines:
- Fork the repository and create a feature branch
- Write tests for new functionality
- Follow code style guidelines (Prettier + ESLint)
- Submit a pull request with clear description
Development Setup
# Run tests
cd blockchain && npm test
cd frontend && npm test
# Lint and format
npm run lint
npm run format
# Local blockchain
cd blockchain && npx hardhat node
๐ License
MIT License - see LICENSE for details.
๐ Links
- Live Demo: [Coming Soon]
- Documentation: Wiki
- Discord: Community
- Twitter: @BlockSmiths
๐ฏ The Problem It Solves
Open source development lacks market signals for PR quality and merge probability.
Current Pain Points
- Contributors: Waste time on PRs unlikely to merge, no feedback on quality
- Maintainers: Can't prioritize valuable PRs, overwhelmed by review queue
- Ecosystem: No economic incentives, uneven code quality
BlockSmiths Solution
- ๐ Market Predictions: Real-time probability scores for PR outcomes
- ๐ฐ Economic Incentives: Reward accurate predictions and quality contributions
- โก Priority Signals: Help maintainers focus on high-value PRs first
๐ง Challenges I Ran Into
1. Smart Contract Economics
- Challenge: Designing sustainable bonding curve tokenomics
- Solution: Linear price increases with multi-tiered fee distribution
- Learning: Batch operations significantly reduce gas costs
2. GitHub API Rate Limits
- Challenge: 5,000 requests/hour limit for real-time PR data
- Solution: Intelligent caching with exponential backoff
- Learning: Aggressive caching essential for production
3. Web3 UX Complexity
- Challenge: Making blockchain accessible to traditional developers
- Solution: Progressive disclosure of Web3 complexity with clear error messages
- Learning: Fallback mechanisms crucial for adoption
๐ ๏ธ Technologies Used
Blockchain
- Solidity 0.8.28 - Smart contracts with OpenZeppelin libraries
- Hardhat - Development environment and testing
- Sepolia - Ethereum testnet deployment
Frontend
- Next.js 14 - React framework with TypeScript
- Wagmi + Viem - Web3 React hooks and Ethereum library
- Tailwind CSS - Utility-first styling
Integration
- GitHub REST API - Real-time PR and repository data
- React Query - Data fetching and caching
- MetaMask - Primary wallet connection
Built with โค๏ธ by the BlockSmiths team
Empowering developers through prediction markets and decentralized collaboration.