# Receipts

### Receipts

A **receipt** is a cryptographic thumbprint of a completed REE execution. It chains together hashes of the inputs (model, prompt, configuration) and outputs (generated tokens) so that anyone can verify whether a claimed result is consistent with the claimed inputs without needing to re-execute the computation.

After every successful run, the TUI displays the path to the receipt file. Receipts are designed to be shared with others, who can then use them to verify that they can reproduce the same output using REE.&#x20;

{% hint style="info" %}
We recommend sharing receipts alongside any claims about model behavior, so that others can verify those claims for themselves.
{% endhint %}

#### What You’re Actually Verifying

REE guarantees reproducibility of *computation*, not the correctness of *inputs* or the correctness of the *outputs.*

A receipt proves that a given model produced a given output from a given prompt. It does not verify that the information in the prompt is accurate or that any action was taken based on the output.

#### What a Receipt Contains

| Field             | Type   | Description                                                                                                                   |
| ----------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `model_name`      | string | Hugging Face model ID used for inference.                                                                                     |
| `commit_hash`     | string | Specific Hugging Face model revision (git commit hash).                                                                       |
| `config_hash`     | string | Hash of the full task configuration (`config.json`).                                                                          |
| `prompt`          | string | The raw prompt text that was provided.                                                                                        |
| `prompt_hash`     | string | Hash of the prompt.                                                                                                           |
| `parameters`      | object | Sampling and generation parameters used (temperature, top\_k, top\_p, etc.).                                                  |
| `parameters_hash` | string | Hash of the parameters object.                                                                                                |
| `tokens_hash`     | string | Hash of the generated output tokens.                                                                                          |
| `token_count`     | int    | Number of tokens generated.                                                                                                   |
| `finish_reason`   | string | Why generation stopped: `"eos_token"` (model produced end-of-sequence naturally) or `"max_length"` (hit the max token limit). |
| `text_output`     | string | The decoded text output of the generation.                                                                                    |
| `device_type`     | string | Device used for inference (e.g., `cpu`, `cuda`).                                                                              |
| `device_name`     | string | Specific device identifier.                                                                                                   |
| `receipt_hash`    | string | Hash over `commit_hash`, `config_hash`, `prompt_hash`, `parameters_hash`, and `tokens_hash`.                                  |
| `version`         | string | The receipt schema version.                                                                                                   |
| `ree_version`     | string | The version of the REE SDK that generated the receipt.                                                                        |

#### What a Receipt Does NOT Contain

A receipt does not include the model weights themselves, intermediate compilation artifacts, or timing/performance data.&#x20;

It is a proof of *what* was computed and *what* was produced, not how fast or on which exact machine, though the receipt does include both `device_type` and `device_name` (for example, "NVIDIA A100") as informational metadata. Neither of these are part of the `receipt_hash`.

### Validating a Receipt

Validation recomputes hashes from the data stored within the receipt itself and compares them against the hash values in the receipt. This checks internal consistency, that the receipt hasn't been tampered with or corrupted, *not* that it matches anything on disk.

A valid receipt must satisfy all of the following:

* `prompt_hash` matches a recomputed hash of the prompt
* `parameters_hash` matches a recomputed hash of the parameters
* `receipt_hash` matches a recomputed hash over all receipt fields

To validate a receipt. i.e., to check that all its hashes are internally consistent, switch the **Subcommand** field to `validate` and provide the path to a receipt JSON file saved locally on your device.

This would be either:

* A receipt you generated yourself
* or, a JSON file you create with the contents of someone else's receipt (e.g., by copying the JSON from someone else's receipt and saving it as a local file)

### Verifying a Receipt

Validation checks that a receipt is well-formed, but it *doesn't* prove the result is reproducible. To do that, use `verify`.

Switch the **Subcommand** to `verify` and paste the receipt path into the **Receipt Path** field, then press `r` to run.&#x20;

REE will re-execute the full inference pipeline described in the receipt using the same *model, prompt* and *parameters* and compare the output against what the receipt claims. If the outputs match, the receipt is verified.

{% hint style="success" %}
This is the check you'd use when someone sends you a receipt and you want to independently confirm the result on your own hardware.
{% endhint %}
