A Farcaster Mini App where users answer quiz questions about Celo blockchain and mint NFTs based on their score!
- Score-Based NFT Minting:
- 1 correct answer = 1 NFT
- 2 correct answers = 2 NFTs
- 3 correct answers = 3 NFTs (All!)
- Farcaster Integration: Native wallet support and user context
- One-by-one Quiz: Interactive quiz with progress tracking
- Multi-Wallet Support: Works with Farcaster wallet or external wallets (MetaMask, etc.)
- Celo Blockchain: Built on Celo mainnet
App URL: https://celo-nft-mint.vercel.app
Contract Address: 0x6a31E0ac5184A1263812abd764E8813A79AEE8cF (Celo Mainnet)
celo-nft-mint/
โโโ index.html # Main app
โโโ farcaster.json # Farcaster manifest
โโโ icon.png # App icon (200x200px)
โโโ preview.png # Preview image (1200x630px)
โโโ splash.png # Splash screen (1200x1200px) - optional
โโโ vercel.json # Vercel config - optional
โโโ README.md # This file
- Go to: https://miniapps.farcaster.xyz/tools/signature-generator
- Enter:
- Domain:
celo-nft-mint.vercel.app - Your Farcaster FID: (Your FID number)
- Domain:
- Copy the generated
header,payload, andsignature - Update
farcaster.jsonwith these values
Use the image generator tool (image-templates.html) or create manually:
icon.png - 200x200px
- Your app icon for Farcaster
preview.png - 1200x630px
- Preview image when sharing
splash.png - 1200x1200px (optional)
- Loading screen
Your contract should have token URIs added via addTokenURI() function. Check that:
- At least 3 token URIs are registered in the contract
- URIs point to valid IPFS metadata
- Contract is properly configured
You can check this by calling getAllTokenURIs() on the contract.
- Push all files to GitHub
- Import repository to Vercel
- Deploy (automatic)
- Your app is live at: https://celo-nft-mint.vercel.app
-
Enable Developer Mode in Farcaster:
- Visit: https://farcaster.xyz/~/settings/developer-tools
- Toggle "Developer Mode" ON
-
Test the app:
- Open Farcaster app
- Go to Developer section
- Enter:
https://celo-nft-mint.vercel.app - Click "Open"
-
Test functionality:
- Answer quiz questions
- Check wallet connection
- Try minting NFTs (on testnet first!)
Before going live:
-
index.html- Production ready (no changes needed!) -
farcaster.json- Account association generated with YOUR FID -
icon.png- Created and uploaded -
preview.png- Created and uploaded -
splash.png- Created and uploaded (optional) -
vercel.json- Added for CORS headers (optional) - Contract verified:
0x6a31E0ac5184A1263812abd764E8813A79AEE8cF - Contract has token URIs configured (check
getAllTokenURIs()) - Tested in Farcaster Developer Mode
- User Opens App: Via Farcaster or direct link
- Takes Quiz: Answers 3 questions about Celo
- Gets Score: System counts correct answers
- Claims NFTs:
- Connects wallet (Farcaster or external)
- Switches to Celo network
- Calls
claimNFTs(correctAnswers)- single transaction! - Contract automatically mints 1-3 NFTs based on score
- Receives NFTs: Check wallet on Celo Explorer
Address: 0x6a31E0ac5184A1263812abd764E8813A79AEE8cF
Network: Celo Mainnet (Chain ID: 42220)
Explorer: https://explorer.celo.org/address/0x6a31E0ac5184A1263812abd764E8813A79AEE8cF
Main Function: claimNFTs(uint8 correctAnswers)
- Users can only claim once (checked via
hasClaimedmapping) - Contract automatically assigns NFT URIs based on score
- Emits
NFTsClaimedevent with token IDs
Features:
- โ One-time claim per address
- โ Single transaction for all NFTs
- โ Score-based NFT distribution
- โ Event emission for tracking
- Chain ID: 42220 (0xa4ec)
- RPC URL: https://forno.celo.org
- Block Explorer: https://explorer.celo.org
- Native Token: CELO
- โ
SDK Integration (
@farcaster/miniapp-sdk) - โ User Context (FID, username, avatar)
- โ
Wallet Provider (
sdk.wallet.getEthereumProvider()) - โ
Add to Favorites (
sdk.actions.addMiniApp()) - โ
Ready Signal (
sdk.actions.ready()) - ๐ Notifications (coming soon)
Edit in index.html:
const questions = [
{
q: "Your question here?",
options: ["Option A", "Option B", "Option C", "Option D"],
answer: "Option B"
},
// Add more questions...
];Update CSS gradients in index.html:
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);Update contract address:
const CONTRACT_ADDRESS = "0xYourNewContractAddress";- Ensure
farcaster.jsonis at root - Check JSON is valid
- Verify domain matches deployment
- Regenerate account association
- Use correct FID
- Match domain exactly
- Check you're on production domain
- Clear browser cache
- Try different wallet
- Check if you've already claimed (one claim per address)
- Verify contract address is correct
- Check wallet has CELO for gas
- Ensure contract has token URIs configured
- Verify contract is on Celo mainnet
- Check contract has minting enabled
- Farcaster Mini Apps Docs: https://miniapps.farcaster.xyz/docs
- Celo Docs: https://docs.celo.org
- Ethers.js Docs: https://docs.ethers.org
- IPFS Docs: https://docs.ipfs.tech
Feel free to fork and customize this app for your own use!
MIT License - feel free to use this code for your projects!
- โ Generate account association signature
- โ Create and upload images
- โ Update NFT URIs with real IPFS hashes
- โ Test in Farcaster Developer Mode
- โ Share your Mini App with the community!
Built with โค๏ธ on Celo blockchain
Need help? Join the Farcaster or Celo Discord communities!