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

# YOLO Buy

With YOLO Buy, you can place a non-refundable bid for a fraction of an NFT's listed price for a chance to win that NFT. The more you bid, the better your odds of winning.

<figure><img src="/files/V1e9XOfsI4NdNVYepGZJ" alt="" width="563"><figcaption><p>YOLO Buy example</p></figcaption></figure>

<figure><img src="/files/JsuvoKZXm39kskIH8lYB" alt=""><figcaption><p>All Tensor listings under 500 SOL are automatically eligible for YOLO Buy</p></figcaption></figure>

## YOLO Buy Features

* Each time you play, you earn progress toward a free spin
* Even when you lose, you still win Tensor points based on the size of your bid
* Odds as low as 1% and as high as 75% are available
* The user who listed the NFT earns an extra 1.5% when it's purchased via YOLO Buy
* If you win your YOLO Buy, but the NFT was purchased mid-roll, you win SOL equivalent to the NFT's price

## How Does It Work?

YOLO Buy uses a commit-reveal scheme with a [Verifiable Random Function](https://en.wikipedia.org/wiki/Verifiable_random_function), which means it is verifiably fair on-chain. The underlying math dictates that if you roll with 1% odds, you should win on average once every 100 rolls.&#x20;

<details>

<summary>Advanced</summary>

In the commit phase, a randomness seed is hashed and stored on-chain.&#x20;

In the reveal phase, that seed is used to compute the outcome and compared to the hash.

The exact code from the contract for calculating outcomeU64 is as follows:

```
    let secret_hash = hash(secret).to_bytes();
    require!(secret_hash == roll_state.secret_hash, TRollError::BadHash);

    let mut outcome_message = [0; 112];

    let (secret_bytes, user, user_nonce, roll_count, commit_slot) =
        mut_array_refs![&mut outcome_message, 32, 32, 32, 8, 8];

    *secret_bytes = *secret;
    *user = roll_state.user.to_bytes();
    *user_nonce = roll_state.user_nonce;
    *roll_count = roll_state.roll_count.to_le_bytes();
    *commit_slot = roll_state.commit_slot.to_le_bytes();

    let outcome_hash = hash(&outcome_message).to_bytes();
    let outcome_u64 = *bytemuck::from_bytes::<u64>(&outcome_hash[0..8]);
```

</details>

<figure><img src="/files/OrVtHQTtqjoCVZqP2ZaO" alt=""><figcaption><p>All your YOLO Buys are on-chain and trackable in your 'History' tab</p></figcaption></figure>

{% hint style="danger" %}
YOLO Buy is not available in all regions
{% endhint %}
