|
| 1 | +--- |
| 2 | +title: "Receipts" |
| 3 | +description: "Understand Turbo upload receipts for chronology, auditability, and later verification workflows" |
| 4 | +--- |
| 5 | + |
| 6 | +Turbo upload receipts provide a durable record of what was uploaded, who uploaded it, and what upload cost was assessed in Winston Credits (`winc`). They are useful for provenance, compliance, incident response, and operational debugging. |
| 7 | + |
| 8 | +## What Are Turbo Receipts? |
| 9 | + |
| 10 | +A Turbo receipt is a signed upload attestation returned by Turbo upload flows when a data item is successfully accepted and processed. |
| 11 | + |
| 12 | +In practice, receipts help you: |
| 13 | + |
| 14 | +- Link app-level records to immutable data item IDs |
| 15 | +- Track upload ownership and storage cost (`winc`) |
| 16 | +- Keep machine-readable proof metadata for investigations and audits |
| 17 | + |
| 18 | +<Callout type="info"> |
| 19 | + Receipts are proof of Turbo upload acceptance and signed receipt metadata for |
| 20 | + a specific upload event. They are not a full substitute for your own |
| 21 | + retrieval checks, gateway checks, or finality policies. |
| 22 | +</Callout> |
| 23 | + |
| 24 | +## Why Time and Ordering Matter |
| 25 | + |
| 26 | +Receipt timestamps are especially valuable because they let you prove when upload events occurred and how related uploads were ordered. |
| 27 | + |
| 28 | +- A receipt `timestamp` supports evidence of event time in incident and audit workflows. |
| 29 | +- Ordered receipts create chronology across related data items (for example, original item, revision, and derived artifacts). |
| 30 | +- Chronology improves chain-of-custody reconstruction and post-incident analysis. |
| 31 | + |
| 32 | +For production systems, preserving upload order can be as important as preserving data IDs. |
| 33 | + |
| 34 | +## When Receipts Are Created |
| 35 | + |
| 36 | +Turbo receipts are created in three common contexts: |
| 37 | + |
| 38 | +1. Standard SDK uploads: `turbo.upload()` and `turbo.uploadFile()` return upload result payloads that include receipt metadata such as `id`, `owner`, `winc`, `dataCaches`, and `fastFinalityIndexes`. |
| 39 | +2. Multipart uploads: for larger uploads that use chunking, Turbo finalizes the upload and returns a finalized receipt payload when multipart status reaches `FINALIZED`. |
| 40 | +3. x402 uploads: Turbo still returns an upload receipt, and x402 tooling can also provide a separate payment settlement receipt. |
| 41 | + |
| 42 | +Regardless of flow, store receipt timestamps and your own sequence metadata so ordered events can be reconstructed later. |
| 43 | + |
| 44 | +<Callout type="warning"> |
| 45 | + Turbo does not store and retrieve your receipts for you. If you need receipts |
| 46 | + later, persist the exact payload returned by Turbo in your own storage. You |
| 47 | + can also optionally store receipt records on Arweave for long-term archival. |
| 48 | + See [Capturing Receipts in Turbo |
| 49 | + SDK](#capturing-receipts-in-turbo-sdk) for an implementation example. |
| 50 | +</Callout> |
| 51 | + |
| 52 | +## Receipt Anatomy |
| 53 | + |
| 54 | +| Field | Meaning | Notes | |
| 55 | +| ----- | ------- | ----- | |
| 56 | +| `id` | Data item transaction ID | Primary key to join with your app records | |
| 57 | +| `owner` | Normalized address that signed/owns the data item | Useful for audit and policy checks | |
| 58 | +| `winc` | Upload cost measured in Winston Credits | Useful for billing and reporting. See [Paying for Uploads](/build/upload/turbo-credits) for unit and payment context | |
| 59 | +| `dataCaches` | Caches that accepted the data item | Operational visibility for upload path | |
| 60 | +| `fastFinalityIndexes` | Fast finality indexes that accepted the data item | Useful for observability | |
| 61 | +| `timestamp` | Receipt creation time in milliseconds | Core field for chronology, ordering, and evidence of event time | |
| 62 | +| `version` | Receipt schema/version identifier | Determines how verification inputs should be interpreted | |
| 63 | +| `deadlineHeight` | Deadline block height recorded in receipt payload | Useful as additional upload context | |
| 64 | +| `public` | Public key that signed the receipt | Needed to verify signature validity | |
| 65 | +| `signature` | Base64URL receipt signature | Required to verify receipt authenticity | |
| 66 | + |
| 67 | +Some fields vary by upload path and service response shape. Do not assume every SDK return object includes every signed receipt field in all flows. |
| 68 | + |
| 69 | +## Capturing Receipts in Turbo SDK |
| 70 | + |
| 71 | +Capture the upload response as your receipt record and persist it alongside your own object IDs. Below is a simple example, in practice you might chose to store this alongside your existing logs in S3, Sentry or similar: |
| 72 | + |
| 73 | +```typescript |
| 74 | +import fs from "fs"; |
| 75 | +import { TurboFactory } from "@ardrive/turbo-sdk"; |
| 76 | + |
| 77 | +const turbo = TurboFactory.authenticated({ privateKey }); |
| 78 | + |
| 79 | +const receipt = await turbo.uploadFile({ |
| 80 | + fileStreamFactory: () => fs.createReadStream("./report.json"), |
| 81 | + fileSizeFactory: () => fs.statSync("./report.json").size, |
| 82 | + dataItemOpts: { |
| 83 | + tags: [ |
| 84 | + { name: "Content-Type", value: "application/json" }, |
| 85 | + { name: "App-Name", value: "AnalyticsPipeline-v1.0" }, |
| 86 | + ], |
| 87 | + }, |
| 88 | +}); |
| 89 | + |
| 90 | +await fetch("https://api.yourdomain.com/upload-receipts", { |
| 91 | + method: "POST", |
| 92 | + headers: { "Content-Type": "application/json" }, |
| 93 | + body: JSON.stringify({ |
| 94 | + appObjectId: "report-2026-02-16", |
| 95 | + capturedAt: new Date().toISOString(), |
| 96 | + receipt, |
| 97 | + }), |
| 98 | +}); |
| 99 | + |
| 100 | +console.log("Stored Turbo receipt:", { |
| 101 | + id: receipt.id, |
| 102 | + timestamp: receipt.timestamp, |
| 103 | + owner: receipt.owner, |
| 104 | + winc: receipt.winc, |
| 105 | +}); |
| 106 | +``` |
| 107 | + |
| 108 | +<Callout type="info"> |
| 109 | + Turbo CLI upload commands print JSON output that can be captured as a receipt |
| 110 | + record in scripts and CI pipelines. |
| 111 | +</Callout> |
| 112 | + |
| 113 | +## Why Receipts Matter Across ar.io Use Cases |
| 114 | + |
| 115 | +| AR.IO Use Case | Receipt Value | |
| 116 | +| -------------- | ------------- | |
| 117 | +| [File Storage](https://ar.io/use-cases/file-storage/) | Map internal file objects to immutable upload IDs and timestamped upload events | |
| 118 | +| [Websites & Apps](https://ar.io/use-cases/websites-and-apps/) | Track deployment artifacts and ordering of publish history over time | |
| 119 | +| [Apps & Game Assets](https://ar.io/use-cases/apps-and-game-assets/) | Prove that specific asset versions were accepted and in which sequence they were released | |
| 120 | +| [Media Provenance](https://ar.io/use-cases/media-provenance/) | Establish chain-of-custody metadata for original and derivative media with event ordering | |
| 121 | +| [Verifiable AI Data](https://ar.io/use-cases/verifiable-ai-data/) | Attach signed upload evidence and chronology to datasets, prompts, and model outputs | |
| 122 | +| [Verifiable Computing](https://ar.io/use-cases/verifiable-computing/) | Bind compute inputs/outputs to durable upload receipts for reproducibility and timeline checks | |
| 123 | +| [Durable Financial Data](https://ar.io/use-cases/durable-financial-data/) | Maintain publish-time evidence for disclosures, reports, and compliance records | |
| 124 | + |
| 125 | +## Deep Dive: Media Provenance |
| 126 | + |
| 127 | +Receipts strengthen provenance workflows by giving each media upload a signed event record with a timestamp and ordering context. |
| 128 | + |
| 129 | +- Preserve the receipt for original media ingestion |
| 130 | +- Store receipts for edited or transformed derivatives |
| 131 | +- Link parent and derivative records in your metadata model |
| 132 | +- Use receipt IDs, timestamps, and signed fields as part of publishing audit trails |
| 133 | + |
| 134 | +This gives teams a clearer chain-of-custody model for authenticity claims, moderation workflows, and external verification requests. |
| 135 | + |
| 136 | +## Deep Dive: Verifiable AI Data |
| 137 | + |
| 138 | +AI pipelines benefit from receipts because reproducibility depends on stable, attributable inputs and outputs over time. |
| 139 | + |
| 140 | +- Store receipts for datasets, prompts, and generated artifacts |
| 141 | +- Link receipts to model versions, run IDs, and evaluation jobs |
| 142 | +- Preserve ordered receipt timelines to reconstruct dataset-to-output lineage |
| 143 | +- Use receipts as evidence in regulated or policy-bound AI workflows |
| 144 | + |
| 145 | +This makes lineage more transparent and reduces ambiguity when debugging model behavior or validating published results. |
| 146 | + |
| 147 | +## Verifying Receipts Later |
| 148 | + |
| 149 | +Delayed verification is valuable for audits, disputes, compliance reviews, and reproducibility checks that happen long after initial upload. |
| 150 | + |
| 151 | +### Verification Checklist |
| 152 | + |
| 153 | +1. Load the stored receipt payload. |
| 154 | +2. Validate required fields (`id`, `version`, `public`, `signature`, and contextual fields you depend on). |
| 155 | +3. Verify the signature against the public key using receipt-version-specific hashing/signing rules. |
| 156 | +4. Confirm data item status and availability via Turbo or gateway status endpoints. |
| 157 | +5. Compare verified receipt data with your internal upload metadata and flag mismatches. |
| 158 | + |
| 159 | +Example verification workflow: |
| 160 | + |
| 161 | +```typescript |
| 162 | +type StoredReceipt = { |
| 163 | + id: string; |
| 164 | + version?: string; |
| 165 | + public?: string; |
| 166 | + signature?: string; |
| 167 | + timestamp?: number; |
| 168 | + owner?: string; |
| 169 | +}; |
| 170 | + |
| 171 | +async function verifyStoredReceipt(receipt: StoredReceipt) { |
| 172 | + if (!receipt.id || !receipt.version || !receipt.public || !receipt.signature) { |
| 173 | + throw new Error("Receipt is missing required verification fields."); |
| 174 | + } |
| 175 | + |
| 176 | + // Implement this in your backend with version-aware receipt rules. |
| 177 | + const signatureValid = await verifyReceiptSignatureForVersion(receipt); |
| 178 | + if (!signatureValid) { |
| 179 | + throw new Error(`Invalid receipt signature for ${receipt.id}`); |
| 180 | + } |
| 181 | + |
| 182 | + const statusResponse = await fetch( |
| 183 | + `https://upload.ardrive.io/v1/tx/${receipt.id}/status`, |
| 184 | + ); |
| 185 | + |
| 186 | + if (!statusResponse.ok) { |
| 187 | + throw new Error(`Unable to retrieve status for ${receipt.id}`); |
| 188 | + } |
| 189 | + |
| 190 | + const status = await statusResponse.json(); |
| 191 | + |
| 192 | + return { |
| 193 | + id: receipt.id, |
| 194 | + signatureValid, |
| 195 | + status, |
| 196 | + }; |
| 197 | +} |
| 198 | +``` |
| 199 | + |
| 200 | +<Callout type="warning"> |
| 201 | + Verification inputs are receipt-version dependent. Do not assume every |
| 202 | + response field is signature-bound in every version, and do not assume a |
| 203 | + high-level SDK helper exists unless it is explicitly documented for your |
| 204 | + target version. |
| 205 | +</Callout> |
| 206 | + |
| 207 | +## Best Practices |
| 208 | + |
| 209 | +- Persist raw receipt payloads server-side and keep them immutable |
| 210 | +- Store receipts with your own object IDs, pipeline IDs, and environment metadata |
| 211 | +- Index by data item `id` for fast traceability across systems |
| 212 | +- Preserve upload chronology (for example sequence numbers, parent/child links, and timestamps) |
| 213 | +- Capture both upload receipts and payment receipts when using x402 |
| 214 | +- Re-check status/finality in stricter workflows using service or gateway checks |
| 215 | + |
| 216 | +<Callout type="warning"> |
| 217 | + Treat a receipt as proof of Turbo upload acceptance and signing for that |
| 218 | + event, not as a blanket guarantee for every downstream retrieval state. |
| 219 | +</Callout> |
| 220 | + |
| 221 | +## Next Steps |
| 222 | + |
| 223 | +<Cards> |
| 224 | + <Card href="/build/upload/manifests" title="Manifests" icon={<FolderOpen />}> |
| 225 | + Connect receipt evidence to structured path-based content organization. |
| 226 | + </Card> |
| 227 | + |
| 228 | + <Card href="/build/upload/encryption" title="Data Encryption" icon={<Shield />}> |
| 229 | + Protect sensitive content before uploading to permanent storage. |
| 230 | + </Card> |
| 231 | + |
| 232 | + <Card |
| 233 | + href="/build/upload/x402-uploading-to-turbo" |
| 234 | + title="x402 Uploading To Turbo" |
| 235 | + icon={<CreditCard />} |
| 236 | + > |
| 237 | + Add just-in-time payment flows to your upload pipeline. |
| 238 | + </Card> |
| 239 | + |
| 240 | + <Card |
| 241 | + href="/build/upload/turbo-credits" |
| 242 | + title="Paying for Uploads" |
| 243 | + icon={<CreditCard />} |
| 244 | + > |
| 245 | + Understand Turbo Credits, top ups, and funding workflows. |
| 246 | + </Card> |
| 247 | +</Cards> |
0 commit comments