# How Pye Works

## The Core Mechanism

Staking rewards are predictable. That predictability has value today — not just at maturity. Pye lets you act on it: sell your future rewards now and receive SOL immediately, while your principal stays staked until it matures.

Pye uses a rewards-splitting mechanism to separate staking capital. When a staker deposits into a Pye [lockup](/resources/glossary.md#lockup), their position is split into two tokens via a new primitive called a Programmable Stake Account (PSA):

* A **Principal Token (PT)** — representing the underlying SOL, redeemable 1:1 at maturity
* A **Reward Token (RT)** — representing all staking rewards generated by that position until maturity

These two tokens are SPLs that can be held, traded, collateralized in DeFi, or sold independently. A staker who wants liquidity today can sell their RT on Pye's orderbook and receive SOL immediately, at a discount. The buyer of that RT receives the staking rewards at maturity.

<figure><img src="/files/V7OJAMPSJbeD81Ve2MG9" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**How are PTs and RTs on Pye different from Pendle?**

Although this splitting design is similar to fixed-reward protocols like Pendle, Pye does not use this mechanism for price discovery on speculative reward values. The primary intention is to allow users to trade principal and rewards independently. Unlike price discovery protocols, PTs on Pye are 1:1 redeemable for SOL and do not accrue fixed rewards.
{% endhint %}

***

## Principal Tokens (PT)

PTs represent the "principal only" side of a staked position. They earn no rewards and trade at a discount to par because they are future assets being priced today. The reason PTs trade at a discount is that the buyer is purchasing a locked version of SOL.

At maturity, every PT redeems 1:1 for SOL regardless of which validator it originated from.

For buyers, purchasing a PT at a discount is equivalent to locking in a fixed return on SOL. The position is straightforward: buy below par today, redeem at par at maturity.

<figure><img src="/files/9pBHPJfflKNEjPkLmKJj" alt=""><figcaption></figcaption></figure>

**Minting PTs**

PTs are minted 1:1 to the number of tokens deposited:

$$N\_{PT} = P \cdot 1$$

Where $$N\_{PT}$$ is the number of principal tokens to mint and `P` is the principal amount in SOL.

**Redeeming PTs**

At maturity, PT token holders can redeem their tokens for the underlying principal pro rata:

$$\text{RedeemPrincipal}(p) = \frac{p}{N\_{PT}} \cdot P$$

Where `p` is the number of PTs the holder redeems, `P` is the total principal backing the pool, and $$N\_{PT}$$ is the total supply of PTs outstanding.\ <br>

**Redeeming PTs**

At maturity, PT token holders can redeem their tokens for the underlying principal pro rata. To calculate the repayment we use:

$$
RedeemPrincipal(p)= \frac{p}{N\_{PT}}​ \cdot P
$$

where:

* $$p$$ is the number of PT the holder redeems,
* $$P$$ is the total principal backing the pool,
* $$N\_{PT}$$​  is the total supply of PTs outstanding.

***

## Reward Tokens (RT)

RTs represent the rewards-only side of a staked position — the right to receive all staking rewards generated until maturity. This includes inflation, MEV, and priority fees where a validator chooses to share them.

RT pricing is based on SOL accrued to date, projected forward on an epoch-by-epoch basis from deposit to maturity. Inflation is the most stable component and forms the baseline. MEV and priority fees are more volatile and can increase an RT's value significantly depending on network conditions and how much a validator shares back to stakers.

For buyers, RTs are a way to gain direct exposure to Solana staking rewards without holding the underlying SOL.

<figure><img src="/files/5M3nJJozLYDZ3FDwg2yG" alt=""><figcaption></figcaption></figure>

**Minting RTs**

To create a functional rewards curve, RTs need to reflect both how much capital is staked and how long it will generate rewards. The protocol achieves this through a continuous, time-weighted minting formula. A single RT is not a fixed unit of SOL. It is a pro-rata claim on the remaining rewards of a specific lockup. Two RTs from different lockups — or even the same lockup at different deposit times — represent different economic exposures. The time-weighted\
minting ensures that every RT holder's claim is proportional to the capital and\
duration they actually committed.

**The Formula**

When you deposit into a lockup, the program calculates your RT allocation based on the fraction of the lockup’s total duration that remains:

$$\text{RTs} = \text{SOL Deposited} \times \frac{\text{Time Remaining}}{\text{Total Lockup Duration}}$$

At issuance (day 1), you receive 1 RT per SOL — the maximum allocation. As the lockup progresses toward maturity, new depositors receive proportionally fewer RTs, because they are entitled to fewer remaining epochs of rewards. This creates a natural pricing mechanism: **earlier commitment = larger rewards claim**.

We can formalize the initial value (backing) to be:

$$
S\_0=P
$$

where:

* $$s\_0$$ is the initial deposit
* $$P$$ is the principal deposit amount in SOL.

At the end of each epoch $$t$$, the stake account grows by the effective staking reward rate $$r\_t$$​. The value after $$t$$ epochs is:

$$
S\_t=S\_{t−1}⋅(1+r\_t),  ;;;;;;;   t=1,2,…,T
$$

After $$T$$ epochs (maturity), the stake account balance is:

$$
S\_T = S\_0 \cdot \prod\_{t=1}^{T} (1 + r\_t)
$$

where:

* $$S\_0​=P$$ = initial deposit
* $$r\_t$$​ already accounts for validator commission, inflation rate, MEV, etc.

The rewards is the difference between the maturity value and the initial deposit:

$$
R = S\_T - P
$$

Therefore:

* PT holders redeem their tokens for exactly $$P$$ units of SOL, independent of reward.
* RT holders redeem their tokens for the residual rewards $$R$$, distributed pro rata to the number of RT tokens they hold.

**Why Time-Weighting Matters**

Consider a 12-month lockup. A depositor on day 1 is entitled to a full year of staking rewards. A depositor at the 9-month mark is only entitled to the final 3 months. Minting the same number of RTs to both would dilute the early depositor's claim. The time-weighted formula prevents this — each RT always represents an equal share of the lockup's remaining production.

**Example: Same deposit amount, different lockup durations (deposited at issuance)**

| Deposit Timing | Time Remaining | Fraction | PTs Minted | RTs Minted |
| -------------- | -------------- | -------- | ---------- | ---------- |
| At issuance    | 12 months      | 100%     | 10 PT      | 10 RT      |
| 3 months in    | 9 months       | 75%      | 10 PT      | 7.5 RT     |
| 6 months in    | 6 months       | 50%      | 10 PT      | 5 RT       |
| 9 months in    | 3 months       | 25%      | 10 PT      | 2.5 RT     |

**Example: RT value at maturity by lockup duration (assuming \~7% APY)**

| SOL Deposited | Lockup Duration | PTs Minted | RTs Minted | RT Value at Maturity |
| ------------- | --------------- | ---------- | ---------- | -------------------- |
| 1 SOL         | 3 months        | 1 PT       | 1 RT       | 0.018 SOL            |
| 10 SOL        | 6 months        | 10 PT      | 10 RT      | 0.035 SOL            |
| 10 SOL        | 12 months       | 10 PT      | 10 RT      | 0.070 SOL            |
| 100 SOL       | 12 months       | 100 PT     | 100 RT     | 0.070 SOL            |

*Illustrative example assuming \~7% APY. Actual value depends on validator performance and commissions.*

{% hint style="info" %}
When depositing at issuance, the lockup duration doesn't change the RT count — you always get 1 RT per SOL. What changes is what each RT is worth. An RT on a 12-month lockup represents a claim on 12 months of validator production, while an RT on a 3-month lockup represents only 3 months.
{% endhint %}

***

## Fixed Maturities

All markets on Pye settle at fixed quarterly maturities aligned to end-of-quarter dates. Every validator market on the platform shares the same quarterly maturity schedule by default.

Shared maturities mean liquidity concentrates rather than fragments across arbitrary timeframes. It also means buyers can set universal orders across every market on the platform simultaneously — a single order that fills against any validator offering a matching discount rate.

At maturity, PTs and RTs are redeemable for SOL.

<figure><img src="/files/Vlq6fZ1qVSFYwW9dgJ3T" alt=""><figcaption></figcaption></figure>

***

## The Exchange

All Principal Token and Reward Token transactions match and settle on Pye's on-chain orderbook. There are two order types available:

* **Limit orders** — orders placed against a specific validator market at a target discount rate. Fills when a matching seller appears.
* **Market orders** — fills immediately at the best available rate in a given market.


---

# 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.pye.fi/how-pye-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.
