> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pollyprize.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Randomness & Fairness (Pyth Entropy)

> Ensuring fair and verifiable winner selection.

import { Card } from '@mintlify/components';

Fairness is critical in any raffle. PollyPrize utilizes **Pyth Entropy** to ensure that winners are selected in a truly random, transparent, and tamper-proof manner directly on the blockchain.

## Why On-Chain Randomness?

Traditional raffles often rely on off-chain methods (like website scripts or manual drawings) which can be opaque and potentially manipulated. On-chain randomness provides:

* **Verifiability:** Anyone can audit the process on the blockchain.
* **Tamper-Resistance:** It's extremely difficult for anyone (including raffle organizers or network participants) to influence the random outcome.
* **Trust:** Builds confidence that the winner selection is genuinely random and fair.

## How Pyth Entropy Works (Simplified)

1. **Request:** When a raffle is ready to be resolved, the PollyPrize contract sends a request (along with a fee) to the Pyth Entropy contract on the Abstract network.
2. **Secure Generation:** Pyth Network uses a secure, multi-party commit-reveal scheme involving off-chain providers to generate a strong random number.
3. **Callback:** Once generated, the Pyth Entropy contract calls back to the PollyPrize contract, delivering the random number in a separate, verifiable transaction.
4. **Winner Selection:** The PollyPrize contract uses this verified random number as a seed to run its internal algorithm, which deterministically selects the winning ticket index (or indices) based on the total number of tickets sold.
5. **Processing:** The contract then maps the winning ticket index back to the participant's wallet address and proceeds with finalizing the raffle (recording winners, distributing prizes).

<Card icon="shield-check" title="Provably Fair">
  Using Pyth Entropy ensures that the winner selection process is cryptographically secure and unbiased. You don't have to trust the PollyPrize team to pick a winner fairly – you can trust the math and the decentralized oracle network.
</Card>

This commitment to on-chain randomness ensures a level playing field for all participants in PollyPrize raffles.
