Sui.

Post

Share your knowledge.

Opiiii.
Opiiii1029
Aug 25, 2025
Expert Q&A

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
0
5
Share
Comments
.
Gifted.eth.
Aug 25 2025, 21:26

I hope am clear enough!

Answers

5
VBSK.
Aug 25 2025, 22:02

On 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.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

0
Best Answer
Comments
.

Do you know the answer?

Please log in and share it.