> For the complete documentation index, see [llms.txt](https://ovro.gitbook.io/ovro-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ovro.gitbook.io/ovro-docs/protocol/verify-a-draw.md).

# Verify a draw

Recompute any OVRO winner yourself from public data, step by step.

Every OVRO winner can be recomputed by anyone from public data: the round on the raffle contract, the request on the randomness contract and the public drand beacon. You do not need to trust the website, the team or the automation.

The examples use the explorer's **Read contract** tab and, optionally, [Foundry](https://getfoundry.sh)'s `cast`.

## 1. Read the round

On the [raffle contract](/ovro-docs/security/contracts.md) call `getRound(roundId)`. Note:

* `ticketsSold`
* `randomnessProvider` and `requestId`
* `randomness`, `winningTicket` and `winner`

## 2. Find the committed beacon round

On the randomness provider call `getRequest(requestId)`. It returns the `round` of the drand `evmnet` beacon the draw committed to. That round was in the future when the round closed, so nobody could know its value at that time.

The same round number appears in the provider's `RandomnessRequested` and `RandomnessFulfilled` events.

## 3. Fetch the beacon

```
https://api.drand.sh/v2/beacons/evmnet/rounds/<round>
```

The response contains `signature`: 128 hex characters. The first 64 are `x`, the last 64 are `y`. Other public relays such as `api2.drand.sh`, `api3.drand.sh` and `drand.cloudflare.com` return the same value, because a BLS signature for a round is unique.

## 4. Check the signature

On the randomness provider call `verifyBeacon(round, [x, y])`. It returns `true` only for drand's real signature of that round. This is the same check the contract ran before accepting the draw.

## 5. Recompute the randomness

```
randomness = keccak256(abi.encode(x, y, requestId, raffle, 4663, provider))
```

With `cast`:

```bash
cast keccak $(cast abi-encode "f(uint256,uint256,uint256,address,uint256,address)" 0x<x> 0x<y> <requestId> <raffle> 4663 <provider>)
```

The result must equal `randomness` from step 1.

## 6. Recompute the winning ticket

```
winningTicket = randomness mod ticketsSold
```

Tickets are numbered from `0`. For example, in node: `(BigInt("0x<randomness>") % <ticketsSold>n).toString()`.

## 7. Find the ticket owner

Call `getTicketRanges(roundId, 0, 100)`. Each entry is `{owner, end}` in purchase order; a range covers the tickets from the previous `end` up to `end − 1`. The winner is the owner of the first range whose `end` is greater than `winningTicket`.

It must match `winner` from step 1 and the `WinnerSelected` event.

## What this proves

* The randomness came from drand's beacon for a round fixed before it existed.
* Nobody could substitute a different value: the contract only accepts the unique valid signature.
* The winner follows from public numbers by simple arithmetic.

The remaining trust assumption is the drand League of Entropy itself: a threshold of its independent members must not collude. See [Randomness](/ovro-docs/protocol/randomness.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://ovro.gitbook.io/ovro-docs/protocol/verify-a-draw.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
