> For the complete documentation index, see [llms.txt](https://docs-v4.nftx.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v4.nftx.io/gacha/gacha.md).

# Overview

NFTX Gacha turns an NFT collection's floor liquidity into a game of chance where the depositors are the house — and earn the house edge as yield.

A gacha machine is simple to play: you pay a price, you pull, and a random NFT drops out. NFTX Gacha builds that on top of the same floor liquidity that powers the rest of the protocol — and hands the house's seat to anyone willing to stock the machine.

Two sides meet at a machine:

* **Depositors are the house.** You deposit floor NFTs into a machine and, in return, earn a share of every spin's fee for as long as your stake lives — including after one of your NFTs is won. The house edge (the *vig*) is your yield.
* **Spinners play.** You pay one emergent price per pull and receive a uniformly random NFT from the machine, drawn with verifiable randomness. The price is always the machine's expected value plus the vig, so a pull is priced at **floor value or better**.

{% hint style="warning" %}
**Testnet only — Gacha is not on mainnet yet.** It runs today only as a rehearsal on **Ethereum Sepolia** (chain `11155111`). Treat everything here as a testnet preview, and treat deposited NFTs as prizes — any NFT you deposit can be won by a spinner at roughly floor value. Don't deposit anything you value above its floor.
{% endhint %}

## Why it's built this way

The rest of NFTX already makes a collection's floor objective and liquid: `Locker.redeem` burns exactly one collection token for one floor NFT, with no fee and no randomness, so **one floor NFT is worth exactly 1.0 collection token by construction**, and the collection-token/flETH pool gives that a live ETH price. Gacha leans on that entirely:

* **Payouts are priced, not appraised.** There's no trait committee and no jackpot oracle. A collection's floor *is* its collection-token price, read from the pool's TWAP. The variance a spinner buys is *cross-collection* — drawing the dearer collection is the win; within a collection every unit is the same prize.
* **The house doesn't need capital.** In earlier gacha designs the protocol itself absorbed the variance. Here the depositors do, collectively, in exchange for the vig — so a machine is bootstrapped by yield-seekers, not by a treasury.

The honest flip side of that second point is in the [depositor guide](/gacha/for-depositors.md): the variance a spinner buys is variance the depositors *sell*, and a machine with no fresh deposits eventually drains.

## The shape of a spin

```
Spinner:   ETH  → spin() → snapshot committed → Chainlink VRF → claim() → NFT + change
Depositor: NFT  → deposit() → earns vig on every spin → requestWithdrawal() → NFT back
```

A spin is a two-step, commit-then-reveal flow: the price and the machine's inventory are frozen and hashed at request time, Chainlink VRF returns the random word a few blocks later, and a `claim` hands over the prizes. That split is what makes the draw fair and tamper-resistant — [How it works](/gacha/how-it-works.md) walks through why.

## Start here

<table data-view="cards"><thead><tr><th>Page</th><th></th><th data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>How it works</strong></td><td>Pricing, the draw, and commit/reveal</td><td><a href="/gacha/how-it-works.md">How It Works</a></td></tr><tr><td><strong>For depositors</strong></td><td>Be the house: yield, residuals, and risks</td><td><a href="/gacha/for-depositors.md">For Depositors</a></td></tr><tr><td><strong>For spinners</strong></td><td>Play: spin, resolve, claim, and the odds</td><td><a href="/gacha/for-spinners.md">For Spinners</a></td></tr><tr><td><strong>Run your own machine</strong></td><td>Deploy, curate, and price a machine</td><td><a href="/gacha/run-your-own-machine.md">Run Your Own Machine</a></td></tr><tr><td><strong>Data &#x26; API</strong></td><td>Subgraph entities, endpoints, and how we compute rarity &#x26; APR</td><td><a href="/gacha/data-and-api.md">Data &amp; API</a></td></tr></tbody></table>

## Contracts

Gacha is two contracts — inventory and rewards on one, spinning and randomness on the other — split to fit the EIP-170 code-size limit. Both are documented in the [Contracts](/contracts/contracts.md) section:

<table data-view="cards"><thead><tr><th>Contract</th><th></th><th data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>NFTXGacha</strong></td><td>Spinning, pricing, and VRF</td><td><a href="/contracts/gacha.md">NFTXGacha</a></td></tr><tr><td><strong>NFTXGachaVault</strong></td><td>Custody, deposits, withdrawals, rewards</td><td><a href="/contracts/gacha-vault.md">NFTXGachaVault</a></td></tr></tbody></table>
