Skip to content

jhug146/fluffy-engine

Repository files navigation

LottoLink

Unified lottery infrastructure on Flare (Data Truth Layer) and Plasma (Money Movement Layer).


Built on Flare

Network

Flare Coston2 Testnet (Chain ID: 114)

Integrations

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

Setup

See Quick Start below for installation and running instructions.


Smart Contracts

Flare Coston2 (Deployed 2026-02-08)

Contract Address Explorer
DrawManager 0xca4e3CE939030BeF9F6f9Ca436a582eB7877fa69 View
PayoutCalculator 0xEC69Fe3D890475cb81010FE798f36d2e296fDB87 View
LotteryRegistry 0x2051233b0bfb28b9A975a65Ed552d6678f22Ce8C View
SharedLiquidityPool 0xf969A46CeA823Da86F5Aa3f945272Aa7D58ca285 View
MockUSDT 0x6714F7a8bc580CB9B5FdCf5678Cfad2a4e494022 View

Plasma Testnet

Contract Address Explorer
LottoEscrow 0x560DC807d36dCe38BC09bc9fE84d94A34669A3FC View

Flare System Contracts (Reference)

Contract Address
RandomNumberV2 0x97702e350CaEda540935d92aAf213307e9069784
ContractRegistry 0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019

Features

  • 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

Project Structure

lottolink/
├── contracts/         # Solidity (Flare + Plasma)
├── backend/           # Node.js API + services
└── frontend/          # Next.js 14 + Tailwind

Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn

Contracts

cd contracts
npm install
npx hardhat compile
npx hardhat run scripts/deploy-flare.ts --network coston2

Backend

cd backend
cp .env.example .env
# Edit .env with your contract addresses and keys
npm install
npm run dev

Frontend

cd frontend
npm install
npm run dev
# Visit http://localhost:3000

Environment Variables

Copy the .env.example files and fill in your values:

  • contracts/.env.examplecontracts/.env
  • backend/.env.examplebackend/.env

See each .env.example for required variables.


Network Config

Network Chain ID RPC
Flare Coston2 114 https://coston2-api.flare.network/ext/C/rpc
Plasma Testnet https://testnet-rpc.plasma.to

Hackathon Tracks

  • Main Track — Secure RNG + FDC + FTSO
  • Bonus Track — FDC JsonApi for external Web2 lottery APIs

Developer Experience Notes

Building on Flare:

  • Secure RNG integration was straightforward; the isSecureRandom flag 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

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •