Crafting experience...
5/2/2025
Built At
UWL SCE x SEGA Hackathon
Hosted By
What is the problem you are trying to solve?
Traditional trading-card games are siloed: cards live only on a centralized server, limiting true ownership or secondary-market trading.
Gameplay is static—no conversational or narrative layer to guide new players, and match-ups feel repetitive.
There is also security and authenticity problem where certain cards faked
Who does it affect?
Collectors & traders who want provable ownership and liquidity for digital cards.
Casual players who enjoy narrative-driven progression but don’t know where to start.
Blockchain enthusiasts seeking fun, on-chain games rather than purely financial hungry apps.
What is your idea?
A web game where each “card pack” is an NFT mint transaction.
Packs contain randomized playable characters (NFTs) you can battle with.
A ChatGPT API integration acts as both guide (tutorials, flavor text) and “game master,” narrating battles and events.
How does it fix the problem?
True ownership: Every card is an NFT on Polygon Blockchain that which you can trade, sell and buy on the OpenSea marketplace.
Dynamic onboarding: GPT dialogue tailors explanations to each player’s questions and skill level.
Replayability & economy: Secondary-market trading and randomized packs sustain a self-funded ecosystem.
Frontend
Next.js with React + TypeScript for the UI and page routing.
Three.js for any 3D/animated card-battle visuals.
Deployed on Vercel for global edge performance.
Connects to MetaMask via ethers.js/web3.js to authenticate by wallet address and sign transactions.
Backend
A plain Node.js server (written in JavaScript) handles all NFT-minting logic and off-chain game simulations.
Exposes REST endpoints for:
Pack Purchase: triggering mint calls to your smart contract.
Battle Simulation: running game logic, calling ChatGPT, persisting results within the nextjs app router for chat, leaderbaord and nft characters
Database & Storage
Supabase (Postgres) with two core tables:
user_data
(wallet addresses, and nfts owned).
nft_data
(token IDs, pack contents, on-chain metadata URIs, battle history).
Pinata/IPFS for hosting all NFT metadata JSON (images, attributes, flavor text links).
Blockchain Layer
Solidity smart contract deployed on your chosen network (e.g. Polygon):
safeMint()
mints a new nfts with a metadata URI pointing at IPFS.
ChatGPT Integration
Backend calls OpenAI’s GPT-4 API, passing in the player’s current roster (from nft_data
) plus the result of the latest battle simulation to generate real-time narration, coaching tips, and dynamic events.
Buying Packs
Frontend → POST /api/mint
(authenticated) → server calls contract’s safeMint()
via ethers.js → on-chain transaction confirmed → server writes new nft_data
row (token ID, IPFS CID).
Battles & Leaderboard
Frontend → POST /api/leaderbaord
→ result stored in Supabase (user_data
and nft_data
) → server calls ChatGPT-4 API for narration → returns battle log + updated stats.
Leaderboard queries Supabase to rank users by wins, rare NFTs, token rewards, etc.
What did you struggle with? How did you overcome it?
Smart Contract Development
Wrestling with Solidity’s edge cases (reentrancy guards, fallback functions) taught me the value of deep domain knowledge and rigorous testing. Each bug I squashed reinforced the blockchain practice of understanding the language, not just using the library.
TypeScript Integration
Struggling with strict typings in ethers.js and Supabase pushed me to build custom type declarations and wrappers. In hindsight, these problem transformed into confidence—now I see types not as a hurdle, but as a tool for safer, self-documenting code.
Three.js Performance
Hitting frame drops on older devices was humbling. Profiling and then simplifying scene updates taught me humility: flashy visuals are exciting, but a smooth experience for every player is the real win.
Supabase Schema Migrations
Constantly evolving tables without downtime required disciplined migrations with shadow columns and atomic switchovers. This process instilled in me a deeper respect for data engineering: thoughtful planning prevents future headaches.
What did you learn? What did you accomplish?
What I Learned
Embracing Design Complexity
Initially, “lootbox” mechanics sounded simple: mint a pack, reveal contents. But diving into smart-contract design revealed layers of nuance—token standards, randomness guarantees, upgradeability. Wrestling with those patterns taught me to appreciate the craftsmanship behind even “basic” NFT drops, and to approach future contracts with greater respect for on-chain constraints and user trust.
Security as a Mindset
Implementing nonce-based wallet authentication wasn’t just a checkbox exercise. Every malformed signature or replay attack scenario forced me to think like an adversary. I learned that security isn’t an afterthought—it’s baked into every API endpoint, every state transition, and every user prompt. Today, I default to writing threat models before a single line of code.
Conversational AI Integration
Embedding GPT-4 as a live “Game Master” challenged my misconceptions about AI. Rather than a drop-in feature, it required careful context curation, rate-limit handling, and UX design so that players felt guided, not interrupted. That process deepened my understanding of LLM token economics and how to sculpt prompts for maximum narrative impact.
What I Built
Playable Prototype with Real Stakes
Crafting the end-to-end flow—from “Buy Pack” to “Battle Outcome”—gave me a visceral sense of how web3 shifts responsibility: players now truly own their characters. Shipping a streamlined minting UI and battle engine helped me internalize best practices around transaction feedback loops and off-chain vs. on-chain trade-offs.
Transparent Leaderboards & Profiles
Exposing on-chain achievements in a friendly UI required me to reconcile blockchain transparency with data privacy and UI clarity. Designing the leaderboard and profile pages was more than styling tables—it was about storytelling through metrics, helping players see their growth and potential paths forward.
Staking & Rewards
Introduce a staking mechanism for rare NFTs and allow users to lock cards in exchange for in-game currency, governance rights, or seasonal loot drops.
Multiplayer Tournaments
Host scheduled and asynchronous PvP brackets (“Boss Raids,” “Arena Nights”) with on-chain prize pools, leveraging the GPT “Game Master” to narrate key matchups live.
Smart-Contract Upgrades
Refactor core contracts to include upgradability proxies and ERC-1155 support for batch mints to lower user costs and future-proof the system.
Type-Safe Backend
Migrate the JavaScript server to full TypeScript, define strict domain models for users and NFTs, and layer in GraphQL for more efficient data fetching—improving developer DX and runtime safety.
Fine-Tuned Game Master
Gather in-game dialogue logs to fine-tune a private GPT model on Sega Unleashed lore, creating richer, branching narratives that respond to player history.
Data-Driven Insights
Integrate Supabase analytics or external BI tools to surface heatmaps of popular cards, drop rates, and churn signals—guiding feature prioritization and tuning pack economics.