# Provably Fair

Using the end height's `hash` and the `number of tickets` in the round, we can verify that the `winning ticket` is indeed selected deterministically, not randomly or in anyone's favor.

At the end of each round, the following data will be provided:

* end momentum height and its hash
* the number of tickets in the round
* the calculated seed
* the winning ticket

With those variables, anyone can confirm that the winning ticket was sourced correctly.

***

To manually verify the calculation, use the following formula:

1. Convert the momentum hash to decimal -> `seed`
2. Check the following condition: `seed` modulo `number of tickets` == 0
   * If true, then the seed is divided by the number of tickets until that condition is false.
   * The game should never have a winning ticket value of `0`.
3. The winning ticket is the result of: `seed` modulo `number of tickets`
   * There will always be a winner in the ticket range \[1, number of tickets].

***

#### Verification Tools

* <https://www.rapidtables.com/convert/number/hex-to-decimal.html>
* <https://www.calculator.net/big-number-calculator.html>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zenon-raffle.gitbook.io/docs/provably-fair.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
