Full-Stack Web3 Development • Mobile Application • Smart Contracts
StockBaller is a full-stack Web3 sports trading platform built with React Native (Expo), NestJS, Prisma/MongoDB, and Solidity smart contracts—enabling users to buy/sell tokenized athlete shares with prices driven by real match statistics. The integration of Chainlink CRE workflows for decentralized price oracles and GPT-4 for AI-powered match predictions delivers a trustless, transparent trading experience that eliminates single points of failure while supporting 100+ automated trading bots and seamless on-chain settlement on Base Sepolia.
Building a sports trading platform presented three critical engineering challenges:
Traditional sports apps rely on centralized backends to update prices, creating manipulation risk and single points of failure. Users had no way to verify that athlete token prices reflected actual match performance.
Synchronizing state between a MongoDB database, ERC-1155 smart contracts, and real-time API data (API-Football) required careful orchestration to prevent race conditions and ensure atomic transactions.
Testing market dynamics required simulating 100+ trading bots with distinct strategies (Value Investor, Day Trader, Momentum, Random) executing concurrent trades without overwhelming the system.
GPT-4 match predictions needed to be submitted on-chain with cryptographic proof, then settled against actual results with verifiable payouts.
Why NestJS? The modular architecture with dependency injection made it ideal for separating concerns across 10+ feature modules (market, trading, prediction, blockchain, bots, scheduler). Built-in support for Swagger documentation, guards, and interceptors accelerated API development.
Why Prisma + MongoDB? The schema-first approach with Prisma provided
type-safe database queries while MongoDB's document model handled flexible JSON
fields (player stats, yield data) without rigid migrations. The @unique
constraints on tokenId and walletAddress ensured data
integrity across the trading system.
Why Expo? A single codebase deployed to iOS, Android, and Web
(stockballer.app). Expo Router provided file-based routing matching the
app/ directory structure, while NativeWind (TailwindCSS for React
Native) enabled consistent styling via global.css.
Why ethers.js for Web3? Direct integration with MetaMask and
WalletConnect, with typed contract ABIs generated from Hardhat compilation. The
WalletStore (Zustand) managed wallet state across the app.
Why Base Sepolia? Low gas fees, fast finality, and EVM compatibility made it ideal for high-frequency trading simulation. Base's Coinbase backing provided reliable testnet infrastructure.
Why ERC-1155? Multi-token standard allowed each athlete to have a
unique tokenId within a single ProSpectVault.sol
contract—reducing deployment costs versus individual ERC-20 tokens per player.
Why Chainlink CRE (Compute Runtime Environment)? The decentralized oracle network eliminated trust requirements:
ProSpectVaultV2.sol
This architecture ensures no single party can manipulate athlete prices.
The proprietary pricing algorithm balances performance rewards with risk penalties:
The automated trading system uses a strategy pattern with pluggable algorithms:
| Strategy | Behavior |
|---|---|
| VALUE_INVESTOR | Buys undervalued young players (age < 20), holds long-term |
| DAY_TRADER | High-frequency trading, targets small profits per trade |
| MOMENTUM | Follows hot performers, trend-based entry/exit |
| RANDOM | Random trades for market noise simulation |
GPT-4 predictions are submitted on-chain for verifiable settlement:
| Metric | Result |
|---|---|
| API Response Time | < 100ms average (NestJS + Prisma query optimization) |
| Bot Fleet Scale | 500+ concurrent bots with distinct wallets |
| Transaction Throughput | 1,000+ simulated trades/hour in stress tests |
| Cross-Platform Deploy | Single codebase → iOS, Android, Web |
| Metric | Result |
|---|---|
| E2E Test Coverage | Blockchain, trading, market, scheduler modules |
| Type Safety | 100% TypeScript (API, frontend, Chainlink workflow) |
| Contract Tests | Hardhat test suite with coverage reporting |
| Metric | Result |
|---|---|
| Contracts Deployed | 3 (ProSpectVaultV2, PredictionMarket, MockUSDC) |
| Network | Base Sepolia (Chain ID: 84532) |
| Oracle Type | Chainlink CRE with BFT consensus |
From the V2 simulation report (25 players analyzed):
| Scenario | Avg Price Change | Market Cap Growth |
|---|---|---|
| Maintain Form | +38.4% | $684K → $947K |
| Improved (+20%) | +41.4% | $684K → $967K |
| Declined (-30%) | +32.6% | $684K → $907K |
Top Performer: E. Smith Rowe at +1,900% projected growth (youth multiplier + form).
Decentralized price oracles eliminate manipulation risk without sacrificing real-time updates.
Single contract deployment with unique token IDs per athlete reduces gas costs and simplifies frontend integration.
Separating trading, prediction, blockchain, and bot modules allowed parallel development and isolated testing.
GPT-4 analysis with cryptographic settlement provides transparency that centralized sports betting cannot match.
A single TypeScript codebase deployed to iOS, Android, and Web with consistent wallet connectivity.
StockBaller demonstrates cutting-edge Web3 engineering, combining decentralized oracle networks, AI-powered predictions, and mobile-first design into a trustless sports trading platform. By leveraging Chainlink CRE for price integrity, ERC-1155 for efficient multi-token management, and NestJS for scalable backend architecture, the platform achieves production-ready performance with 500+ concurrent bots and sub-100ms API response times. The cross-platform deployment via Expo and typed smart contract integration showcases modern full-stack blockchain development patterns.
Built for: B2B Sports Data — DeFi & Tokenization | CRE & AI | Prediction Markets
Live Platform: stockballer.app
Technologies: React Native, NestJS, Prisma, MongoDB, Solidity, Hardhat, Chainlink, Base Sepolia, GPT-4