# 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="https://3364018093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTP1CBEbwTzCoyWl9J8MH%2Fuploads%2FBufIYAbZEDM09A7GgBT3%2Fyolo%20img3.PNG?alt=media&#x26;token=469f8c68-41e7-4e74-933c-a71b6b6fda42" alt="" width="563"><figcaption><p>YOLO Buy example</p></figcaption></figure>

<figure><img src="https://3364018093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTP1CBEbwTzCoyWl9J8MH%2Fuploads%2FaX0hKybDE75ekS3Shzb1%2Fyolo%20img4.PNG?alt=media&#x26;token=f93e3325-6840-4daf-b55c-90bbb083c17e" 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="https://3364018093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTP1CBEbwTzCoyWl9J8MH%2Fuploads%2FHHyTN4fgIITkj7SDSA1z%2Fyolo%20img5.PNG?alt=media&#x26;token=3fa913a0-bfa1-4b55-91e2-2066bae202c2" 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 %}
