> For the complete documentation index, see [llms.txt](https://docs.tramplin.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tramplin.io/fairness-and-transparency.md). Agents can also search and read this documentation through its [MCP server](https://docs.tramplin.io/~gitbook/mcp).

# Fairness and Transparency

Tramplin is designed so that **no single party** - not the team, not the oracle, not any participant - can predict or manipulate distribution outcomes. This page explains the cryptographic mechanisms that guarantee fairness.

## The Trust Problem

In any redistribution system, three critical questions must be answered:

1. **Can the operator rig the results?** - Can whoever runs the protocol choose or influence the selected recipients?
2. **Can participants verify the results?** - Can anyone independently confirm the selection was fair?
3. **Can the participant set be manipulated?** - Can someone be added or removed after the round starts?

Tramplin answers all three through a combination of **commit-reveal cryptography**, **verifiable random functions (VRF)**, and **Merkle proofs**.

## Commit-Reveal Scheme

The core anti-manipulation mechanism. In each distribution round the secret is committed and revealed in separate onchain transactions, with the VRF request in between, and the 7 recipients are then proposed and verified onchain:

### Phase 1: Commit (`draw` instruction)

Before any randomness is generated, the Dealer publishes:

* **`secret_hash`** = `keccak256(secret)` - a commitment to a secret value
* **`seed`** = `keccak256(merkle_root || secret)` - binds the secret to the current participant set

These values are recorded onchain and visible to everyone. At this point:

* The Dealer knows the secret but doesn't know the VRF output
* The Oracle doesn't know the secret
* Nobody can predict the final randomness

### Phase 2: Reveal (`reveal` instruction)

After the ORAO VRF delivers randomness, the Dealer reveals the original secret. The smart contract verifies:

```
keccak256(secret) == secret_hash           ✓ Secret matches commitment
keccak256(merkle_root || secret) == seed   ✓ Seed is correctly derived
```

If either check fails, the transaction is rejected. The Dealer **cannot change the secret** after seeing the VRF output because the commitment was already published onchain.

### Phase 3: Recipient Proposals (`propose_winner` instruction)

After the reveal, the Dealer proposes the 7 recipients onchain one by one. For each proposal, the smart contract replays the KISS PRNG from the stored seed and accepts only the `winner_id` it produces, together with a Merkle proof that is checked against the snapshot's `merkle_root`. The Dealer cannot substitute a different recipient or a participant who is not in the snapshot.

### Why This Works

| Threat                                           | Prevention                                                                                                                 |
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| Dealer picks a favorable secret after seeing VRF | Impossible - secret\_hash is committed before VRF request                                                                  |
| Dealer tries multiple secrets                    | Each secret produces a different seed, which produces different VRF output. The committed seed is fixed.                   |
| Oracle colludes with Dealer                      | Oracle doesn't know the secret. Even with known VRF output, the final randomness depends on XOR with the unknown secret.   |
| Dealer proposes a different recipient            | Rejected - the contract replays the KISS PRNG and verifies the Merkle proof against the committed root for every proposal. |

## Verifiable Random Function (ORAO VRF)

Tramplin uses [ORAO Network](https://orao.network)'s onchain VRF for randomness generation.

### What is VRF?

A Verifiable Random Function produces a random output that is:

* **Deterministic** - given the same seed, the same output is always produced
* **Unpredictable** - without the VRF private key, the output cannot be predicted
* **Verifiable** - anyone can verify the output was correctly computed for the given seed

### How Tramplin Uses VRF

1. The `draw` instruction sends a `seed` to ORAO's VRF program
2. ORAO's off-chain fulfillment network computes the randomness using their private key
3. The 64-byte randomness is written to a Solana account that anyone can read
4. The `reveal` instruction reads this randomness and combines it with the dealer's secret

### Final Randomness Construction

The final randomness is not the raw VRF output. It is computed as:

```
final_randomness[i] = VRF_lower_32[i] XOR VRF_upper_32[i] XOR secret[i]
```

This three-way XOR ensures:

* **The Dealer alone** cannot determine the result (VRF output is unknown at commit time)
* **The Oracle alone** cannot determine the result (secret is unknown)
* **Even if they collude**, the committed seed constrains the VRF output, and the committed secret\_hash constrains the secret

## Recipient Selection Algorithm

After computing final randomness, the smart contract selects recipients deterministically. The Epoch Distribution selects 7 unique recipients per epoch, weighted linearly by effective stake.

### Epoch Distribution (Linear Effective Stake)

Effective stake incorporates both raw SOL and the boost from Tramplin Points:

```
effective_stake = stake × min(1 + √(points / stake / K), MAX_BOOST)
```

Where `MAX_BOOST = 5x` and `K = 150`.

Each participant occupies a range in the cumulative effective-stake space proportional to their effective stake:

```
Participant A: effective_stake=100 → occupies positions [0, 99]
Participant B: effective_stake=250 → occupies positions [100, 349]
Participant C: effective_stake=50  → occupies positions [350, 399]
```

The selection uses the **KISS** (Keep It Simple, Stupid) pseudo-random number generator seeded from the final randomness:

```
KISS seeds: 4 × u32 derived from XOR-compressed final randomness
For each of the 7 recipients:
    recipient_id = KISS.next_u64() % total_effective_stake
    (if collision with an already-selected recipient, increment and retry)
```

Recipients are selected without replacement - each recipient is unique within a single Epoch Distribution. Recipients are stored in sorted order. The algorithm is deterministic - anyone with the same inputs will produce the same results.

The 7 recipients are proposed onchain one by one (`propose_winner`), and each proposal is verified by the contract against the snapshot's Merkle root. The epoch pool is shared in the order of selection:

| Order of Selection | Share of the Epoch Pool |
| ------------------ | ----------------------- |
| 1st                | 61.5%                   |
| 2nd                | 18.5%                   |
| 3rd                | 6.2%                    |
| 4th                | 6.1%                    |
| 5th                | 3.1%                    |
| 6th                | 3.1%                    |
| 7th                | 1.5%                    |

These shares are stored onchain as `epoch_prize_shares_bps` = 6150, 1850, 620, 610, 310, 310, 150 (basis points).

### Earlier Distribution Types

Until October 2026 Tramplin also ran the Regular Distribution (one recipient per round, equal chance for every staker) and the Big Distribution (one recipient, weighted by the square root of stake). Both have ended; their past rewards remain claimable on the earlier main program `3NJyzGWjSHP4hZvsqakodi7jAtbufwd52vn1ek6EzQ35`, with no expiry.

## Merkle Proofs: Verifying Participation

### What Are Merkle Proofs?

A Merkle tree is a cryptographic data structure that allows compact verification of set membership. The tree's root hash (32 bytes) is committed onchain. Anyone can prove their inclusion in the set by providing a short proof (a few hashes) without revealing the entire set.

### How Tramplin Uses Merkle Trees

1. **At the start of each epoch**, the Snapshot Service constructs a Merkle tree of all eligible participants
2. Each leaf contains: `keccak256(stake_id || stake || withdrawer_address)`
3. Leaves are prefixed with `0x00` to prevent [second preimage attacks](https://flawed.net.nz/2018/02/21/attacking-merkle-trees-with-a-second-preimage-attack/)
4. The **Merkle root** is published onchain via `make_snapshot`
5. The **full snapshot** (with all leaves and proofs) is published at `https://snapshots.tramplin.io/{EPOCH}-epoch-TRAMp1Z9EXyWQQNwNjjoNvVksMUHKioVU7ky61yNsEq.json`

### Verification

**Anyone can verify their inclusion:**

1. Download the epoch's snapshot from `snapshots.tramplin.io`
2. Find your wallet address in the `tree_nodes`
3. Use the provided `proof` array to verify against the `merkle_root`
4. Compare the `merkle_root` with what's stored onchain

**The smart contract verifies claims:**

When a selected participant calls `claim`, the contract verifies:

```
verify(proof, merkle_root, hash(0x00 || hash(stake_id || stake || withdrawer)))
```

This proves the participant was legitimately part of the set at the time of the snapshot - they cannot be added after the fact.

### Immutability

Once the Merkle root is committed onchain:

* **Adding a participant** would change the root hash - the snapshot is frozen
* **Removing a participant** would change the root hash - impossible without a new `make_snapshot`
* **The `make_snapshot` instruction** can only be called once per epoch by the authorized operator

## Public Auditability

Every step of the protocol produces publicly verifiable data:

| Data                 | Where to find it                                                                                                       | How to verify                                                          |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| Participant snapshot | `snapshots.tramplin.io/{epoch}-epoch-{vote_account}.json` (vote account `TRAMp1Z9EXyWQQNwNjjoNvVksMUHKioVU7ky61yNsEq`) | Download and rebuild the Merkle tree                                   |
| Reward pool funding  | Treasury `28YkbWtEqw9TpetsFrmtwa6Xb1WgKAkvaVt7gsgimASg` and the epoch pool account of the epoch program                | Follow the deposit and its transfer to the pool in any Solana explorer |
| Merkle root          | onchain `Participants` account                                                                                         | Deserialize the account data                                           |
| Secret hash & seed   | onchain `Draw` account (after commit)                                                                                  | Read from Program Logs or deserialize                                  |
| VRF randomness       | onchain ORAO randomness account                                                                                        | Verify using ORAO's SDK                                                |
| Secret               | onchain (revealed in `reveal` tx)                                                                                      | Check `keccak256(secret) == secret_hash`                               |
| Final randomness     | Computed from VRF + secret                                                                                             | XOR the values yourself                                                |
| Selected recipients  | onchain epoch `Draw` account (after the 7 `propose_winner` calls)                                                      | Re-run the selection algorithm with the same seed                      |
| Claims               | onchain `Claimed` accounts                                                                                             | Query by recipient\_id and epoch                                       |

## Deadlines as Safety Rails

Deadlines prevent timing-based manipulation:

* **`draw_deadline`**: The commit, the reveal and the 7 recipient proposals must complete before this slot (for the Epoch Distribution, the end of the epoch). If the Dealer misses it, the round is skipped - they cannot wait for a favorable moment.
* **Start schedule**: the distribution starts at a round hour derived from the moment the epoch's pool was first funded. If it has not started when 9,000 slots or fewer remain before the deadline (about 32 minutes at the current slot time), it starts immediately. The full rules are in [Complete Distribution Flow](https://docs.tramplin.io/drawing-flow.md).

## Role Separation

No single key controls the entire protocol:

| Role         | Can do                                                              | Cannot do                            |
| ------------ | ------------------------------------------------------------------- | ------------------------------------ |
| **Admin**    | Change config, enable/disable                                       | Conduct rounds, snapshot, claim      |
| **Operator** | Publish snapshots                                                   | Conduct rounds, change config, claim |
| **Dealer**   | Conduct rounds, withdraw funds of rounds that missed their deadline | Change config, publish snapshots     |

Even a compromised Dealer key cannot:

* Alter the participant set (that requires the Operator key)
* Change protocol parameters (that requires the Admin key)
* Predict VRF output (that requires ORAO's private key)
* Bypass the commit-reveal scheme (enforced by the smart contract)
