SeatSwap is a decentralized application that reimagines the flight ticket resale market. By leveraging Zero-Knowledge (ZK) proofs and representing tickets as NFTs, SeatSwap unlocks new liquidity for a traditionally illiquid asset. It enables a robust secondary market where tickets can be resold through various models, including auctions.
A key innovation of this model is its approach to privacy and compliance. NFT acquisition and resale on the secondary market can happen in a permissionless manner. Only the final ticket holder who intends to travel must provide their KYC data directly to the airline for redemption, dramatically reducing friction for traders and speculators.
This project was built for ETHGlobal, integrating a React frontend, a Next.js backend for identity verification, and Solidity smart contracts for on-chain logic.
- Frontend: React 18, Vite, Tailwind CSS, shadcn/ui
- Backend (ID Verification): Next.js API Routes
- Blockchain: Hardhat, Ethers.js, Solidity
- Identity: Self.xyz SDK for Zero-Knowledge Proofs
- Development:
concurrently
for running multiple services,pnpm
for package management
- Node.js: Version 18+ is required.
- pnpm: The recommended package manager for this project.
- ngrok: Required to create a secure, public-facing URL for the local backend server, which is necessary for the Self.xyz verification service to communicate with your application during development.
This section guides you through setting up the project for development and running a full demo.
-
Clone the Repository
git clone https://github.com/theexoticman/seatswap-ethglobal-cannes-25.git cd seatswap-ethglobal-cannes-25
-
Install All Dependencies Run the installation command from the root directory. The
postinstall
script will automatically install dependencies for theserver
andonchain
directories as well.npm install
-
Set Up On-Chain Environment (
onchain/.env
) Create an.env
from.env_template
file inside theonchain
directory. This is required for deploying your smart contracts.SEPOLIA_RPC_URL="https://rpc-url/YOUR_INFURA_KEY" PRIVATE_KEY="YOUR_WALLET_PRIVATE_KEY" ETHERSCAN_API_KEY="YOUR_ETHERSCAN_API_KEY" (Optional)
Ensure the wallet has Sepolia ETH for gas fees.
-
Set Up Backend & Frontend Environments
- Create ngrok Account: You will need a free ngrok account.
- Update Backend Env (
server/.env
) fromserver/.env_template
: Create this file and add your ngrok URL.NEXT_PUBLIC_SELF_SCOPE="seatswap" # Replace with your ngrok URL. The port must match your backend server port (default 3001). NEXT_PUBLIC_SELF_ENDPOINT="https://your-ngrok-url.ngrok-free.app/api/verify"
- Update Frontend Env (
.env.local
): Create this file in the root directory.VITE_SELF_SCOPE="seatswap" VITE_SELF_ENDPOINT="https://your-ngrok-url.ngrok-free.app/api/verify"
-
Deploy Smart Contracts From the root directory, run the Hardhat deployment script. This will deploy
TicketNFT.sol
andSeatSwapMarketplace.sol
to the Sepolia testnet.npx hardhat run onchain/scripts/deploy.js --network sepolia
After deployment, copy the new
SeatSwapMarketplace
contract address and paste it intosrc/contract-config.js
. -
Start the ngrok Tunnel Open a new terminal and start ngrok to expose your backend server.
# The port should match the one your Next.js server will use (default: 3001) ngrok http 3001
If you are using a new ngrok URL, remember to update your
.env.local
files again. -
Run the Application From the root directory, run the
dev
script. This will start the Vite frontend and the Next.js backend simultaneously.pnpm run dev
-
Open in Browser Navigate to
http://localhost:5173
to interact with the SeatSwap dApp.
- Navigate to the "Import Reservation" tab and use the form to find a ticket.
- Click "Import Reservation" to add your ticket to the platform. To do this, we first need to verify you are the owner of that ticket.
- The Identity Verification process uses Self.xyz. Scan the QR code with the Self mobile app to prove ownership without revealing private data.
- Navigate to the "My Tickets" tab.
- Click "Resell" on a verified ticket.
- Set the price for the NFT.
- Review the details and mint your Ticket NFT.
- Approve the transaction in your wallet to mint the ticket as an NFT on the marketplace.
- If everything goes well, the NFT is minted and the Etherscan transaction URL will be displayed.
TODO
This project is created for ETHGlobal and is available under the GPL License.
Built with ❤️ for ETHGlobal using modern web technologies and inspired by the beautiful city of Cannes.