See it working first. The full reference app is live at demo.megapot.io against Base mainnet. Click through buy, claim, and history before you write a line of code.
- Wire one flow: keep your own UI, call the contracts directly. Best when you want buy or claim inside an existing screen.
- Fork the starter kit: a complete five-page React app you rebrand and ship. Fastest path to a full lottery experience.
Earn on every purchase
Weight A: Wire one flow
Keep your own UI. Call the contract that matches your scenario:
Addresses and full signatures for all four are in the Protocol Reference. Each carries a trailing
bytes32 _source and the _referrers / _referralSplit pair.
One representative flow: Jackpot.buyTickets
This is the common case: up to 10 custom tickets, minted immediately. The pattern (read price → approve USDC → call with referrer + source) is the same for the other three methods; only the contract and arguments change.
llms.megapot.io/abi/Jackpot.txt before shipping.
Showing prize info
Read live values rather than hardcoding anything:Jackpot.getDrawingState()→ current prize pool,ticketPrice,ballMax,bonusballMax, plus the livereferralFeeandreferralWinSharerates (1e18 precision).GuaranteedMinimumPayoutCalculator(the PayoutCalculator) → expected per-tier payouts for display.
Claiming winnings
Surface a claim in your UI and callJackpot.claimWinnings(uint256[] _ticketIds) with the user’s winning ticket IDs. For win-detection, auto-compound, and claiming your own referral fees, see Claim winnings & fees.
Don’t re-narrate the whole protocol here. For batch orders, subscriptions, auto-compound, LP, and read-state multicalls, point your editor at llms.megapot.io for AI-ready viem and wagmi recipes, and use the Protocol Reference for addresses and full signatures.
Weight B: Fork the starter kit
Want a complete app, not a single flow? The Megapot Starter Kit is a five-page React + wagmi reference frontend (Home, Play, Tickets, LP, History) implementing every core flow. It’s the exact app running at demo.megapot.io. MIT licensed.VITE_REFERRER_ADDRESS to your wallet and the source tag in config, rebrand, and ship. A dev-mode warning fires while the referrer or source tag is still the placeholder, so you can’t accidentally deploy without attribution.
The kit ships three API-key deployment shapes: anonymous (no key), browser key (VITE_MEGAPOT_API_KEY), or server proxy (key stays server-side). Pick once per fork.
Everything else lives in the repo, don’t look for it here:
- Repository + README: quickstart and the three deploy shapes
- docs/CUSTOMIZE.md: every rebrand seam in one checklist
- docs/ARCHITECTURE.md: API/RPC split, polling cadence, decisions
- Live demo: the running kit on Base mainnet
Building with an AI assistant? Point it at llms.megapot.io and it loads the right skills and recipes itself.
Next
- Start Here: the lay of the land
- Build on the protocol: the deeper integration path
- Referrals & Attribution: how the money and the source tag work
- Protocol Reference: addresses and full method signatures
- Pull data: the read-only Data API
