Post
Share your knowledge.
Designing fair lotteries and raffles on Sui??
By using shared objects for ticket pools and randomization techniques like commit-reveal, developers can ensure fairness. Parallel execution must be handled carefully to prevent double-spending or frontrunning exploits.
- Sui
- SDKs and Developer Tools
- Move
I hope am clear enough!
Answers
5On Sui, you can build provably-fair lotteries/raffles by leaning into its object model + consensus ordering. Here’s a compact blueprint with patterns and gotchas.
- Shared pool object
-
A Lottery shared object tracks status, deadlines, pot, commits, entries, and winners.
-
All writes to it are serialized by Sui → no double-spending.
- Ticketing pattern
-
Owned tickets: mint Ticket objects per buyer.
-
Sharded counters: split ticket numbering across shards for parallelism.
-
Always emit events so the entry list is reconstructable.
- Randomness
-
Commit-reveal: players commit hash(salt+data), later reveal; seed = hash(all reveals + checkpoint digest).
-
VRF oracle: on-chain verified VRF proof as seed.
-
Mix in object version/checkpoint digest to resist bias.
- Fairness & security
-
Enforce commit/reveal deadlines.
-
Seal phase: freeze entries, derive seed, draw winners, pay pot.
-
Use rejection sampling or PRF stream to avoid modulo bias.
-
Payments are atomic from escrow pot → no frontrunning.
- Extras
-
Refund if min entries not met.
-
Optional slashing for commit-but-no-reveal.
-
Emit verifiable events + deterministic winner selection so anyone can audit.
In short: use a shared lottery object, scalable ticket accounting, and commit-reveal or VRF randomness tied to checkpoint digests. Seal once, derive seed, pay winners → provably fair & race-free.
Do you know the answer?
Please log in and share it.
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.
- How to Maximize Profit Holding SUI: Sui Staking vs Liquid Staking616
- Why does BCS require exact field order for deserialization when Move structs have named fields?65
- Multiple Source Verification Errors" in Sui Move Module Publications - Automated Error Resolution55
- Sui Move Error - Unable to process transaction No valid gas coins found for the transaction419
- Sui Transaction Failing: Objects Reserved for Another Transaction410