Skip to content

Check an agent · Reference

verify ledger

verify ledger downloads an agent’s public ledger and its checkpoints, recomputes the hash chain, checks it against the latest checkpoint the runtime signed, and looks up every settled payment on chain.

From a checkout of the repository, where npm run cli -- starts the command line (Verifying):

npm run cli -- verify ledger <agentId>

A desk with no model key takes no work, so its agents’ ledgers stay empty. The example below ran against a development desk on a local fork whose pool agent had done one job and one commissioned run, with a scripted model in place of Claude and every brief taken, as in Rehearse a whole hire. That desk answered on port 8672 and its fork on 8671; a desk from Run a development desk answers on 8642, with its fork on 8641 and a registry address of its own. Lines for the job’s bond, the money the agent collected and the revenue it sent on are cut (…) because their amounts follow from the price.

export SHIPPED_AGENTS_URL=http://127.0.0.1:8672 SHIPPED_AGENTS_RPC=http://127.0.0.1:8671
export SHIPPED_AGENTS_REGISTRY=0x37a08b8F0F977C6DFaAa03FE1866b9367E405c73
npm run cli -- verify ledger 26695 --allow-unattested
Ledger of agent 26695 on chain 4663
Entries 16
Head 0x1860ff7a016373d29064015b867352b1bc8094535729c1bdd13a639afa2f8c89
Checkpoint 16 entries, not attested, made 2026-11-30T09:03:58Z
Agent runtime evidence passed, 2 items not checked
Not checked (2)
-- agent_unchecked Items of the agent's evidence that were not checked: allowed, attested.
-- checkpoint_attested This checkpoint comes from a development runtime and is not attested. Accepted because --allow-unattested was given.
Passed (9)
ok agent_runtime The agent's runtime evidence passed, with 2 items not checked.
ok export Downloaded 16 entries, each in canonical form.
ok chain Every entry follows from the one before it, from entry 0 to entry 15.
ok checkpoint_history Every one of the 2 checkpoints names a head this export has.
ok checkpoint_format Checkpoint over 16 entries.
ok checkpoint_subject It is for agent 26695 on chain 4663.
ok checkpoint_data Its 32 bytes follow from the agent, the entry count and the heads it states.
ok checkpoint_head The latest checkpoint covers 16 entries and its head is the export's head after them.
ok transactions Each of the 6 settled entries matches its transaction on chain.
Settled entries (6)
…
ok #2 earned 250000 0x037eFB361312e63830934F89BFA794D4b7a926E0 0xc2e12e27075f3700f22ccd6829a6281b1465b9a5c402eebb293ac6734a73f5bd
ok #5 commissioned 100000 0x8fAb67a5e9638fAA14F74862C116C517Bd916a23 0xbac52de8d3978320a7aa93a2d2dd6d821f86ac27b4e7fd47cdbc8cb2e89a9960
…
ok #13 commissioned 100000 0x8fAb67a5e9638fAA14F74862C116C517Bd916a23 0xd56d783a965011477995a5675232e4622a479400392a73c1dc1ae5433a267544
Totals of settled purchases, by label (never added together)
earned 0.25 USDG on chain 4663
commissioned 0.2 USDG on chain 4663
NOT FULLY CHECKED: no check failed, and 2 items were not checked: agent_unchecked, checkpoint_attested. Each says above what would check it.

It exited with 3. Each settled entry is listed with its sequence number, its label (or its kind when it has no label), its amount in base units, the payee and the transaction. The totals add settled purchases per label and asset, and never add the two labels together.

  1. The agent’s runtime evidence, through the same checks as verify agent, with the same --registry, --rpc, --pins, --max-age and --allow-unattested.
  2. /agents/<agentId>/ledger.jsonl and /agents/<agentId>/checkpoints.json from --desk, each with a 30-second limit.
  3. The receipt of every settled entry’s transaction, on the chain the entry names: Robinhood Chain through --rpc, any other chain through --chain-rpc <chainId>=<url>, then SA_RPC_URL_<chainId> or SA_CHAINS from your environment, then the public endpoints built in for Base.
  4. The Identity Registry’s MetadataSet events for the agent’s agentWallet, from the checkpoint list’s fromBlock on, only when a payment was sent from a wallet other than the current one. The agent’s earlier wallets count as its own.
  5. Intel’s collateral for the latest checkpoint’s quote.
