# How it works

Each BeatPot round follows a predictable cycle:

#### Active Round (24 Hours)

During the active period:

* Players can purchase tickets
* Up to 1,500 players can participate per round
* Backers can deposit or request withdrawals
* The prize pool grows with each ticket purchase

#### Round Execution

When the round timer ends, anyone can trigger the round execution:

{% stepper %}
{% step %}

#### Execute Round

A transaction is sent to end the current round.
{% endstep %}

{% step %}

#### Request Randomness

The contract requests a random number from Pyth Entropy.
{% endstep %}

{% step %}

#### Callback

Pyth Entropy returns the verifiable random number.
{% endstep %}

{% step %}

#### Winner Selection

The random number determines the winning ticket.
{% endstep %}
{% endstepper %}

#### Settlement

After winner selection:

* Winner can claim their prize&#x20;
* Backers' withdrawal requests are processed
* A new round automatically begins

### Winner Selection

The winner is chosen using verifiable randomness from Pyth Entropy.

{% hint style="info" %}
**How winner selection works**

Think of all tickets as numbered entries in a giant list. If 1,000 tickets are sold:

* Ticket 1-100 might belong to Player A (who bought 100 tickets)
* Ticket 101-150 might belong to Player B (who bought 50 tickets)
* And so on...

The random number points to one specific ticket number. Whoever owns that ticket wins.

This means:

* More tickets = better odds
* Every ticket has an equal chance
* The outcome is completely determined by the random number
  {% endhint %}

### Fee Flow

When tickets are purchased, fees are distributed automatically:

* **\~85%** enters the prize pool (available for winner)
* **\~10%** goes to backers as liquidity provider rewards
* **5%** goes to referrer (if a referral link was used)
* **\~1%** goes to the protocol (portion of backer fee)

### The Backer Vault

The backer vault is the heart of BeatPot's prize system:

* **Deposits**: Backers add WHYPE, receive BPLPT shares
* **Prizes**: Winner payouts come from the vault
* **Fees**: Backer fees flow into the vault
* **House Wins**: When no player wins, entries go to the vault

#### Exchange Rate

The BPLPT share price reflects vault performance:

* **Price increases** when: fees accumulate, house wins occur
* **Price decreases** when: large player wins are paid out

This creates a dynamic system where backers share in both the upside and downside of raffle outcomes.

### Withdrawal Queue

Backer withdrawals use a queue system:

{% stepper %}
{% step %}

#### Request

Backer submits withdrawal request.
{% endstep %}

{% step %}

#### Queue

Request is added to the withdrawal queue.
{% endstep %}

{% step %}

#### Round End

When the current round ends, requests are processed.
{% endstep %}

{% step %}

#### Claim

Backer claims their WHYPE at the final exchange rate.
{% endstep %}
{% endstepper %}

This ensures all backers are treated fairly—no one can exit before knowing the round outcome.

### Timing Considerations

| Event            | When                                   |
| ---------------- | -------------------------------------- |
| Round duration   | 24 hours                               |
| Ticket purchases | Anytime during active round            |
| Round execution  | After timer ends (triggered by anyone) |
| Winner selection | Immediately after randomness callback  |
| Prize claim      | Anytime after selection                |
| Withdrawal claim | After round ends                       |

### What Happens If No One Plays?

If a round ends with zero tickets sold:

* No winner is selected
* No prize is paid
* Backers' positions remain unchanged
* A new round begins


---

# 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://docs.hyperbeat.org/beatpot/how-it-works.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.
