> For the complete documentation index, see [llms.txt](https://nkrishang.gitbook.io/pack-protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nkrishang.gitbook.io/pack-protocol/how-pack-protocol-works/reward-distribution.md).

# Reward distribution

$PACK Protocol implements the generic concept of packs filled with rewards, where opening a pack yields a reward contained in that pack.

$PACK Protocol implements this concept for [EVM](https://ethereum.org/en/developers/docs/evm/) based chains, and makes use of [credibly neutral](https://nakamoto.com/credible-neutrality/) building blocks like [Chainlink VRF](https://docs.chain.link/docs/chainlink-vrf/). As a result, the process behind 'who gets what reward on opening a pack' is easily, publicly auditable, ensuring no 'backdoor winners'.

In this section, we explain how rewards are distributed upon opening a pack.

![](/files/-MhUSW7fTt_9xLOsh69n)

### Recap - [creating packs](/pack-protocol/how-pack-protocol-works/packs-and-rewards.md#packs).

A fixed supply of packs is created when someone creates packs with a set of underlying rewards. The total amount of packs created is equal to the sum of the amounts of each kind of reward it contains.&#x20;

For example, if someone creates packs with three underlying rewards - packing an amount 5, 15 and 80 of each - a total of 100 packs are created.

A pack can be opened to retrieve the rewards in that pack. What determines how rare a particular reward is, boils down to how many of those rewards exist in total.

### Rarity of rewards

What determines how rare a particular reward is, boils down to how many of those rewards exist in total. The total amount of a kind of reward that exists across a set of packs determines the % chances of receiving that kind of reward on opening a pack.

For the set of 100 packs with three kinds of rewards - 5, 15 and 80 of each across that set of packs - there's a `5/100` i.e. 5%, 15% and 80% chance, respectively, of receiving that reward on opening a pack. You can find a more detailed version of this example, [here](/pack-protocol/how-pack-protocol-works/overview.md#simple-example).

### How a reward is selected when a pack is opened

We shall extend [this](/pack-protocol/how-pack-protocol-works/overview.md#simple-example) example of a set of 100 packs with three kinds of rewards - 80 **circles**, 15 **squares**, and 5 **stars**.

![](/files/-Mh_Wf5q_q5Qb7U5CfOX)

The supply of the rewards in this set of packs - 80 **circles**, 15 **squares**, and 5 **stars -** can be represented on a number line, from zero to the total supply of packs - in this case, 100.

![](/files/-MhdKy2ismSTKY_ACglW)

Whenever a pack is opened, the protocol uses a new random number in the range of the total supply of packs to determine what reward will be distributed to the pack opener.&#x20;

In our example case, the protocol uses a random number less than 100 to determine whether the pack opener will receive a **circle**, **square** or a **star**. So e.g. if the random number `num` is such that `0 <= num < 5`, the pack opener will receive a **star**. Similarly, if `5 <= num < 20`, the opener will receive a **square**, and if `20 <= num < 100`, the opener will receive a **circle**.

Note that given this design, the opener truly has a 5% chance of receiving a **star**, a 15% chance of receiving a **square**, and an 80% chance of receiving a **circle**.&#x20;

### Sourcing a random number for reward distribution

The protocol uses a new random number each time a pack is opened.&#x20;

For the reward distribution to be fair and solely based on the rarity of rewards, the random number used on the opening of a pack must be 'truly random' - neither manipulable by the pack opener, nor knowable to the opener before opening the pack.

To this end, the protocol uses [Chainlink VRF (Verifiable Random Function)](https://docs.chain.link/docs/chainlink-vrf/) to source random numbers.

{% hint style="info" %}
Chainlink VRF is a random number generator that operates on a request ←→ response model, where a smart contract can request a random number from the Chainlink VRF system in one transaction, and the Chainlink VRF system fulfills that request in a subsequent transaction with a random number.
{% endhint %}

![](/files/-MhdRDCrjtjoi6ED8AWj)

When a pack is opened, the protocol requests Chainlink VRF for a new random number, which then determined which reward is distributed to the pack opener.

Chainlink VRF collects a [fixed fee in $LINK](https://docs.chain.link/docs/vrf-contracts/), for every random number request. $PACK Protocol's smart contracts will be funded with an initial amount of $LINK by the protocol admins, during the protocol's beta phase. The protocol fee collected on pack and reward sales / resales will be used to continue funding the protocol's smart contracts with $LINK, to pay Chainlink VRF fees.
