5.2 KiB
5.2 KiB
🚀 PollCelo Production Setup Guide
Step 1: Clone and Install
cd daily-poll-mini-app
npm install
Step 2: Generate Protocol Wallet
Generate a new wallet for the protocol (DO NOT use your personal wallet):
npm run wallet:generate
This will output:
- Wallet address
- Private key
- Mnemonic phrase
⚠️ SECURITY:
- Keep the private key PRIVATE
- Never commit to git
- Store mnemonic offline as backup
- Fund with small amount of CELO for gas
Step 3: Set Up Neon Database
3.1 Create Neon Account
- Go to neon.tech
- Sign up / Log in
- Create new project: "pollcelo-prod"
3.2 Get Connection String
- Click on your project
- Go to "Connection Details"
- Copy the connection string
- It looks like:
postgresql://user:password@ep-xxx.us-east-2.aws.neon.tech/neondb?sslmode=require
3.3 Run Database Schema
# Set your DATABASE_URL first
export DATABASE_URL="your_connection_string_here"
# Run schema (using psql)
psql $DATABASE_URL < database/schema.sql
# Or use Neon's SQL editor in the dashboard
Step 4: Configure Environment
Copy the example file:
cp .env.local.example .env.local
Edit .env.local and fill in:
# ========================================
# Database
# ========================================
DATABASE_URL=postgresql://user:password@ep-xxx.neon.tech/neondb?sslmode=require
# ========================================
# Protocol Wallet (from Step 2)
# ========================================
PROTOCOL_WALLET_ADDRESS=0xYourAddressFromStep2
PROTOCOL_WALLET_PRIVATE_KEY=0xYourPrivateKeyFromStep2
# ========================================
# Celo
# ========================================
NEXT_PUBLIC_CELO_RPC_URL=https://forno.celo.org
NEXT_PUBLIC_CUSD_ADDRESS=0x765DE816845861e75A25fCA122bb6898B8B1282a
# ========================================
# App
# ========================================
NEXT_PUBLIC_APP_URL=http://localhost:3000
# ========================================
# Security
# ========================================
CRON_SECRET=$(openssl rand -hex 32)
Step 5: Fund Protocol Wallet
5.1 Get CELO for Gas
# Testnet (Alfajores)
# Use faucet: https://faucet.celo.org/
# Mainnet
# Buy CELO on exchange and send to your protocol wallet
# You need ~1 CELO for gas fees
5.2 Get cUSD
# Swap CELO for cUSD on:
# - Ubeswap: https://app.ubeswap.org/
# - Mento: https://app.mento.org/
# You need some cUSD in the wallet for testing
Step 6: Test Locally
npm run dev
Test Checklist:
- App loads without errors
- Database connection works
- Can view today's poll (if any)
- Wallet connects via MiniPay
Step 7: Test with Ngrok + Warpcast
7.1 Start Ngrok
ngrok http 3000
Copy the HTTPS URL (e.g., https://abc123.ngrok.io)
7.2 Update Environment
# Add to .env.local
NEXT_PUBLIC_APP_URL=https://abc123.ngrok.io
Restart dev server:
npm run dev
7.3 Test in Warpcast
- Open Warpcast mobile app
- Settings → Advanced → Enable Developer Mode
- Create a cast with your ngrok URL
- Tap to open as MiniApp
- Test the full flow!
Step 8: Deploy to Vercel
8.1 Push to GitHub
git init
git add .
git commit -m "Initial commit: PollCelo production ready"
git remote add origin https://github.com/yourusername/pollcelo.git
git push -u origin main
8.2 Deploy to Vercel
- Go to vercel.com
- Import your GitHub repository
- Add all environment variables from
.env.local - Deploy!
8.3 Update Environment
After deployment, update:
NEXT_PUBLIC_APP_URL=https://your-app.vercel.app
Redeploy!
Step 9: Configure Cron Jobs
In vercel.json:
{
"crons": [
{
"path": "/api/cron/verify",
"schedule": "0 * * * *"
},
{
"path": "/api/cron/distribute",
"schedule": "15 * * * *"
}
]
}
Step 10: Create Your First Poll!
Navigate to /create-poll and:
- Enter question
- Add 2-4 options
- Select verification method (Chainlink/Curve/API)
- Configure verification
- Pay 5 cUSD
- Poll goes live!
Monitoring
Check Database
psql $DATABASE_URL
\dt # List tables
SELECT * FROM polls;
SELECT * FROM votes;
Check Wallet Balance
# Check cUSD balance of protocol wallet
# Use Celo Explorer: https://explorer.celo.org/
Check Logs
# Vercel dashboard → Your project → Logs
# Or use CLI:
vercel logs
Troubleshooting
Database Connection Failed
- Check DATABASE_URL is correct
- Verify SSL mode is set
- Check Neon project is not paused
Wallet Transactions Failing
- Check wallet has CELO for gas
- Verify private key is correct
- Check RPC endpoint is working
Cron Jobs Not Running
- Verify CRON_SECRET is set
- Check Vercel logs for errors
- Ensure cron paths match API routes
Polls Not Verifying
- Check oracle API keys are set
- Verify end time has passed
- Check verification_attempts table for errors
Next Steps
✅ You're now production ready!
- Create your first real poll
- Share on Farcaster
- Monitor for votes
- Watch automated verification work
- See winners get paid automatically!
Need help? Check the docs or reach out!