Consumer guide

A consumer reads a DCG result and decides whether it belongs to its request. A consumer does not need to run the executor or join a challenge.

This guide follows DCG unified document format v1, specification revision 7. It is a mainnet alpha. The program addresses are in the quickstart.

1. Find the result account

Retained DCG results are DCR2 v5 accounts. Each address is derived from the document descriptor:

DCR2 = PDA("dcg-hcl-result", descriptor)

If a Tier C request allows several executors, each executor has a different descriptor and DCR2 account. The request or Tier C bind policy chooses which bound result to fulfil.

Do not use a transaction index, display label, or executor-provided URL as the result identity.

2. Check the account

Before decoding, verify:

336 + output_count × output_width + ceil(output_count / 8)

A DCRZ tombstone is not a result. Reject it even though it retains the descriptor, executor, and retention timestamps.

A closed document drains DCM2, DPR2, and DFS2. It does not immediately drain DCR2. A consumer should normally read only DCR2 after close, until tag 185 replaces it with DCRZ.

3. Check the request binding

Recompute the Tier C TRQ1 block from the request policy:

consumer_digest = SHA256("basanos/tierc-request/2" || TRQ1)

Then compare:

DCR2 field Required value
request_id Tier C request account address
consumer_digest Recomputed digest
executor The executor selected by the bind or fulfil policy
output_count Request's max_new_tokens
output_width The tokenizer output format committed by the plan
run_terms The request's DDT2

The descriptor is the hash of the full DPD2 preimage. Recompute it when the consumer has the sealed plan, registry, model anchors, prompt commitment, DDT2, and DRB1. A matching request ID alone is not enough.

If the request is a direct DCG run with no consumer, both request ID and consumer digest are zero. Do not apply the Tier C checks to that record.

4. Check status and time

A consumer may use outputs only when DCR2 status is:

Do not use PENDING or REFUTED.

For FINAL or SETTLED, read these fields:

Field Check
document_closed 0 or 1; both are readable while the account is DCR2 v5.
document_root Nonzero.
finalize_slot Nonzero.
dispute_deadline Nonzero.
open_challenges Read from DCM2 before close, or trust FINAL/SETTLED after close.
outputs_attested Exactly output_count.
attested bitmap Every output bit is set.
retention_start_slot Zero before close, then the CloseDocumentV5 slot.
retention_deadline retention_start_slot + retention_slots after close.

The result may still read PENDING just after a challenger wins. The ruling changes DCM2 at once, but DCR2 changes on the next resolve or close. PENDING is never usable, so this delay is safe.

The application request may have its own deadline. That deadline does not turn a PENDING or REFUTED DCG record into a final result.

5. Read and decode outputs

Read exactly output_count values of output_width bytes each. The attested bitmap records which values DCG proved against landed position roots.

For the current Tier C token plan, output_width is 16 bytes. Each value is:

token_id: i64 little-endian
logit:    i64 little-endian

Check:

Keep the raw bytes with the application receipt. A consumer callback should use the decoded value tied to the exact DCR2 account and request.

6. Use the result

A consumer may:

A consumer must not:

7. Optional permissionless actions

A consumer does not need these actions to read a result. It may help complete or clean up the lifecycle.

Prove a missing output

Tag 177, AttestOutputV5 uses:

The position must already be landed. The proof must reach the DPR2 root at the coordinate derived from the plan.

Resolve the status

Tag 178, ResolveResultV5 uses DCM2 and writable DCR2.

It can write REFUTED after a challenger win. It writes FINAL only when the document passed its deadline, has no open challenge, and has every output attested.

Close the document

Tag 172, CloseDocumentV5 uses:

For a finalized, unrefuted document, every output must be attested. A refuted document may close. Closing starts result retention and returns all working-account lamports and any held executor bond to the executor. DCR2 v5 remains until tag 185 retires it.

Retire the retained result

At or after retention_deadline, anyone may send tag 185, CloseResultV6. It uses any signer, writable DCR2, and the writable executor. It replaces DCR2 v5 with a 96-byte DCRZ tombstone, destroys the outputs and bitmap, and returns every lamport above the tombstone's rent-exempt minimum to the executor. It refuses before the deadline. No scheduler closes the result automatically, and a consumer must reject DCRZ.

Settlement does not change result acceptance. Tag 131 always pays the record bond to the ruling winner. Its built-in route uses seven accounts and, on the first settled challenger win, pays the configured share of the executor-bond pot to the winner and the exact remainder to the incinerator; the loser receives none. A committed nonzero program selects the eleven-account custom route and an exact BSS1 CPI, then must pay the entire escrow. At the custom-settlement deadline, DCG uses the built-in payout as a fallback with the eleven-account list. A mismatch returns 798.

Deadlines

Deadline Consumer action
Tier C request deadline Follow the application request policy. It does not define DCG finality.
DCG challenge deadline Wait for a usable DCR2 status; do not infer finality from elapsed time alone.
Response-round deadlines Watch only if acting as a watcher or challenger. A consumer can wait.
Custom-settlement deadline Relevant only to challenge settlement. The built-in payout is used at or after it.
Result-retention deadline The DCR2 v5 record may be replaced with DCRZ at or after it.

A consumer can read a closed SETTLED DCR2 v5 result until someone calls tag 185. The record is not removed automatically, but a consumer must not assume that it will remain a result indefinitely.

What can go wrong

See the generated reference for exact DCR2 fields, address seeds, tags, events, and errors.