A Next-Generation Prediction Market with Branching Predictions, AMM Liquidity, and Human-Verified Outcomes
DIKE Protocol reimagines prediction markets by introducing prediction trees and multiverse branching. Traditional prediction markets force users to split capital between predictions, limiting upside. DIKE changes that by allowing users to leverage up to 60% of their initial capital to create "child" predictions without needing additional fundsβcreating a compounding effect where wins branch into further wins, multiplying outcomes far beyond the usual 2x ceiling.
- π³ Prediction Trees: Start with one stake, branch into multiple predictions using leverage
- π° AMM-Powered Liquidity: Enter and exit positions at fair, liquid prices without order books
- β Human-Verified Resolution: Outcomes resolved by KYCed validators verified using Self protocol
- π Risk-Managed Leverage: Protocol loans for branching, reclaimed with interest upon resolution
- π Stable Trading Environment: PyUSD stablecoin base for volatility protection
- π‘οΈ Sybil-Resistant Validation: Decentralized identity verification prevents manipulation
dike-protocol/
βββ client/ # Frontend application (Next.js)
β βββ app/ # Next.js app directory
β β βββ api/ # API routes (resolution, verification)
β β βββ chains/ # Chain-specific pages
β β βββ create-predic/ # Prediction creation interface
β β βββ dashboard/ # User dashboard
β β βββ predictions/ # Predictions listing
β β βββ profile/ # User profile
β β βββ swap/ # Swap interface
β β βββ landing/ # Landing page
β βββ components/ # React components
β β βββ ui/ # Reusable UI components (badge, button, card, etc.)
β β βββ prediction-details-modal.tsx
β β βββ chain-visualization.tsx
β β βββ opportunity-card.tsx
β β βββ ...
β βββ hooks/ # Custom React hooks
β β βββ createOpportunity.ts
β β βββ useInvestInPrediction.ts
β β βββ useIPFS.ts
β β βββ useReadChains.ts
β β βββ ...
β βββ lib/ # Utility functions
β β βββ ipfs.ts
β β βββ utils.ts
β β βββ ...
β βββ package.json # Frontend dependencies
β
βββ dike-contracts/ # Smart contracts (Solidity)
βββ src/
β βββ Dike.sol # Core protocol contract
β βββ FullDike.sol # Extended protocol features
β βββ Swap.sol # Swap/AMM logic
β βββ Counter.sol # Example contract
βββ test/ # Test files
β βββ Dike.t.sol
β βββ Swap.t.sol
β βββ Counter.t.sol
βββ script/ # Deployment scripts
β βββ DeployDike.s.sol
β βββ DeployFullDike.s.sol
β βββ DeploySwap.s.sol
βββ lib/ # Dependencies (Foundry)
β βββ forge-std/
β βββ openzeppelin-contracts/
β βββ pyth-sdk-solidity/
β βββ openzeppelin-foundry-upgrades/
βββ foundry.toml # Foundry configuration
βββ package.json # Contract dependencies
Users start with an initial stake and can create child predictions using up to 60% leverage without additional capital. This creates a branching structure where:
- Initial prediction resolves β User can branch into new predictions
- Wins compound across branches
- Capital efficiency maximized through protocol-provided loans
- Decentralized liquidity pools replace traditional order books
- Dynamic odds adjustment based on user trades
- Continuous price discovery
- Fair entry and exit prices for all participants
- Liquidity providers earn fees
- Price-based predictions: Resolved via Pyth Network price feeds (tamper-proof, real-time)
- Event-based predictions: Resolved by KYCed human validators
- Validators verified through Self protocol QR-based identity verification
- Sybil-attack resistant through decentralized identity validation
- Near real-time sync between off-chain verification and on-chain validator registry
- Leverage for branching provided as protocol loans
- Loans reclaimed with interest upon prediction resolution
- Liquidation protection: Positions below loan + interest threshold are liquidated
- Self-sustaining and capital-efficient system
- PyUSD (PayPal's stablecoin) as base currency
- Protects users from protocol token volatility
- Creates more resilient and trustworthy market environment
- Language: Solidity 0.8+
- Framework: Foundry
- Network: Sepolia testnet
- Key Integrations:
- Pyth Network: Price feeds for deterministic outcome resolution
- OpenZeppelin: Contract standards and upgradeable patterns
- PyUSD: Stablecoin for trading
- Framework: Next.js 14+
- Language: TypeScript
- Styling: CSS (custom) with Tailwind CSS support
- State Management: React hooks, wagmi for blockchain interaction
- UI Components: Custom component library (Badge, Button, Card, Dropdown, etc.)
- Key Libraries:
- Wagmi: Ethereum React hooks
- IPFS: Distributed file storage (useIPFS hook)
- Self SDK: KYC verification integration
- Verification Service: Self KYC integration
- API Routes: Next.js API routes for:
/api/resolution- Prediction resolution/api/verify- User/validator verification
- Chain Interaction: Direct smart contract calls for on-chain operations
POST /api/verify
Handles KYC verification through Self protocol, creates validator registry entries.
POST /api/resolution
Triggers prediction resolution with price feeds (Pyth) or human validators.
- User Registration: KYC verification through Self
- Create Prediction: Initialize with capital stake
- Trade: Use AMM to adjust positions at fair prices
- Branch Predictions: Leverage up to 60% for child predictions
- Resolution:
- Automatic for price-based (Pyth feeds)
- Human-verified for events (KYCed validators)
- Settle: Claim winnings, protocol reclaims loans + interest
The protocol uses custom AMM logic for dynamic odds:
- Prices adjust based on liquidity and trade volume
- Fairness ensured through constant product formulas
- No order book dependencies
Max Child Prediction Capital = Initial Stake Γ 0.60
Number of Branches = No limit (per liquidity)
Compounding Effect = Child Wins β More Capital for Grandchildren
If Position Value < (Loan Amount + Interest):
β Position Liquidated
β Collateral Returned (after loan repayment)
- All validators KYCed through Self protocol
- QR-code based verification flow
- Each person = one validator identity
- Off-chain verification synced on-chain in near real-time
| Prediction Type | Resolution Method | Security |
|---|---|---|
| Price Predictions | Pyth Network feeds | Cryptographic proof, tamper-proof |
| Event Predictions | Human validators | KYC-verified, Sybil-resistant |
- Node.js 18+
- Git
- Foundry (for smart contracts)
- Wallet with Sepolia testnet funds
cd client
npm install
npm run devcd dike-contracts
forge install
forge test
forge script script/DeployDike.s.sol --rpc-url sepoliaMain protocol contract handling:
- Prediction creation and management
- Branching logic and capital allocation
- Loan accounting and interest calculation
- Integration with Pyth price feeds
Extended features including:
- Advanced branching scenarios
- Enhanced liquidity management
- Multi-stage predictions
AMM swap and liquidity pool logic:
- Dynamic fee calculation
- Liquidity provider management
- Order execution and price discovery
cd dike-contracts
forge testcd client
npm run test- Landing (
/landing): Project introduction - Dashboard (
/dashboard): User overview and portfolio - Create Prediction (
/create-predic): Prediction initialization - Predictions (
/predictions): Browse all active predictions - Chains (
/chains/[id]): Chain-specific market data - Swap (
/swap): Direct token swapping - Profile (
/profile): User account settings - KYC Test (
/kyc-test): Verification workflow testing
- Smart Contracts: Solidity contracts deployed on Sepolia handle prediction trees, branching logic, loan accounting, and AMM mechanics
- Price Feeds: Integrated Pyth Network for tamper-proof, real-time price data
- Human Validation: Self KYC SDK provides decentralized identity verification with QR-code authentication
- Stable Base: PyUSD stablecoin ensures market stability
- Frontend: Next.js application with wagmi for seamless blockchain interaction
- Backend Bridge: API routes connect off-chain verification with on-chain contracts
- QR-based KYC approval flow synced with contract validator registry
- Custom AMM engine for dynamic odds without order books
- Protocol-managed loans for leverage without external capital
- Sybil-resistant validator selection through decentralized identity
Contracts deployed on Sepolia testnet. Deployment scripts in dike-contracts/script/.
Deployment history tracked in dike-contracts/broadcast/
- DEPLOYMENT.md: Detailed deployment instructions
- SELF_VERIFICATION_README.md: Self KYC integration guide
- Smart Contract ABIs: Available in
client/app/abi.ts
Contributions welcome! Please ensure:
- All tests pass
- Code follows Solidity and TypeScript conventions
- New features include tests
- README updated for significant changes
[Add appropriate license]
For questions or issues:
- Review documentation in contract README files
- Check API endpoint specifications
- Test on Sepolia testnet first
DIKE Protocol: Transforming prediction markets into living multiverse strategies where capital compounds, liquidity flows freely, and outcomes are verified by trusted, decentralized validators.