SwagSwap

A Web3 marketplace for trading hackathon swag with World ID verification and x402 micropayments

SwagSwap

Created At

ETHGlobal Buenos Aires

Winner of

World

World - World Pool Prize

Prize Pool

Project Description

SwagSwap is a decentralized marketplace built exclusively for hackers to trade exclusive swag and merch. Unlike traditional marketplaces, SwagSwap leverages cutting-edge Web3 technologies to create a trustless, secure, and fun trading experience.

The Problem: Hackathon participants accumulate tons of swag (hoodies, t-shirts, stickers, collectibles) but often can't use all of it. Meanwhile, collectors and enthusiasts want specific items they missed out on.

Our Solution: SwagSwap provides a Web3-native platform where users can list their unwanted hackathon swag, browse items from other hackathons, trade directly with other enthusiasts, verify they're real humans using World ID, and pay for API access with micropayments via x402 protocol.

Key Features: 🛡️ Sybil-Resistant: World ID integration ensures only real humans can list items 💳 Pay-Per-Use: Users only pay $0.0001 USDC when they fetch listings (x402) 🔐 Seamless Auth: Privy enables wallet-less onboarding 💸 Gasless Payments: Users only need USDC, no ETH required ⚡ Fast & Modern: Built with Next.js 15 and TypeScript

How it's Made

SwagSwap integrates three key Web3 protocols to create a unique marketplace experience:

  1. x402 Payment Protocol (PRIMARY): Implemented HTTP-native micropayments for true pay-per-use API access. Protected /api/listings endpoint with x402 middleware. When users fetch listings, they pay $0.0001 USDC - client builds EIP-712 typed data for USDC transfer authorization, user signs with Privy embedded wallet (gasless!), payment header added automatically, facilitator verifies and settles on-chain. This enables sub-cent pricing impossible with traditional payment rails. Users only need USDC, no ETH for gas. Combined with Privy, it feels like Venmo - users see "$0.0001" not "wei" or "gwei".

  2. World ID: Integrated IDKit widget for zero-knowledge proof of humanity. Users verify once at Orb level, frontend receives proof with nullifier hash and merkle root, backend verifies with World ID Developer Portal API. Nullifier hashes tracked in-memory Map to prevent duplicate verifications (hackathon-ready!). This prevents bot spam and Sybil attacks - only verified humans can create listings.

  3. Privy: Provides embedded wallet infrastructure. Users can login with email/social and get an auto-created wallet, or connect existing wallets. Configured with PrivyProvider wrapper and usePrivy() hooks. Enables gasless transaction signing for x402 payments. Users can fund wallets with Apple Pay/Google Pay. Combined with x402, creates Web2-like UX despite advanced crypto backend.

Technical Stack: Next.js 15 App Router, React 18, TypeScript, Tailwind CSS 4, Viem for blockchain interactions, Neon Serverless Postgres for listings and verifications storage. Base Sepolia for x402 USDC payments.

Key Technical Challenges Solved:

  • World ID TypeScript types: Cast app_id as app_${string} for IDKit
  • Gasless payments: USDC-only with Privy signing, no ETH needed
  • Payment caching: Avoid duplicate charges for same data
  • Web2-like UX: Users see dollar amounts, not crypto jargon

Notable Hacks: In-memory nullifier tracking (fast, hackathon-ready), dual wallet support (embedded + external), auto-retry logic for failed x402 payments with exponential backoff, EIP-712 permit signatures for gasless UX.

What makes this unique: True micropayments at $0.0001/call (impossible with Stripe/traditional rails), Sybil-resistant via World ID, gasless payments (users only need USDC), Web3-native but Web2-like UX, built specifically for hackathon community.

background image mobile

Join the mailing list

Get the latest news and updates

SwagSwap | ETHGlobal