Line Passes when Fails when
agent_runtime The agent’s evidence had no failed check It failed; run verify agent for why. A checkpoint is worth only what the runtime that signed it is worth
export Both files downloaded, and every line of the export is one entry in canonical JSON A file did not answer, the checkpoint list is malformed, or a line was reformatted or is not JSON. The run stops
chain Every entry recomputes and follows from the one before (below) An entry was edited, removed, reordered or inserted, or is malformed. The run stops
checkpoint_history Every checkpoint ever published names a head the export has after that many entries An entry an earlier checkpoint covered was changed later
checkpoint Appears only as a failure No checkpoint has been published for this ledger
checkpoint_format The latest checkpoint is a ledger checkpoint document It is something else
checkpoint_subject It names this agent id and this chain (the Identity Registry it names is hashed into data but not compared) It is about another agent or chain
checkpoint_data Its 32 bytes follow from the count and heads it states Its numbers were changed
checkpoint_attested Appears only as a failure It comes from a development runtime
checkpoint_quote The quote parses as a TDX quote It does not
checkpoint_report_data The quote’s report data is the checkpoint’s 32 bytes with the deliverable tag The quote was made over other data
checkpoint_attestation The quote is the one in dstack’s attestation It was replaced
checkpoint_rtmr3 dstack’s event log replays to the quote’s RTMR3 The log was edited
checkpoint_compose The signing runtime measured the compose on the agent’s runtime record Other code signed it
checkpoint_app The signing runtime is the app the agent’s evidence names Another deployment signed it
checkpoint_head The export’s head after the checkpoint’s count is the checkpoint’s head The list was changed after it was attested
checkpoint_intel Intel’s collateral accepts the checkpoint’s quote As for intel in verify agent
transactions Every settled entry matches its transaction A transaction is missing, reverted, moves another amount, pays someone else, or was sent by another wallet

transactions matches each settled entry with a transfer in its transaction’s receipt: an ERC-20 Transfer log of the entry’s asset, for exactly the amount, to the payee, from an allowed sender; for ETH, the transaction’s own value and recipient. The allowed sender is the agent’s current or an earlier wallet, the card wallet the entry names in via, or anyone for a float entry, which records money the agent received. Each transfer log counts for one entry only.

These items are listed as not checked, and never count as passed:

Item Meaning
agent_unchecked What verify agent left unchecked, such as pins you did not give
checkpoint_attested With --allow-unattested: the checkpoint comes from a development runtime
unattested_tail Entries after the latest checkpoint, which the next checkpoint will cover
pending Payments with no outcome yet, so no transaction to check
other_chains Settled entries on a chain you gave no endpoint for
checkpoint_compose The agent has no current runtime record to compare with
checkpoint_app The agent’s evidence names no app id
checkpoint_intel Intel’s collateral could not be fetched

When an entry pays from the desk’s card wallet, the report adds a warning: that wallet is one the desk publishes as its own. The exit codes and --json work as for every verify command (Verifying); the JSON adds entries, head, checkpoint, agent, payments, totals and settled.

An agent’s private ledger holds the purpose of every payment in free text and the task it was for, which can carry a client’s data. It never leaves the enclave. The public ledger is derived from it entry for entry, with the same seq and time, and forms its own hash chain (src/checkpoints.ts).

The export is UTF-8, one entry per line in canonical JSON, each line ending in a newline. Three lines from the example, a payment and its two outcomes:

curl -s $DESK/agents/26695/ledger.jsonl | sed -n 3,5p
{"agentId":"26695","amount":"250000","asset":"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","at":1796029372,"card":false,"chainId":4663,"client":"0xa39AD6Cb4c4A326a5ffCE19Da57866a240DEE9B2","hash":"0x2a53ea4a05d79b16d03893a8798515500328a43fffe40ad84cf463bd41257959","kind":"payment","label":"earned","payee":"0x037eFB361312e63830934F89BFA794D4b7a926E0","prev":"0x181b6d1fb248e409636e604314b6155816ef1bc5bf93c4ba4b1035857fd671b3","product":null,"purpose":"0x8648eef72d33a010cd0ac65e7c887509903c456f81e08f5041d5e9db1b5fd9e7","scope":"0x9fae3fe78d5bef146d7ce0ebaebba0771b9544b3fe5556d150cbf0b2706368e6","seq":2,"type":"authorized","via":null}
{"agentId":"26695","at":1796029372,"hash":"0xfe91fcf268317b539e98cdee5d7b9a94e29094464a3d31d1385f1357a55af598","prev":"0x2a53ea4a05d79b16d03893a8798515500328a43fffe40ad84cf463bd41257959","ref":2,"seq":3,"tx":"0xc2e12e27075f3700f22ccd6829a6281b1465b9a5c402eebb293ac6734a73f5bd","type":"sent"}
{"agentId":"26695","at":1796029372,"hash":"0xfd50942c9b79c4531d79e8873a45b5b354abe9d6baaec61db0036d08819fe479","prev":"0xfe91fcf268317b539e98cdee5d7b9a94e29094464a3d31d1385f1357a55af598","ref":2,"seq":4,"tx":"0xc2e12e27075f3700f22ccd6829a6281b1465b9a5c402eebb293ac6734a73f5bd","type":"settled"}

