# Receipts and proof

How an Abazi receipt is built, signed, chained and anchored on Solana, and the four checks anyone can run on one without an account.

<ShortProductTruth>**Don't trust the log. Check the receipt.** Every payment gets a receipt: canonical JSON, hashed with SHA-256, signed with Ed25519, linked to the organization's previous receipt and anchored on Solana. Anyone with the link can run four checks without an account and without trusting Abazi's database.</ShortProductTruth>

## Who needs it [#who-needs-it]

Owners and finance, who want proof that does not depend on Abazi's word. Auditors and counterparties, who were sent a receipt link. Merchants, whose disputes start from a receipt.

## What a receipt contains [#what-a-receipt-contains]

A receipt is issued for each payment, refund, installment, sweep and revocation. Its body has fixed fields:

| Group | Fields |
| --- | --- |
| Who | Organization, agent, mandate and its version, approval and approver when there was one |
| Decision | ALLOW and the reason code |
| Whom | Merchant name and its trust tier at the time |
| What | Amount, asset, network, rail, payout address, settlement reference, delivery status |
| Order | Issue time, sequence number and the previous receipt's hash |

The agent's stated purpose is not in the receipt.

## How it is built [#how-it-is-built]

<Steps>
  <Step>**Canonical JSON.** The body is serialized with RFC 8785, so the same data always gives the same bytes.</Step>
  <Step>**Hash.** SHA-256 of those bytes.</Step>
  <Step>**Signature.** Ed25519 over the hash, with the active receipt key. The key id is stored with the receipt, and the public keys are published at `/.well-known/uapg-receipt-keys.json`.</Step>
  <Step>**Chain.** Each organization's receipts form one sequence. Each body carries its sequence number and the previous receipt's hash; the first one uses 64 zeros.</Step>
  <Step>**Anchor.** A background task writes the memo `uapg:v1:` followed by the hash to Solana. The anchor is pending until that transaction is finalized.</Step>
</Steps>

## The four checks [#the-four-checks]

<ReceiptVerifier />

| Check | Passes when | Catches |
| --- | --- | --- |
| Hash | The SHA-256 of the canonical body equals the stated hash. | Any change to any field. |
| Signature | The Ed25519 signature over that recomputed hash verifies with the published key. | A body changed and re-hashed by someone without Abazi's key. |
| Chain link | The previous-hash field equals the hash of the receipt before it in the sequence (64 zeros for the first). | A receipt removed or inserted in the middle. |
| On-chain anchor | A finalized Solana memo transaction contains this hash. PENDING until finalized. | A receipt rewritten after it was anchored. |

All four PASS gives PASS. Any FAIL gives FAIL. Otherwise, while the anchor is not final, the result is PENDING.

<Screenshot id="public-verify" />

## Boundary [#boundary]

- **Append-only.** A receipt is never edited. A correction is a new receipt, for example a refund receipt linked to the original. The anchor status is kept apart from the receipt for that reason.
- **Public by link.** Anyone with a receipt's id can open its public check, <ApiOperation id="getPublicReceipt" path />. Ids are unguessable. The public view shows the receipt, its settlement and the paying organization's name, and nothing else from the organization's account.
- **An anchor is a timestamp, not a payment.** A pending or failed anchor does not affect the payment it describes.
- **What a PASS proves.** That this exact body was signed by Abazi's receipt key, sits in the organization's sequence and was anchored on Solana. It does not prove the merchant delivered what was promised; delivery status is a field, and disputes cover the rest.

## Example [#example]

The published receipt key, from <ApiOperation id="listReceiptKeys" path />:

<VerifiedSnippet what="the active Ed25519 receipt key, captured from the Abazi API" exit="0">

```json
{"keys":[{"kid":"rk_2026_11","kty":"OKP","crv":"Ed25519","x":"wJip5rVmdSNAfa3tYwbrkVP-CrFQDjSUE2ZFTKDJwuo","status":"active"}]}
```

</VerifiedSnippet>

The public check of a receipt for an x402 payment on Solana, from <ApiOperation id="getPublicReceipt" path />. Trimmed: hashes, signature, addresses, transaction references, links, the merchant name and the organization name are removed.

<VerifiedSnippet what="all four checks pass and the anchor is finalized, captured from the Abazi API" exit="0">

```json
{
  "result": "PASS",
  "checks": { "hash": "PASS", "signature": "PASS", "chain": "PASS", "anchor": "PASS" },
  "receipt": {
    "receipt_id": "rcpt_01m7gybm28hgtyebv1g9n36dzy",
    "type": "payment",
    "decision": "ALLOW",
    "reason_code": "WITHIN_POLICY",
    "merchant_tier": "VERIFIED",
    "amount_base_units": "50000",
    "asset": "USDC",
    "network": "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
    "rail": "x402",
    "delivery_status": "delivered",
    "seq": 1,
    "prev_hash": "0000000000000000000000000000000000000000000000000000000000000000",
    "kid": "rk_2026_11",
    "anchor": { "status": "finalized" }
  }
}
```

</VerifiedSnippet>

The amount is in base units with six decimals: 50000 is 0.05 USDC. This is the organization's first receipt, so its previous hash is 64 zeros.

## Failure cases [#failure-cases]

| Case | Result |
| --- | --- |
| One character of the body changed | Hash, Signature and Anchor FAIL, because the signature and the on-chain memo are checked against the hash recomputed from the body. Chain link still passes. The result is FAIL. |
| A receipt removed from the middle of the sequence | Chain link FAIL on the receipt after it. |
| The memo transaction is not finalized yet | Anchor PENDING. The result is PENDING. |
| An unknown id | Not found. |

## How to verify [#how-to-verify]

- In a browser: the public check page shows the receipt in readable form, the four checks, a JSON download and a link to the anchor on a Solana explorer.
- On your own: download the JSON, serialize the body with RFC 8785, hash it, verify the signature with the published key, compare the previous hash, and look up the memo. The [verify a receipt](/docs/guides/verify-a-receipt) guide walks through each step.

## Next steps [#next-steps]

<Cards>
  <Card title="Verify a receipt" href="/docs/guides/verify-a-receipt" description="Run the four checks yourself, step by step." />
  <Card title="Proof" href="/docs/products/proof" description="See receipts as a product, with screens and endpoints." />
  <Card title="Disputes and refunds" href="/docs/concepts/disputes-and-refunds" description="See how a refund receipt links back to the original." />
</Cards>

