π Zig3 V3 Smart Wallet using the Stellar Blockchain & Soroban smart contracts for Passkey Id wallets, $Zi Airdrop with Classic games, Reward Referral System, Atomic asset Swaps & Liquidity pools. Play & Earn with this GameFi Dapp
Stellar, Zig3 v3 Airdrop dapp, Next.js 14 web Rewards magic link referral system (inspired by Slack π, Notion π, and Figma π¨) built with Next Auth and Soroban. Styled with Tremor components and Tailwind CSS.
Zi Airdrop Playground is a decentralized application (dApp) built with Next.js 14 for the new Zig3 v3 Smart wallet, combining features for secure airdrop management with a referral system inspired by modern platforms like Slack, Notion, and Figma. It leverages blockchain technology, WebAuthn for authentication, and a magic link referral system. The project is developer-friendly, responsive, and optimized for deployment on Vercel.
- Airdrop Management: Distribute digital assets to multiple recipients via blockchain smart contracts.
- Referral System: Magic link-based referrals powered by Supabase, inspired by collaborative platforms.
- WebAuthn Authentication: Passkey-based secure key encryption (secp256r1 curve) for local device for user authentication; no passwords downloads, no username.
- Responsive Design: Optimized for desktop and mobile using Chakra UI components.
- Blockchain Integration: Stellar Soroban Smart contract interactions for secure asset transfers, Airdrops, atomic swaps, liquidity pools, staking, sending and receiving.
- Analytics: Integrated Vercel Analytics for tracking usage.
- Classic Games: Zig3 v3 Airdrop playground introduces classic games like Space Invaders and Blockchain Tetris where the user is paid to play.
- Frontend: Next.js 14 (React, TypeScript, server-side rendering)
- Backend: Supabase (serverless functions, database, referral system)
- Authentication: WebAuthn (passkeys)
- Styling: Chakra UI
- Blockchain: Smart contracts for airdrops
- Deployment: Vercel (preview mode, cache invalidation) Supabase (edge function, database)
- Tools: ESLint, Prettier, Vercel Analytics
- Node.js 20+
- Vercel account
- SendGrid account
- Docker Desktop installed and running
- Supabase CLI installed globally
- Launchtube API keys required
- Mercury API keys required
- Soroswap API keys required
- The project uses pnpm for the package manager therefore you should install pnpm globally:
npm install -g pnpm- Clone Your Fork: Clone the forked repository to your local machine:
git clone https://github.com/<your-username>/zi-playground.git- Install Node modules:
pnpm installAdd credentials for:
- Soroban (for referral system)
- Supabase (for serverless functions and database)
- SendGrid (for email-based magic links)
- Stellar Blockchain keys (e.g., wallet or contract addresses)
Important: This project requires Supabase to run locally. First, install the Supabase CLI globally: How to install Supabase CLI
Prerequisites:
- Docker Desktop installed and running
- Supabase CLI installed globally
- Node.js 20+ installed
Setup Steps:
- Initialize Supabase (if not already done):
supabase init- Start Supabase services:
supabase start
supabase functions serve --env-file ./supabase/.env.development- Migrate database (leave Start Supabase services running, open another terminal if not already done):
supabase db reset- Synchronize liquidity pair list with router contract (if not already done):
curl -L -X POST 'http://localhost:54321/functions/v1/soroswap' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' \
-H 'Content-Type: application/json' \
--data '{"action":"sync"}'This will start all required services including:
- PostgreSQL database
- Supabase Auth
- Storage
- Edge Functions
- Studio (web interface)
- Access Supabase Studio:
- Open http://localhost:54323
- Default credentials:
- Email:
supabase - Password:
supabase
- Email:
- Database Management:
- Use Studio to manage your database schema
- Create tables, policies, and functions
- Monitor database performance
- Run command below (pnpm dev) then Open http://localhost:3000 to view the app:
pnpm dev- Stop Supabase services:
supabase stopTroubleshooting:
- If services fail to start, ensure Docker is running
- Check logs with
supabase logs - Reset local database with
supabase db reset
- Modify
app/page.tsxfor frontend changes (auto-updates in development) - Customize smart contracts or backend logic as needed
- Build Project Locally:
pnpm run build- Preview Project Locally:
pnpm preview- Update .env.production with Supabase URL and anon key
Vercel is the recommended platform for deployment:
- Push the repository to a Git provider (e.g., GitHub)
- Import the project into Vercel
- Configure environment variables in Vercel's dashboard
- Deploy with automatic scaling, preview mode, and serverless functions
Refer to Next.js deployment docs for details.
-
Create a Supabase Account (if you don't have)
- Visit Supabase and sign up for a new account
-
Create a New Project (if not already done)
- Click on "New Project"
- Fill in project details (name, password, and region) and click "Create new project"
-
Get API Credentials
- Go to the "API" section in your Supabase dashboard
- Note your
API URLandanon/public key
-
Login to Supabase (if not already done):
supabase login- Link to Supabase project (if not already done):
supabase link- Migrate database (if not already done):
supabase db push- Deploy Supabase edge functions (if some feature changed after last deployment):
supabase functions deploy- Add (or Update if exist) following secrets to Supabase:
SECRET_KEY
RP_NAME
RP_ID
ORIGIN
SOROBAN_RPC_URL
NETWORK_PASSPHRASE
SOROSWAP_FACTORY
FUNDER_PUBLIC_KEY
FUNDER_SECRET_KEY
ZION_TOKEN_ADDRESS
- Synchronize liquidity pairs with Soroswap smart contracts:
curl -L -X POST '<SUPABASE_URL>' \
-H 'Authorization: Bearer <SUPABASE_ANON_KEY>' \
-H 'Content-Type: application/json' \
--data '{"action":"sync"}'- Next.js: Docs | Tutorial | GitHub
- Supabase: Docs
- WebAuthn: Guide
- Chakra UI: Docs
- Passkeys: Docs
- Soroban: Docs
All keys in git history are testnet-only and have no real value. Before going live on mainnet, complete every item below.
- Generate new Stellar funder keypair (
FUNDER_PUBLIC_KEY/FUNDER_SECRET_KEY) β fund with real XLM - Generate new OpenZeppelin Relayer API key (
NEXT_PUBLIC_RELAYER_API_KEY) from channels.openzeppelin.com - Obtain new Mercury JWT (
MERCURY_JWT) for mainnet Mercury project - Create a new Supabase project (separate from testnet) and copy fresh
SUPABASE_URL+SUPABASE_ANON_KEY - Rotate
SECRET_KEYused for JWT signing in Supabase edge functions
- Deploy smart wallet factory contract β update
NEXT_PUBLIC_FACTORY_CONTRACT_ID - Deploy/verify WASM β update
NEXT_PUBLIC_WALLET_WASM_HASH - Deploy airdrop contract β update
NEXT_PUBLIC_AIRDROP_CONTRACT_ID - Update
NEXT_PUBLIC_NETWORK_PASSPHRASEtoPublic Global Stellar Network ; September 2015 - Update
NEXT_PUBLIC_RPC_URLto a mainnet RPC endpoint - Update Soroswap router + factory to mainnet addresses
- Run
supabase db pushagainst the new mainnet project (includes PQC migration) - Deploy all edge functions:
supabase functions deploy - Set all Supabase secrets (
SECRET_KEY,FUNDER_SECRET_KEY,MERCURY_JWT, etc.) viasupabase secrets set - Enable Row Level Security (RLS) policies on
users,rewards,wallet_accountstables - Set
verify-hybridfunction secrets
- Add all
NEXT_PUBLIC_vars to Vercel dashboard environment variables β never commit them to files - Verify
.env.examplecontains no real values - Enable Vercel deployment protection for production branch
- Confirm
.gitignoreblocks all.env*patterns (already done β ) - Run
git ls-tree -r HEAD --name-only | grep .envβ must return only.env.example - Review Supabase RLS policies before launch
- Rotate any key that was ever in a committed
.envfile
- Fork the repository, make changes, and submit a pull request
- Ensure code adheres to ESLint and Prettier standards
Contributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request.
MIT License - see LICENSE.md open-source contributions are welcome.