Roxy is a decentralized gaming SDK built on Bitcoin Layer 2 (Stacks) that enables game developers to integrate prediction markets, staking, and cross-game identity directly into their gameplay loop.
Unlike traditional prediction markets that are standalone apps, Roxy brings the market to the game. Players can stake on their own matches, compete in high-stakes arenas, and carry their reputation across the entire ecosystem.
- In-Game Wagers: Allow players to stake STX on the outcome of their own matches or tournaments.
- Binary Outcomes: Simple YES/NO pools for clear resolution (e.g., "Will Player X win Match #42?").
- Proportional Payouts: Winners share the losing pool's stake, minus protocol fees.
- Slippage-Free: Peer-to-pool model ensures liquidity and fair odds.
- Developer-Controlled Contexts: Create "Campaigns" (seasons, tournaments, or specific game modes) to isolate scoring and leaderboards.
- Custom configurations: Set scoring modes (Cumulative, High Score, Low Score) and duration.
- Sponsored Prize Pools: Deposit STX into a campaign to reward top performers automatically.
- Unified Profile: A single on-chain username and stats profile across all Roxy-integrated games.
- Verifiable History: Wins, losses, and total volume are tracked on-chain, creating a trustless "skill rating".
- Sybil Resistance: Cost-to-attack ensures leaderboards remain fair.
The Roxy ecosystem is composed of three main layers:
The heart of the protocol. It handles:
- Campaign creation and configuration.
- Staking logic and pool management.
- User identity and global stats.
- Payout calculations and treasury management.
Testnet Address: STVAH96MR73TP2FZG2W4X220MEB4NEMJHPMVYQNS.Roxy
A standard interface that defines how games communicate with the core contract. This ensures forward compatibility and easy integration for developers.
Testnet Address: STVAH96MR73TP2FZG2W4X220MEB4NEMJHPMVYQNS.roxy-trait
An example implementation showing how to wrap SDK calls within your game logic. This pattern allows games to abstract away the complexity of DeFi interactions from their players.
- Clarinet: For local development and testing.
- Stacks.js: For frontend wallet connection.
Your game contract should implicitly or explicitly interact with roxy-sdk-trait.
(use-trait roxy-sdk-trait 'STVAH96MR73TP2FZG2W4X220MEB4NEMJHPMVYQNS.roxy-trait.roxy-sdk-trait)Initialize your game mode (Campaign) to start tracking scores.
(contract-call? 'STVAH96MR73TP2FZG2W4X220MEB4NEMJHPMVYQNS.Roxy create-campaign
0x00... (metadata-hash)
tx-sender (reporter)
u100 (start-height)
u1000 (end-height)
u0 (scoring-mode: cumulative)
)Call SDK functions from your game client or contract wrapper.
Example: Staking on a Match
(contract-call? 'STVAH96MR73TP2FZG2W4X220MEB4NEMJHPMVYQNS.Roxy stake
event-id
u1000000 ;; 1 STX
true ;; VOTE YES
)create-campaign: Launch a new tracking context.create-match: Open a betting pool for a specific game event.resolve-match: (Reporter only) Settle the outcome and enable payouts.
set-username: Claim a unique identity.stake: Place a bet on an active match.claim-reward: Withdraw winnings from a resolved match.sync-score: Post game results to the campaign leaderboard.
get-campaign: View campaign details and total prize pool.get-event: Check odds/pools for a specific match.get-user-profile: Retrieve a player's alias and stats.
- Clone the repo.
clarinet integrateto spin up a local Devnet.- Deploy contracts (automatically handled by Clarinet).
Check example/frontend-example for a complete Vite + React implementation showing:
- Wallet Connection
- Profile Management
- Game Loop Integration
- Transaction Broadcasting
MIT
