# SQD Rewards Calculation

Subsquid is a decentralized network optimized to scale data access without compromising reliability, security, or decentralization. It requires a flexible rewards system that adjusts to ensure high network performance without requiring centralized oversight.

Therefore, rewards are calculated based on network usage. A simple example is that the base APR can increase up to 70% in a situation where more worker nodes are required to match the desired network capacity.

**So, how exactly are rewards calculated in Subsquid Network? **

This post breaks down what the different variables in the Subsquid whitepaper mean. After reading it you’ll have a better understanding of why they exist and how your rewards come to be.

**Where do Rewards come from?**

All the rewards for the first three years of bootstrapping the decentralized architecture come from the rewards pool.

Subsquid Labs has allocated 10% of the entire token supply to this initial pool, capping the maximum rewards per epoch to ensure that after three years, 90% of the capital is spent. (reflected in APR_CAP in the calculation)

**What does the reward rate depend on? **

As mentioned above, SQD rewards aren’t fixed but in line with what’s best for the network. They depend broadly on:

- Utilization of the network
- Capacity

Utilization is defined as the target capacity *(the optimal capacity at which every data consumer is able to fill their queries optimally*) minus the actual capacity. For the utilization rate, that is then divided by the target capacity.

From there, the next question is how this factors into the question of the reward rate.

The utilization rate plays a role in calculating the target APR. To break it down daily, we use the minimum of the following two values: base apr calculated based on utilization rate and the upper limit for the APR based on how much is staked.

As total staked, we define all the SQD that is either delegated or bonded.

The APR_CAP is the upper limit mentioned above that ensures that 90% of the rewards pool are spent after three years.

It’s calculated by multiplying the initial pool size by 0.3 (90% in three years) and then dividing this product by the amount of SQD staked.

Let’s say the pool has 1 million SQD and 10 million SQD are staked. In that case, the formula would be (0.3 * 1,000,000)/10,000,000 = 0.03.

We project the base APR to be around 20% when the network is in equilibrium.

One epoch in Subsquid is one day, so the rate per day is rAPR/365. For each epoch, the rate is multiplied by the total_staked to provide the amount that’s unlocked from the rewards pool. (rAPR/365 * (bond + staked))

With the rate calculated, the only remaining piece is the distribution between workers and delegators.

**How are rewards split between workers and delegators? **

Both delegators and workers are crucial in Subsquid, and the rationale behind splitting rewards is that workers should be held accountable; at the same time, stakers should be better off when staking with workers who are delivering high performance.

**Workers **

Workers need to be live and process traffic. They also have stakes delegated (by delegators) to them. Their rewards are calculated after putting their stake and computing contribution in relation to the rest of the network.

The contribution in stake (s[i]) is calculated by dividing their stake through the sum of all others

s[i] = S[i]/sum(S[i])

The contribution in compute is measured in Traffic Units. Their contribution becomes:

T[i] = sqrt(t_scanned[i] * t_e[i])

T_scanned simply describes the number of data chunks the worker has scanned during the epoch, and t_e[i] refers to the response size.

In simple words, t[i] and s[i] just define a single worker node’s overall work.

To incentivize liveness and tenure, rewards for workers are discounted in the following way:

D_liveness is a liveness factor that picks up how online a worker is based on self-reporting as a percentage.

D_tenure is a factor that incentivizes worker nodes to remain online consistently; the higher this one, the better.

The rate r[i] is then used to define the worker and delegator rewards, with b[i] expressing the total amount of bonded SQD and d[i] the SQD that is delegated.

Workers get: r[i] * b[i] + 0.5 * r[i] * s[i]

For simplicity, if the rate is 25% and there are 1 million SQD bonded and 1 million staked workers would earn 500,000.

The delegators receive: 0.5 * r[i] * s[i]

At equilibrium, it’s projected that delegators will receive around 10% rewards on their delegated SQD, while worker nodes earn between 20% ~ 30%.

If you are thinking of delegating your tokens to a worker node, you can see all the worker nodes and the rewards rate they project in the Subsquid network app.