SuiLotto

A decentralized multi-winner lottery on the Sui blockchain.

SuiLotto

Created At

HackMoney 2026

Project Description

SuiLotto is a decentralized, multi-winner lottery protocol built on the Sui blockchain. Players connect their Sui wallet and purchase tickets by depositing SUI tokens into a shared on-chain prize pool. Each ticket purchase is recorded as a separate entry, and players can buy as many tickets as they want to increase their odds of winning. An admin creates lottery rounds by setting a ticket price and a deadline. While the lottery is active, anyone can buy tickets. Once the deadline passes and there are at least 2 participants, the admin triggers a draw. Winners are selected using Sui's native random module, which provides cryptographically verifiable on-chain randomness that no one, including the admin, can manipulate.

The number of winners scales dynamically based on participation. With 2 to 5 tickets sold, there's 1 winner who takes the entire prize. With 6 to 9 tickets, 2 winners split it evenly. At 10 to 99 tickets, 3 winners share the pool, and at 100 or more tickets, 5 winners each receive an equal share. The same address can win multiple times if it holds multiple tickets, since each ticket is an independent entry in the draw.

98% of the total prize pool goes directly to the winners, split equally among them. The remaining 2% goes to the protocol as an admin fee.

If a lottery round expires without reaching the minimum of 2 participants, there is no draw. Instead, participants can claim a full refund of their SUI directly from the lotteries page.

How it's Made

The smart contract is written in Sui Move, leveraging Sui's object-centric model where each lottery round is a shared object that anyone can interact with permissionlessly. Admin permissions are enforced through an owned AdminCap capability token. The critical piece is winner selection — we use Sui's native sui::random module for on-chain VRF (Verifiable Random Function), which gives us cryptographically provable fairness that no party can manipulate. The draw_winner function is deliberately marked as entry rather than public to prevent composition attacks where a malicious contract could wrap the call and retry until it gets a favorable random outcome.

The frontend is built with Next.js (App Router), React 19, and TypeScript, styled entirely with Tailwind CSS v4. Wallet connectivity is handled through Mysten's @mysten/dapp-kit, which provides React hooks and providers for Sui wallet integration. We use the Slush wallet adapter with WalletProvider's slushWallet config for a branded connection experience. The provider stack layers QueryClientProvider (TanStack React Query) > SuiClientProvider > WalletProvider > LotteryProvider, giving every component access to chain data, wallet state, and lottery context.

background image mobile

Join the mailing list

Get the latest news and updates

SuiLotto | ETHGlobal