Skip to content
Testnet
How it works

How the draw works.

A raffle is only worth entering if its draw is hard to steer. Here is how this one is built, and where its limits are, without the cryptography.

The problem with picking a winner

Somebody has to produce a random number. If the person running the raffle produces it, they can pick their own ticket. If the software produces it, whoever runs the software can. Many on-chain raffles ask the blockchain for a random number and trust that it was not tampered with.

That trust is doing a lot of work. On Rialo the chain will hand a program a random number quite happily, but it comes with no proof of where it came from. If whoever produces the block can influence that number, they can quietly try again until the outcome suits them.

The idea: everybody brings a piece

Instead of asking one party for the randomness, the raffle collects a secret piece from every person who buys a ticket and combines them all at the end, together with a number from the chain. Each piece is chosen before anyone can see the others, so choosing your own piece cannot aim the result.

The trick is that the pieces have to stay secret while the sale is open, or the last person to buy could choose theirs to win. So it happens in two moves.

Move one: lock it in without showing it

When you buy a ticket, your browser makes up a secret number and sends only its fingerprint, in a transaction your wallet signs. A fingerprint cannot be run backwards, so your secret stays yours, but it also cannot be changed later without the mismatch being obvious.

Think of it as sealing a guess in an envelope and handing the envelope over. Everyone can see you committed to something. Nobody can see what. Your browser keeps the secret in its own storage, so the reveal has to come from the same browser. Along with the ticket price you pay a small reveal bond, which comes back when you reveal.

Move two: open the envelopes

When the sale closes, at its deadline or the moment the last ticket sells, each holder publishes the secret they were holding. The program checks it against the fingerprint already recorded and rejects it if they do not match. Revealing pays your bond back on the spot.

The clock is bounded at both ends. A sale can run for at most 31 days, and the reveal window after it lasts between one minute and seven days, fixed when the raffle is made. The ceiling means one silent ticket cannot hold everyone’s money for months; the floor means a creator cannot close reveals before anyone else has had a chance to reveal.

Note

This is the one step that needs you. If you never reveal, your secret does not go into the draw and your bond stays behind and joins the prize pool. The bond is small, a fixed amount the raffle’s creator sets, so it discourages going quiet rather than ruling it out. If nobody reveals at all there is nothing to draw from: the raffle is void and everyone gets everything back, bonds included.

The draw

The draw happens by itself. When a raffle is deployed, the same transaction asks Rialo’s Subscriber program to send the draw five seconds after the reveal window closes, and Rialo does, in the creator’s name, with nobody pressing anything. The creator pays for that: a deposit of about 0.0028 RLO, which they take back on the raffle page after the draw, and a fee of 0.000005 RLO when Rialo sends it.

It can also happen sooner. Once every sold ticket is revealed the raffle is ready, and anyone can press Draw: the person who made the raffle, a ticket holder or a passer-by. Either way, the program combines every revealed secret with a number the chain gives it at that moment, and that decides the winning tickets.

If Rialo refuses a raffle’s schedule, the raffle is deployed without one, and its draw is a button anyone can press once the reveal window closes. The button also comes back on any raffle whose scheduled draw does not arrive, because Rialo does not send it twice.

Draw has to travel alone, in a transaction with nothing else in it, and it is refused in the same block as the latest reveal; one block later it goes through. Both rules stop the person pressing it from seeing the result first and backing out until they like it. The draw Rialo sends is that same Draw, alone, so the same rules hold for it.

Winners collect with Claim, which can only pay the address on the winning ticket. Because every ingredient is public afterwards, you can redo the arithmetic yourself. On a live raffle the page does it in your browser from the chain’s own data and says whether the recorded winners match, a check that would fail if they did not.

What this does not promise

The draw is randomized and checkable. It is not a guarantee that nobody influenced it, and there are two ways someone could.

The first is whoever produces the block the draw lands in. The chain’s number is read after every secret is public, so if that party can influence the number, they can try values until one suits them. They need no ticket to do it. Rialo gives no proof of where the number comes from, so this limit is real and the program cannot remove it.

The second is a holder who withholds. Someone who has seen the other secrets can decide not to reveal theirs, which changes the result. It costs them their bond, and they are guessing, because the chain’s number is not known until the draw.

Checking a draw shows that the winners follow from the published secrets and the chain’s number. It cannot show that the chain’s number itself was fair. The details are in Docs.

Two more things are true. The deployer can still upgrade the program during the testnet period, so what is described here is the code deployed now, and an upgrade could change it. And each raffle account keeps its rent reserve after every claim is paid, about 0.0035 RLO for a raffle of 2 tickets and more for a bigger one; that reserve is not part of any prize or refund.

Live raffles and samples

Live raffles are the ones the Raffles page reads from the chain; each opens at its own address. The five sample raffles, numbered 1 to 5, are fixed demonstration data and are not on chain. Their clock starts at 30 July 2026 and runs from there, and nothing pressed on them is signed or sent. On a sample, recomputing the draw re-runs the same code that made the record, so it shows the method and cannot fail.

Getting started

Everything here runs on Rialo testnet. The coins have no value, the wallet is a burner key kept in this browser, and testnet can be reset, which would erase every raffle on it.

  • Connect a wallet from the header. It creates a testnet key in this browser.
  • Take testnet RLO from the faucet. It gives at most 1 RLO at a time, and only so often from one network.
  • Deploy a raffle, or buy a ticket on a live one. Your secret is saved in this browser before the purchase is sent.
  • After the sale closes, reveal from the same browser. Your bond comes back at once.
  • Five seconds after reveals close, Rialo sends the draw by itself; once every ticket is revealed, anyone can press Draw sooner. If you won, Claim pays you.