Unified lottery infrastructure on Flare (Data Truth Layer) and Plasma (Money Movement Layer).
Flare Coston2 Testnet (Chain ID: 114)
| Protocol | Usage |
|---|---|
| Secure RNG | Provably fair lottery draws using ~100 independent providers with commit-reveal |
| FDC (Flare Data Connector) | JsonApi attestation of external Web2 lottery results |
| FTSO (Flare Time Series Oracle) | Accurate USD/USDT price feeds for settlement |
See Quick Start below for installation and running instructions.
| Contract | Address | Explorer |
|---|---|---|
| DrawManager | 0xca4e3CE939030BeF9F6f9Ca436a582eB7877fa69 |
View |
| PayoutCalculator | 0xEC69Fe3D890475cb81010FE798f36d2e296fDB87 |
View |
| LotteryRegistry | 0x2051233b0bfb28b9A975a65Ed552d6678f22Ce8C |
View |
| SharedLiquidityPool | 0xf969A46CeA823Da86F5Aa3f945272Aa7D58ca285 |
View |
| MockUSDT | 0x6714F7a8bc580CB9B5FdCf5678Cfad2a4e494022 |
View |
| Contract | Address | Explorer |
|---|---|---|
| LottoEscrow | 0x560DC807d36dCe38BC09bc9fE84d94A34669A3FC |
View |
| Contract | Address |
|---|---|
| RandomNumberV2 | 0x97702e350CaEda540935d92aAf213307e9069784 |
| ContractRegistry | 0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019 |
- Provably Fair Draws — Flare Secure RNG with ~100 independent providers and commit-reveal
- Instant Zero-Fee Payouts — Plasma USDT via EIP-3009 gasless transfers
- External Lottery Attestation — FDC JsonApi for Web2 lottery results
- FTSO Price Feeds — Accurate USD/USDT conversion at settlement
- Shared Liquidity Pool — CaaS model enabling small lotteries to offer big jackpots
lottolink/
├── contracts/ # Solidity (Flare + Plasma)
├── backend/ # Node.js API + services
└── frontend/ # Next.js 14 + Tailwind
- Node.js 18+
- npm or yarn
cd contracts
npm install
npx hardhat compile
npx hardhat run scripts/deploy-flare.ts --network coston2cd backend
cp .env.example .env
# Edit .env with your contract addresses and keys
npm install
npm run devcd frontend
npm install
npm run dev
# Visit http://localhost:3000Copy the .env.example files and fill in your values:
contracts/.env.example→contracts/.envbackend/.env.example→backend/.env
See each .env.example for required variables.
| Network | Chain ID | RPC |
|---|---|---|
| Flare Coston2 | 114 | https://coston2-api.flare.network/ext/C/rpc |
| Plasma Testnet | — | https://testnet-rpc.plasma.to |
- Main Track — Secure RNG + FDC + FTSO
- Bonus Track — FDC JsonApi for external Web2 lottery APIs
Building on Flare:
- Secure RNG integration was straightforward; the
isSecureRandomflag is a useful safety feature - FTSO price feeds are well-documented with clear examples
- FDC workflow has multiple async steps (verifier, FdcHub, DA Layer, verify) — a higher-level SDK would help
- Testnet faucet occasionally slow; mainnet deployment pricing unclear
This project is licensed under the MIT License. See the LICENSE file for details.