From random bytes to a prize
- Gabox hashes three values with SHA-256: the 32 random bytes, the machine’s address and the draw’s sequence number (
seq, 8 bytes, little-endian). - The first two bytes of the hash, read as a little-endian number, are the ticket: a number from 0 to 65,535.
- The rows own consecutive ranges of tickets, in table order. The ticket falls into exactly one row.
- The prize is
min(floor(pack coins × multiplier / 10,000), free coins + pack coins). The free coins here are the smaller of the free coins at purchase and the free coins when the draw settles.
seq, and it never repeats. A callback must carry the same seq as the draw, so a random value can only settle the draw that asked for it.
Verify your pack
- Find the
PackBoughtV2event of your purchase. It records the draw,seq, your pack coins (tokens_bought), the free coins snapshot and the prize offer. - Find the
DrawResolvedevent of that draw. It records the 32 random bytes, the row, the amount, and thetimed_outandpaidflags. - Recompute the ticket and the row with the steps above, and compare them with the event. The amount is the row’s prize, or less because of the cap. It is never more than the prize offer in
PackBoughtV2, and a win never pays less than your pack coins. - While the draw account is open, it holds the free coins the draw settled against. With them, the steps above, or the SDK’s
settle(...)function, give the exact amount.
timed_out is true, no randomness was used: the draw paid its smallest row. If paid is false, the result is fixed but still needs a claim.
The program checks that the callback comes from MagicBlock’s authority for this program and carries the right seq. It relies on MagicBlock to generate the bytes fairly and to deliver them. See trust boundaries.