NSBEHacks 2026 - Ripple XRP Challenge Submission
A decentralized, gamified jukebox where party-goers bid XRP on songs they want to hear next. Instead of chaotic song requests, the crowd engages in real-time "Song Quests" where the highest bidder wins.
- DJs receive chaotic, unorganized song requests
- No fair system for prioritizing requests
- DJs make $0 from song requests
- Party-goers have no way to guarantee their song gets played
Song Battle turns every song request into a revenue event by:
- Allowing users to bid XRP on songs in head-to-head battles
- Creating a transparent, blockchain-verified bidding system
- Automatically managing payments through the XRP Ledger
- Giving the crowd agency while monetizing the DJ's time
This project leverages the XRP Ledger (XRPL) for:
- Automatic Wallet Generation - Users get XRPL wallets created on first bid
- Testnet Payments - Real XRP transactions on XRPL Testnet
- Payment Verification - Backend verifies transactions before updating app state
- Transaction Transparency - All bids are publicly verifiable on XRPL Explorer
- Fast Settlement - XRPL's 3-5 second finality for instant user feedback
- β‘ Speed: 3-5 second transaction confirmation (perfect for live events)
- π° Low Fees: Minimal transaction costs (~0.00001 XRP)
- π Testnet: Free testnet XRP for development and demos
- π Transparency: Public ledger for trust and verification
Frontend (Crowd App):
- Expo React Native (cross-platform: iOS, Android, Web)
- Firebase Firestore (real-time bid updates)
- Firebase Authentication (anonymous users)
Backend:
- Firebase Cloud Functions (serverless)
xrpl.jslibrary (XRPL integration)- Firestore transactions (atomic updates)
Blockchain:
- XRP Ledger Testnet
- Custodial wallet architecture (server-managed for hackathon simplicity)
User clicks "Boost Song A (+5 XRP)"
β
Frontend: Call placeBid(songChoice: "songA", bidAmount: 5)
β
Backend: Check if user has XRPL wallet
β
Backend: If no wallet β Generate + Fund with 1000 XRP from master wallet
β
Backend: Send 5 XRP from user wallet to battle escrow wallet
β
Backend: Verify transaction confirmed on XRPL
β
Backend: Update Firestore (songA.totalBids += 5)
β
Frontend: Real-time listener updates UI
β
Frontend: Show transaction hash + XRPL Explorer link
Firestore Structure:
battles/current_battle: {
status: "active",
songA: { title: "...", artist: "...", totalBids: 45 },
songB: { title: "...", artist: "...", totalBids: 30 },
bids: { {userId}: { song: "songA", amount: 5 } }
}
users/{userId}/data/wallet: {
address: "rN7n7...", // XRPL address
seed: "sEdT...", // Private key (hackathon only!)
balance: 995, // Cached XRP balance
fundingTxHash: "ABC..." // Initial funding transaction
}- Node.js 18+ (for Firebase Functions)
- npm or yarn
- Expo CLI (
npm install -g expo-cli) - Firebase account (free tier works)
-
Install Dependencies:
cd nsbehacks-backend/functions npm install -
Generate Master Wallet:
node generateMasterWallet.js
- Copy the wallet address
- Fund it with 50,000 XRP: https://faucet.altnet.rippletest.net/
-
Deploy Firebase Functions:
cd ../ firebase deploy --only functions
-
Install Dependencies:
cd crowd-app npm install -
Configure Firebase:
- Update
fireBaseConfig.jswith your Firebase project credentials
- Update
-
Run the App:
# For web npm run web # For mobile (Expo Go app) npm start
Use Firebase Console to create a document:
- Collection:
battles - Document ID:
current_battle - Fields:
{ "status": "active", "songA": { "title": "Blinding Lights", "artist": "The Weeknd", "totalBids": 0 }, "songB": { "title": "Levitating", "artist": "Dua Lipa", "totalBids": 0 }, "bids": {} }
- Open the app (web or mobile)
- User authenticates automatically (anonymous)
- Click "Boost Song A (+5)"
- Backend creates XRPL wallet for user
- Backend funds wallet with 1000 XRP
- Backend sends 5 XRP to battle escrow
- Transaction confirmed on XRPL
- UI updates with new total
- Verify on XRPL Explorer:
- Copy transaction hash from app
- Visit: https://testnet.xrpl.org/transactions/{txHash}
- See your payment on the public ledger!
- β Wallet address displayed at top of screen
- β Balance shows 995 XRP after first 5 XRP bid (1000 - 5)
- β Transaction hash shown with "View on XRPL Explorer" link
- β Firestore totals update only after XRPL confirmation
- β Multiple users can bid simultaneously
"Failed to fund new wallet"
- Master wallet needs funding from faucet
- Check: https://testnet.xrpl.org/accounts/rQH8XdPYN9RYnXVJBj5aV9CebJtE8ugt8k
"Payment failed"
- User wallet might have insufficient balance
- Check wallet balance on XRPL explorer
Firebase Functions timeout
- First call after idle = cold start (10+ seconds)
- Subsequent calls are fast (<2 seconds)
nsbehacks/
βββ crowd-app/ # Frontend (Expo React Native)
β βββ app/
β β βββ index.js # Main battle screen with wallet display
β βββ fireBaseConfig.js # Firebase configuration
β βββ package.json
β
βββ nsbehacks-backend/ # Backend (Firebase Functions)
β βββ functions/
β β βββ index.js # placeBid function with XRPL integration
β β βββ xrplService.js # XRPL wallet & payment service
β β βββ generateMasterWallet.js # Setup script
β β βββ package.json
β βββ firebase.json
β
βββ README.md # This file
nsbehacks-backend/functions/xrplService.js
- Core XRPL functionality
- Wallet generation, funding, payments
- Connection to XRPL Testnet
- Transaction verification
nsbehacks-backend/functions/index.js (lines 38-107)
placeBidfunction with XRPL payment flow- User wallet creation/retrieval
- Payment verification before Firestore updates
- Error handling for XRPL failures
crowd-app/app/index.js (lines 99-117)
- Wallet information display
- Transaction hash with explorer link
- Real-time balance updates
[Demo Video Link - To Be Added]
Demo shows:
- User A places bid β Wallet created + funded with 1000 XRP
- 5 XRP sent to battle escrow
- Transaction visible on XRPL Testnet Explorer
- Firestore totals update in real-time
- User B places bid β Separate wallet, separate transaction
- Both transactions verified on public ledger
Phase 1 (Current - Hackathon MVP):
- β XRPL wallet generation
- β Real XRP payments on Testnet
- β Transaction verification
- β Real-time bid updates
Phase 2 (Post-Hackathon):
- DJ Command Center (React dashboard)
- Spotify API integration (queue control)
- Battle timer & automatic resolution
- Winner payout distribution
- "Vibe Credit" reward system for losers
Phase 3 (Production):
- User-controlled wallets (XUMM/Crossmark integration)
- Mainnet deployment
- Enhanced security (KMS for wallet seeds)
- Advanced analytics for DJs
- Multi-battle support
For Hackathon Demo:
- Custodial wallets (server-managed)
- Seeds stored in Firestore (NOT production-safe!)
- Testnet only (no real money)
For Production:
- User-controlled wallets (XUMM SDK)
- No seed storage (non-custodial)
- Hardware wallet support
- KMS encryption for any server-managed keys
Solo Developer - Built for NSBEHacks 2026
MIT License - Built for educational purposes
Challenge: Ripple XRP Challenge Category: DeFi / Real-World Application Devpost: [Link to be added]
Impact:
- Solves real problem (chaotic DJ requests)
- Monetizes DJ time (new revenue stream)
- Showcases XRPL's speed & low fees
- Real-world use case for crypto payments
Built with β€οΈ using XRP Ledger | NSBEHacks 2026