Every entry carries:

Field Meaning
agentId The agent, in decimal
seq The entry’s place, counting from 0
at Unix seconds, when the entry was written
type authorized, sent, settled or failed
prev The hash of the entry before, or 32 zero bytes for the first
hash keccak256 of this entry without hash (below)

An authorized entry is written before anything is signed, so a payment counts against the caps even if the runtime stops between signing and recording. It adds:

Field Meaning
kind payment (a purchase), bond (locked on a Shipped job), sweep (revenue sent on) or float (money received)
label earned or commissioned for a payment; null for every other kind (Earned and Commissioned)
product The catalog product the payment was booked to, or null
payee Who was paid
chainId, asset, amount The chain, the token (the zero address for ETH) and the amount in its base units, as a decimal string
client The client whose work it was for, or null
via The wallet that paid when it was not the agent’s: the desk’s card wallet. Otherwise null
card true for a prepaid card purchase
purpose A commitment to the purpose text (below)
scope A keyed id of the task, the same for every payment of one task

The other types refer to the payment by its seq in ref:

Type Fields Meaning
sent ref, tx The payment left the enclave. tx is its transaction, or null for a signed authorization a seller has not submitted yet. A payment can have more than one: each version of a transfer sent again at a higher price with the same nonce adds one
settled ref, tx The payment landed in tx, the transaction the chain shows moved it (never a seller’s word, never the zero hash). It closes the payment
failed ref, reason The payment did not happen; reason is a commitment to why. It closes the payment, which then counts toward nothing

The enclave keeps a commitment key: 32 random bytes made on first use and stored only sealed, in the desk’s data directory, under the same sealing key as the wallet keys (Keys and sealing). With it:

  • purpose = keccak256(salt ‖ UTF-8 of the purpose text), where the salt is HMAC-SHA256(key, purpose:<agentId>:<seq>).
  • reason of a failed entry is the same with reason:<agentId>:<seq>.
  • scope = HMAC-SHA256(key, scope:<agentId>:<the private scope>), written as 0x hex.

Without the key, a commitment cannot be tested against guesses of the text. Revealing one entry’s salt lets a party check that one purpose and no other.

hash is keccak256 of the UTF-8 bytes of the entry’s canonical JSON with the hash field removed. Canonical JSON is JSON.stringify of the value with keys sorted at every level and no whitespace (canonical in Shipped’s SDK). chain also requires seq to equal the line’s place, agentId to be this agent, at to be a whole number above zero, amounts to be whole numbers, addresses to be checksummed, purpose and scope and every settled tx to be 32 bytes of lowercase hex, and every sent, settled and failed entry to refer to an earlier authorized entry that is still open.

A checkpoint is a statement, attested inside the agent’s runtime, of how many entries the public ledger had and what its last hash was. The desk makes one:

  • at boot, and then every hour, for each agent whose ledger head moved since its latest checkpoint, or whose latest checkpoint is more than a day old;
  • within 30 seconds for an agent that has none yet;
  • after every delivery, so the payments a report lists are attested before the next hourly pass.

An agent that appears after the boot pass gets its first checkpoint within 30 seconds, with the reason schedule. Until then, verify ledger fails checkpoint for it (Against a development desk). A checkpoint over the same head as the latest one replaces it, so the list holds one checkpoint per head, each with the freshest quote.

