# How We Ensure Fairness

We use a simple algorithm to conduct fair and verifiable raffles. Tickets are generated in a sequential chain, and the winner(s) are selected using the output from a predetermined block hash in the future.

We guarantee that a raffle can be repeated with the same entropy and that the outcome will remain unchanged. As a result, a duplicate raffle drawn at the same block would yield the same result. This design decision was made to ensure that in the event of a technical issue or dispute, the known entries and entropy for the final draw would ensure that the results remain consistent.

### Algorithm

The ticket hash for each entry is calculated using the following algorithm. It's important to note that these ticket hashes are included in all result CSVs.

Where *pi *is the `prize_index`

*pt* is the `prize_title`

* i* is the `entry_index`

*e *is the `entry_address`

.

The result hash is then calculated using the entropy hash from the specified block hash preceding the execution timestamp, or the hash from the specified block if the block height is used.

Where *h *is the block hash and *T *the prior ticket hash.

Once we have a `result_has`

for each entry, we then sort descending and given each entry a `result_index`

.

### Multiple Prizes

Prizes are then awarded to the entries with the lowest index, starting with index 0. This means that the first winner would correspond to the `result_index`

0, and if there were 5 winners, they would correspond to indices 0 through 4.

Last updated