A Receipt is a statement of one account’s trading results over a span of Crossings, computed and signed inside the Coprocessor’s enclave under a pseudonym that names no wallet. Anyone checks it against public chain data, at /r or with receipts.verify.
What a Receipt carries#
| Field | What it is |
|---|---|
| Pseudonym | , from the account’s viewing root and the label. One label gives one pseudonym, so Receipts under it build one track record; a fresh label gives a Receipt that stands alone. |
| Label | The name the trader publishes under, up to 512 bytes. |
| Span | The first and last Crossing the claims cover, both included. |
| Ledger root | The root the Commit of Crossing accepted. |
| Claims | The results stated, each kind at most once (next section). |
| Quote asset | The admitted asset every value is counted in. |
| Cost basis | Average cost or first in, first out (FIFO). |
| Holder key | The Ed25519 public key of the seed . Its holder shows the Receipt is theirs to present. |
| Enclave key | The key that signed. |
| Attestation reference | The address of the EnclaveKey account that registers in the Registry. |
| Signed slot | The slot at which the enclave signed. |
| Version and program | Version 1 and the Pool’s program id. |
The signature is Ed25519 under over the prefix privium/receipt/v1 and the Borsh-encoded body. A Commit signs under a different prefix, so neither signature passes as the other. A Receipt link carries the body and signature in base64url after /r# (ReceiptBody).
Claims#
| Claim | Unit | Forms |
|---|---|---|
| Realized PnL | atoms of , signed | exact, or at least |
| Return on capital | basis points, signed | exact, or at least |
| Volume | atoms of | exact, or at least |
| Fill count | fills | exact, or at least |
| Fees paid | atoms of | exact |
| Ending equity | atoms of | exact, or at least |
| Assets traded | mints | the count, with or without the list of mints |
The request names each claim and its form. An exact claim names no value: the enclave computes the figure and writes it into the Receipt it signs. An at-least claim carries the trader’s threshold ; the enclave signs it only when its figure is at or above , and the Receipt carries , never the figure. An assets claim states the assets traded in the span: their count, and the mints when it lists them. A threshold that does not hold refuses the Receipt, with that claim named in the refusal.
How results are computed#
The rules are fixed in the measured enclave code. For every committed Crossing the enclave keeps an accounting frame in its private checkpoint, which is encrypted under the Ledger data key, bound to the last committed root and kept off the public diff (Ledger). A frame holds the mids posted for that Crossing, its deposit credits, each fill’s base and quote amounts and fee, and the Exits its Commit lists. A Receipt replays the account’s frames from Crossing 1 through , so positions and cost basis always run from the account’s first deposit. Realized PnL, volume, fees, the fill count and the assets traded count only Crossings through .
Positions and the value of a fill#
The quote asset is held as cash. Every other asset the account holds is a position with a cost basis in : one running total under average cost, a queue of lots under FIFO.
A fill’s crossed and routed parts are one fill. Its base size is the crossed plus the routed base, and its quote amount the crossed quote, at the mid, plus the routed quote, at the Residual’s executed price. Its value in is
with the mark at that Crossing. Each fill gives one asset and gets the other. Giving an asset other than takes the quantity given out of its position at its cost basis and realizes . Getting an asset other than adds the quantity got at cost . A fill in a pair where neither side is therefore realizes PnL on the asset it spends.
The cost basis of a quantity taken out of a position of units:
- Average cost. for the position’s total cost ; the rest keeps its average. Within one Crossing, the fills that acquire a pair’s traded asset (its base, or its quote asset when the base is ) apply before the fills that dispose of it, then by order id, so a Crossing’s buys enter the average before its sells draw on it.
- FIFO. The quantity leaves the oldest lots first, each at its own cost in proportion to the units taken. A Crossing’s fills apply in the order the engine executed them.
Fees#
A fill’s fee is paid in the pair’s quote asset (Fees). Its value comes off realized PnL and adds to fees paid. When the pair’s quote asset is not , the fee’s units leave that position at their cost basis and realize nothing.
Deposits, Exits and the mark#
- A deposit applies at the start of the Crossing that credits it, before that Crossing’s fills. An asset other than enters its position at its value at that Crossing’s mark, so PnL counts from the moment the asset entered.
- An Exit applies after the fills of the Crossing whose Commit lists it in its exits root (Exit). The quantity leaves its position at cost basis and realizes nothing.
- The mark at a Crossing comes from the mids posted for it: the mid, the inverse of the mid, or, through USDC, the ratio of the two assets’ USDC marks. A value the frame holds no mark for refuses the Receipt.
- Equity at any point is the balance plus every other balance at the Crossing’s mark. Ending equity is the equity after Crossing ‘s Exits.
Volume, fill count and assets#
Volume is over the span’s fills, crossed and routed alike. The fill count is the number of fills, and a fill with both a crossed and a routed part counts once. Assets traded are the mints of each fill’s base asset, or of its quote asset when the base is , listed in byte order.
Return on capital#
The return is time-weighted. Capital opens at the account’s equity at the start of Crossing . Each deposit in the span closes a sub-span just before it is credited, each Exit just after its Crossing’s fills, and the end of Crossing closes the last. With the equity that closes sub-span and the equity it opened with, just after the previous flow,
A sub-span that opens at zero equity contributes a factor of 1, so an account that starts empty takes its first deposit as its capital. A flow changes only the equity the next sub-span opens with, which cancels within that sub-span’s factor, so the return holds whatever the size of the deposits and Exits.
Rounding#
Every intermediate value is an exact ratio of integers. Only the final figures are cut, toward zero: realized PnL, volume, fees and equity to whole atoms of , the return to whole basis points.
Making a Receipt#
The trader sends a receipt Intent carrying the request (span, claims, label, quote mint and cost basis), signed by the account’s auth key and sealed to the enclave’s key like any Intent, so it takes no wallet prompt. The enclave signs once it has checked that:
- the request is well formed: , a label of at most 512 bytes and each claim kind at most once;
- the account’s frames, replayed through the current Crossing, reproduce its committed balances, so the history holds every entry;
- it holds the anchor for , the root and slot of the Commit that accepted that Crossing, and its signing slot is no earlier than that Commit;
- the quote mint is an admitted asset and every mark the replay needs is in its frame;
- every at-least claim’s figure reaches its threshold.
It writes each exact claim’s figure into the Receipt and returns the Receipt in its sealed reply. A refused request comes back as an intake error with no Receipt (POST /v1/intake). No transaction is sent, and nothing about the request reaches the chain.
Verifying at /r#
receipts.verify in the SDK runs four checks with public data and no account of its own, and /r runs the same function in the reader’s browser:
- Decode. The bytes parse as a version 1 Receipt whose paired claims each set exactly one form. Otherwise it is malformed.
- Enclave key. The enclave record the attestation reference names holds , and falls in its validity interval: at or after its first slot and, when the record has an end, before it. Otherwise the key is unknown.
- Signature. verifies under over the prefix and the body. Otherwise the signature is invalid.
- Root. The root record for names Crossing and the Receipt’s program, and its Commit landed no later than . Otherwise the root is not on chain.
With the SDK’s default public data (ReceiptPublicData), both records come from Roots and enclave keys and are pinned to Solana before they count, through the API’s RPC relay. The EnclaveKey account at the address derived from must be owned by the program, registered, and agree on the signing key, HPKE key, measurement, key epoch and validity interval. The root’s Commit transaction must have succeeded at its recorded slot with a commit instruction for directly after an Ed25519 verification of a valid signature over the Commit message naming the program, , and the diff digest.
To show a Receipt is theirs to present, the holder signs a verifier’s fresh nonce with the holder seed, and the verifier checks it under (Presenting a Receipt).
A Receipt that passes states true claims about the entries committed under for the account behind . That rests on what every Commit rests on: Ed25519, the integrity of the enclave whose measurement the Registry records (Attestation and reproducible builds), and the program’s checks on every accepted root. Receipts under different labels carry unrelated pseudonyms and holder keys, since the viewing root stays with the trader and the enclave, so they link to each other only through what their claims say.