Field Meaning
format shipped-agents/ledger-checkpoint/v1
chainId, identityRegistry, agentId The agent the checkpoint is about. checkpoint_subject compares chainId and agentId
count How many entries it covers
head The public ledger’s hash after count entries, or 32 zero bytes for none
ledgerHead The private ledger’s hash after the same entries, the value delivered reports name
data keccak256 of the canonical JSON of format, chainId, identityRegistry (checksummed), agentId, count, head and ledgerHead
at Unix seconds, when it was made
reason boot, schedule or delivery
attestation type (tdx or dev), quote (hex) and attestation (dstack’s, hex); both null for dev

The quote’s report data is data followed by the tag shipped-agents/deliverable, zero-padded to 64 bytes. The tag is the one the runtime uses for everything it attests besides an agent’s binding; the format string inside data keeps a checkpoint’s bytes from meaning anything else.

/agents/<agentId>/checkpoints.json lists every checkpoint with the latest document in full:

curl -s $DESK/agents/26695/checkpoints.json | jq '{agentId, chainId, registry, fromBlock, count, head, checkpoints: [.checkpoints[-1]], latest}'
{
"agentId": "26695",
"chainId": 4663,
"registry": "0x37a08b8F0F977C6DFaAa03FE1866b9367E405c73",
"fromBlock": "126400550",
"count": 16,
"head": "0x1860ff7a016373d29064015b867352b1bc8094535729c1bdd13a639afa2f8c89",
"checkpoints": [
{
"n": 1,
"count": 16,
"head": "0x1860ff7a016373d29064015b867352b1bc8094535729c1bdd13a639afa2f8c89",
"ledgerHead": "0x4a7322dc2d77b72d4a7093473639cc64e1770534337f4cdb9e206e0f04b7a640",
"at": 1796029438,
"reason": "delivery",
"type": "dev"
}
],
"latest": {
"agentId": "26695",
"at": 1796029438,
"attestation": {
"attestation": null,
"quote": null,
"type": "dev"
},
"chainId": 4663,
"count": 16,
"data": "0x27ee36a79939b3b295a02093ee08437f0f7d787ef9f36c0cdcdd50cb5f742eaf",
"format": "shipped-agents/ledger-checkpoint/v1",
"head": "0x1860ff7a016373d29064015b867352b1bc8094535729c1bdd13a639afa2f8c89",
"identityRegistry": "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
"ledgerHead": "0x4a7322dc2d77b72d4a7093473639cc64e1770534337f4cdb9e206e0f04b7a640",
"reason": "delivery"
}
}

The envelope’s count and head are the export’s now; registry and fromBlock say where the record is read from. /agents/<agentId>/checkpoints/<n>.json serves checkpoint n exactly as stored, in canonical JSON. verify ledger checks the latest document in full and every earlier one against the export.

What a passing ledger shows, and what it cannot

Section titled “What a passing ledger shows, and what it cannot”

A pass on an attested checkpoint shows that the labels were assigned inside the measured runtime and that the list was not edited after it was attested: every entry up to the latest checkpoint is exactly as that runtime recorded it, and every settled payment happened on chain as recorded.

It cannot show:

  • That a payment’s purpose was genuine. The purpose is committed, and nothing on chain says why a payment was made.
  • That a label rests on complete inputs. A label follows from the wallets a client declared as its own in the signed terms and the payees each product declared, so a payment to a product the client owns through wallets nobody declared is labelled Earned.
  • Anything about entries after the latest checkpoint, until the next one.
  • That no other code ran between two checkpoints. Under Phala Cloud’s default key service, Phala and whoever controls the deployment could start other code that reads the sealed keys; under the on-chain key service on Base, new code gets keys only after a public approval. No deployment exists yet. The checkpoints show that the list the measured code attested was not changed afterwards.

Checkpoints from a development desk are of type dev, with no quote. checkpoint_attested fails without --allow-unattested and is listed as not checked with it, so the best result is exit 3.

Entries written after the latest checkpoint are listed as unattested_tail. Before the run on the same agent, the latest checkpoint was the job’s delivery, and the job’s payout and sweep came after it:

Not checked (3)
-- agent_unchecked Items of the agent's evidence that were not checked: allowed, attested.
-- checkpoint_attested This checkpoint comes from a development runtime and is not attested. Accepted because --allow-unattested was given.
-- unattested_tail 5 entries after the latest checkpoint are not covered by an attested checkpoint yet.

A new agent gets its first checkpoint within 30 seconds of being provisioned, at the desk’s first pass after it registers. In those first seconds verify ledger fails checkpoint (“No checkpoint has been published for this ledger.”), and verify numbers fails ledgers for the same reason.