Check an agent · How-to
Check it by hand
Every check the verify commands make can be repeated without this repository’s code, with Foundry’s cast, curl,
jq, shasum, xxd, openssl and Phala’s dcap-qvl. This page walks each check that takes a computation and shows
what it printed. The checks that compare one value with another are listed in The remaining
checks, with what to compare. One check is left to another tool: attestation reads dstack’s
MessagePack attestation, which dstack’s own dstack-verifier decodes.
The desk steps ran against a development desk on a local fork of Robinhood Chain, on the ports Run a development desk uses (fork 8641, desk 8642), with a scripted model in place of Claude so that its agent 26699 could do one job and one commissioned run. No desk is deployed yet (Status), and a development desk has no TDX quotes, so the quote steps ran on the evidence recorded from dstack’s simulator that the repository keeps in test/fixtures/dstack, not on a desk. Each loop prints nothing when every check holds.
Set up
Section titled “Set up”You need Foundry (cast), curl, jq 1.7 or later, shasum, xxd and openssl. For Intel’s check, install Phala’s
quote verifier with Rust’s cargo:
cargo install dcap-qvl-cliSet the desk, a Robinhood Chain endpoint, the Engagement Registry and the agent. Take the registry’s address from a
source you trust; reading it from the desk’s own /v1/config means trusting the desk for it. Every step below reads
this address and never one the desk names.
DESK=http://127.0.0.1:8642RPC=http://127.0.0.1:8641REGISTRY=0x6fA1778a833D7c202Bd4fAFb57948632b4b144FdID=26699cast logs sends one request for the whole block range it is given. If your endpoint refuses a range that wide, split
it with --from-block and --to-block into pieces it accepts.
The agent’s evidence
Section titled “The agent’s evidence”The registry’s runtime record: the evidence type, the code measurement, the evidence hash, the binding and when it was set.
cast call $REGISTRY 'runtimeOf(uint256)(string,bytes32,bytes32,bytes32,uint64)' $ID --rpc-url $RPC"dev"0xcce4b11adb9acf12bcd1e75485adab1167c0cd06d3088ca4bb394ef8aa050dfe0x3cc36d0876633c83eaf567a401e5b5ac6e9a891e607254872041a0c5d8de86330x63e5d7050069894191e75131bf16184616432424aa6dc2e7b53dbbae9214a6d21796037250 [1.796e9]All zeros means there is no current record: none was set, or the provider or the wallet changed since. The document’s
address is in the RuntimeSet event that set the record. The last value, setAt, is the time of the block the record
was set in, and the event is found from it as verify agent finds it: cast find-block gives a block with that time,
and since Robinhood Chain makes several blocks a second, the query covers 20 blocks either side of it.
SET=$(cast call $REGISTRY 'runtimeOf(uint256)(string,bytes32,bytes32,bytes32,uint64)' $ID --rpc-url $RPC | sed -n 5p | cut -d' ' -f1)AT=$(cast find-block $SET --rpc-url $RPC)cast logs --rpc-url $RPC --address $REGISTRY --from-block $((AT - 20)) --to-block $((AT + 20)) \ 'RuntimeSet(uint256 indexed agentId, address indexed provider, string evidenceType, bytes32 measurement, string evidenceURI, bytes32 evidenceHash, bytes32 binding)' $ID \ --json | jq -r '.[-1].data' | xargs cast decode-abi --input 'f(string,bytes32,string,bytes32,bytes32)'"dev"0xcce4b11adb9acf12bcd1e75485adab1167c0cd06d3088ca4bb394ef8aa050dfe"http://127.0.0.1:8642/agents/26699/evidence.json"0x3cc36d0876633c83eaf567a401e5b5ac6e9a891e607254872041a0c5d8de86330x63e5d7050069894191e75131bf16184616432424aa6dc2e7b53dbbae9214a6d2Download the document from that address and hash the exact bytes; the result is the third value runtimeOf returned.
The compose hash is sha256 of appCompose, exactly as served, and equals both the document’s composeHash and the
second value:
curl -s $DESK/agents/$ID/evidence.json -o evidence.jsoncast keccak "$(cat evidence.json)"jq -r .composeHash evidence.jsonjq -j .appCompose evidence.json | shasum -a 2560x3cc36d0876633c83eaf567a401e5b5ac6e9a891e607254872041a0c5d8de86330xcce4b11adb9acf12bcd1e75485adab1167c0cd06d3088ca4bb394ef8aa050dfecce4b11adb9acf12bcd1e75485adab1167c0cd06d3088ca4bb394ef8aa050dfe -The binding is keccak256(abi.encode(chainId, identityRegistry, agentId, agentWallet)). Computed by hand, read from the
registry, and read from the document, it is the same value:
IDENTITY=$(cast call $REGISTRY 'getIdentityRegistry()(address)' --rpc-url $RPC)WALLET=$(cast call $IDENTITY 'getAgentWallet(uint256)(address)' $ID --rpc-url $RPC)cast keccak $(cast abi-encode 'f(uint256,address,uint256,address)' 4663 $IDENTITY $ID $WALLET)cast call $REGISTRY 'bindingOf(uint256)(bytes32)' $ID --rpc-url $RPCjq -r .binding evidence.json0x63e5d7050069894191e75131bf16184616432424aa6dc2e7b53dbbae9214a6d20x63e5d7050069894191e75131bf16184616432424aa6dc2e7b53dbbae9214a6d20x63e5d7050069894191e75131bf16184616432424aa6dc2e7b53dbbae9214a6d2To check every agent the desk lists at once, this loop reads each page of the list (50 agents to a page) and prints a line only for an agent whose served document does not hash to its record:
PAGES=$(curl -s "$DESK/agents.json?provider=shipped" | jq .pages)for P in $(seq 1 $PAGES); do curl -s "$DESK/agents.json?provider=shipped&page=$P" | jq -r '.agents[].agentId'; done | while read -r A; do want=$(cast call $REGISTRY 'runtimeOf(uint256)(string,bytes32,bytes32,bytes32,uint64)' $A --rpc-url $RPC | sed -n 3p) got=$(cast keccak "$(curl -s $DESK/agents/$A/evidence.json)") [ "$want" = "$got" ] || echo "agent $A: evidence does not match its runtime record"doneIt printed nothing. The loop checks the agents the desk lists. Every agent the desk took on has a ProviderSet event
on the registry naming one of the providers in /numbers.json, so those events are the list to compare with when you
do not rely on the desk’s.
The quote
Section titled “The quote”These steps need TDX evidence, so they ran from a checkout on the simulator recording, not on a desk. Its quote is
version 4, whose fields start 48 bytes in: in the 0x-prefixed hex the report data is characters 1139 to 1266, RTMR3
1043 to 1138, RTMR0 to RTMR2 755 to 1042 and the TD attributes 339 to 354. In a version 5 quote every field is 6 bytes
(12 characters) later.
E=test/fixtures/dstack/evidence-v1.jsonQ=$(jq -r .quote $E)echo $Q | cut -c3-18echo $Q | cut -c1139-1202echo $Q | cut -c1203-1266 | xxd -r -p | tr -d '\0'; echojq -r .binding $E0400020081000000cbbe994ea98b06b61133da70b21c9c755c2a71b8bcc229e4161cba585d52223fshipped-agents/binding0xcbbe994ea98b06b61133da70b21c9c755c2a71b8bcc229e4161cba585d52223fThe header reads version 0400 (4, little-endian), attestation key type 0200 (ECDSA P-256) and TEE type 81000000
(TDX); quote accepts version 4 or 5 with these two. The report data is the binding, then the shipped-agents/binding
tag.
The TD attributes are a little-endian 64-bit value. Bit 28 (SEPT_VE_DISABLE) has to be on; debug (bit 0), profiling
(bits 4 to 6), service TDs (bit 17) and migration (bit 29) have to be off. 0000001000000000 sets only bit 28:
echo $Q | cut -c339-3540000001000000000A version 5 quote can carry a TD 1.5 report (body type 0300 or 0400 at characters 99 to 102). Its service-TD
measurement, characters 1311 to 1406, has to be all zeros.
Runtime events go only to RTMR3, and RTMR3 holds nothing else. This counts the entries that break that rule:
jq '[.eventLog[] | select((.imr == 3) != (.event_type == 134217729))] | length' $E0Each runtime event’s digest is SHA-384 of its preimage. In log version 1 (no version field) the preimage is the event
type as four little-endian bytes, :, its name, : and its payload’s bytes, and a name with a colon in it fails. This
loop recomputes them and prints only a mismatch:
jq -c '.eventLog[] | select(.imr == 3 and .version != 2)' $E | while read -r e; do want=$(echo "$e" | jq -r .digest) got=$( { printf '\x01\x00\x00\x08:%s:' "$(echo "$e" | jq -r .event)"; echo "$e" | jq -r .event_payload | xxd -r -p; } | openssl dgst -sha384 -r | cut -c1-96) [ "$got" = "$want" ] || echo "$(echo "$e" | jq -r .event): digest does not follow"doneIt printed nothing. In log version 2 ("version": 2) the preimage is the canonical JSON of the name, the payload in
lowercase hex and the type, and the entry carries it in preimage. A stated preimage proves nothing until it is shown
to be built from the event, so build it yourself and compare before hashing:
jq -c '.eventLog[] | select(.imr == 3 and .version == 2)' $E | while read -r e; do built=$(echo "$e" | jq -j '{name: .event, payload: (.event_payload | ascii_downcase), type: 134217729} | tojson' | xxd -p | tr -d '\n') [ "$built" = "$(echo "$e" | jq -r .preimage)" ] || echo "$(echo "$e" | jq -r .event): preimage is not built from the event" [ "$(echo -n "$built" | xxd -r -p | openssl dgst -sha384 -r | cut -c1-96)" = "$(echo "$e" | jq -r .digest)" ] || echo "$(echo "$e" | jq -r .event): digest does not follow"doneThe version 1 recording has no such entries. With E=test/fixtures/dstack/evidence-v2.json, the recording of a
version 2 log, it printed nothing.
Replaying the runtime events rebuilds RTMR3: start from 48 zero bytes, and for each event take SHA-384 of the register followed by the event’s digest. The result is the quote’s RTMR3:
mr=$(printf '%096d' 0)for d in $(jq -r '.eventLog[] | select(.imr == 3) | .digest' $E); do mr=$(echo -n "$mr$d" | xxd -r -p | openssl dgst -sha384 -r | cut -c1-96)doneecho $mrecho $Q | cut -c1043-1138daaae44c8d27c920457ad32fc0eebc953b9e9faa3c970944c50cc307aedf6032bf18fc11c5a8925b07faf0096b106c5adaaae44c8d27c920457ad32fc0eebc953b9e9faa3c970944c50cc307aedf6032bf18fc11c5a8925b07faf0096b106c5aRTMR0 to RTMR2 replay the same way from the boot events, each taken at its stated digest. This loop prints only a register that does not match the quote:
for N in 0 1 2; do mr=$(printf '%096d' 0) for d in $(jq -r ".eventLog[] | select(.imr == $N) | .digest" $E); do mr=$(echo -n "$mr$d" | xxd -r -p | openssl dgst -sha384 -r | cut -c1-96) done at=$((755 + 96 * N)) [ "$mr" = "$(echo $Q | cut -c$at-$((at + 95)))" ] || echo "RTMR$N does not replay"doneIt printed nothing, on both recordings. dstack’s boot sequence has to log app-id, compose-hash, instance-id,
os-image-hash, key-provider, boot-mr-done and system-ready in RTMR3 exactly once each; other events it logs,
here storage-fs and system-preparing, are not counted:
jq '[.eventLog[] | select(.imr == 3) | .event] | group_by(.) | map({(.[0]): length}) | add' $E{ "app-id": 1, "boot-mr-done": 1, "compose-hash": 1, "instance-id": 1, "key-provider": 1, "os-image-hash": 1, "storage-fs": 1, "system-preparing": 1, "system-ready": 1}The measured values are the events’ payloads, and each has to equal the document’s own field: compose-hash its
composeHash (and so the measurement on chain), app-id its appId, instance-id its instanceId and
os-image-hash its osImageHash. key-provider names the key service, whose id you compare with the KMS root key
(Pins and where each value comes from):
jq -r '.eventLog[] | select(.imr == 3 and (.event == "compose-hash" or .event == "app-id" or .event == "instance-id" or .event == "os-image-hash")) | "\(.event) \(.event_payload)"' $Ejq -c '{composeHash, appId, instanceId, osImageHash}' $Ejq -r '.eventLog[] | select(.event == "key-provider") | .event_payload' $E | xxd -r -p; echoapp-id 5bb4ff9a3837357f19dc176407a5709c62eb6c56compose-hash 950e1b880eb6383dbcd0514d0d3623b0690459676b3e7289f0e29908b17df5a1instance-id 1691ed1b47506cad7d08834668691d88246f5b1fos-image-hash e61be43dd1cc6a6f5edefd7c51b608983780839b0000ce60dd99737dcffe09b9{"composeHash":"0x950e1b880eb6383dbcd0514d0d3623b0690459676b3e7289f0e29908b17df5a1","appId":"0x5bb4ff9a3837357f19dc176407a5709c62eb6c56","instanceId":"0x1691ed1b47506cad7d08834668691d88246f5b1f","osImageHash":"0xe61be43dd1cc6a6f5edefd7c51b608983780839b0000ce60dd99737dcffe09b9"}{"name":"kms","id":"3059301306072a8648ce3d020106082a8648ce3d0301070342000419b2457dd9b8aa6446d980f136fff7812ecd6c77740eeb0e28b10d56c0c00028a5b6e59dcea307d583bd1f70769e9c116df2bcfb1758a95d8613e7de1c8482c0"}The compose
Section titled “The compose”appCompose is the measured compose: dstack’s flags and the docker compose file. key_provider also needs
kms_enabled to be true. A pre_launch_script or init_script is measured, but what it fetches is not, so read any
you find. The second command prints the lines of the compose file the two compose checks turn on, without comments:
jq -r .appCompose $E | jq -c '{kms_enabled, allowed_envs, pre_launch_script, init_script}'jq -r .appCompose $E | jq -r .docker_compose_file | grep -nE 'image:|\$|env_file|extends|include|build|SA_DEV' | grep -vE '^[0-9]+: *#'{"kms_enabled":true,"allowed_envs":["CLOUDFLARE_API_TOKEN","SA_ANTHROPIC_API_KEY","SA_EMAIL_API_KEY","SA_EMAIL_WEBHOOK_SECRET","SA_RPC_URL"],"pre_launch_script":null,"init_script":null}9: image: shipped-agents.test/shipped-agents:simulator@sha256:08175a2573bef9538884be01d9b5c9a56f4af0724d40a7896c131bf6993f56bd34: SA_ANTHROPIC_API_KEY: ${SA_ANTHROPIC_API_KEY}35: SA_RPC_URL: ${SA_RPC_URL}36: SA_EMAIL_API_KEY: ${SA_EMAIL_API_KEY}37: SA_EMAIL_WEBHOOK_SECRET: ${SA_EMAIL_WEBHOOK_SECRET}50: image: ghcr.io/dstack-tee/dstack-ingress:2.8@sha256:60e682449534715a2f2e5b72326ca4229209c8e26c931c6f34d27e02200ac08660: CLOUDFLARE_API_TOKEN: ${CLOUDFLARE_API_TOKEN}images_pinned passes when the file names at least one image and every image: is pinned as
name@sha256:<64 hex>. settings_measured passes when:
- the
shipped-agentsservice has anenvironment:block, andSA_DEVis absent from it or0; allowed_envsnames only secrets a service takes:SA_ANTHROPIC_API_KEY,SA_RPC_URL,SA_RPC_URL_<chainId>,SA_EMAIL_API_KEY,SA_EMAIL_WEBHOOK_SECRETandSA_BLOCKED_PAYEES(or its older nameBLOCKED_PAYEES) forshipped-agents, andCLOUDFLARE_API_TOKENfordstack-ingress;- every line that holds
$or a nameallowed_envslists isNAME: ${NAME}orNAME: ${NAME?message}, in theenvironment:of the service that takes that secret (the list form- NAME=...fails); - no
env_file,extends,includeorbuildkey appears anywhere; - every line is plain YAML: printable ASCII, no
\, no&,*,!,|or>outside quotes, no quote or bracket left open, and each line a key or a list item.
Intel’s check
Section titled “Intel’s check”Last, the quote against Intel’s collateral, with dcap-qvl (version 0.7.1 here), which fetches collateral from
Phala’s PCCS. Phala’s published production quote, kept in the repository, verifies:
dcap-qvl verify --hex test/fixtures/dstack/phala-quote.hex | jq -c '{status, qe: .qe_status.status, platform: .platform_status.status}'Getting collateral from https://pccs.phala.network...Quote verified{"status":"UpToDate","qe":"UpToDate","platform":"UpToDate"}intel passes only when status is UpToDate or SWHardeningNeeded. Any other status fails it, whatever dcap-qvl
prints on the line before (TCB status). A debug TD, or one bound to a service TD, fails too:
the TD attributes above show which. The full JSON also carries the decoded TD report: MRTD, RTMR0 to RTMR3 and the
report data.
The simulator’s quote is signed by dstack’s test PKI, so dcap-qvl refuses it and exits with 1:
echo $Q | cut -c3- | xxd -r -p > quote.bin && dcap-qvl verify quote.binGetting collateral from https://pccs.phala.network...Error: Failed to verify quote…dstack’s own dstack-verifier checks the same evidence on its own from the attestation, including the OS image
measurements: run it and POST /verify with {"attestation": "<the document's attestation, hex without 0x>"}.
Phala’s Trust Center shows a CVM at https://trust.phala.com/app/<appId> when the guest agent’s port 8090 is opened for
it.
The public ledger’s hash chain
Section titled “The public ledger’s hash chain”Each line’s hash is keccak256 of the line without hash, keys sorted, no whitespace; each prev is the line
before’s hash; seq counts from 0; and each line is already in canonical form. This loop prints only a break:
curl -s $DESK/agents/$ID/ledger.jsonl -o ledger.jsonlprev=0x0000000000000000000000000000000000000000000000000000000000000000n=0while read -r line; do [ "$(echo "$line" | jq .seq)" = "$n" ] || echo "seq breaks at line $n" [ "$(echo "$line" | jq -r .prev)" = "$prev" ] || echo "prev breaks at $n" [ "$(cast keccak "$(echo "$line" | jq -cS 'del(.hash)')")" = "$(echo "$line" | jq -r .hash)" ] || echo "hash breaks at $n" [ "$(echo "$line" | jq -cS .)" = "$line" ] || echo "line $n is not canonical" prev=$(echo "$line" | jq -r .hash); n=$((n + 1))done < ledger.jsonlecho $prev0xdbfd6b40f6835aae46af425ce9781bc051f90e4f7a91d6250f5143dd759c8043Only the final head printed: no line broke. With one amount changed in a copy of the export (250000 to 250001 on
line 3), the same loop prints the break before the head:
hash breaks at 20xdbfd6b40f6835aae46af425ce9781bc051f90e4f7a91d6250f5143dd759c8043jq -cS matches the canonical form for the values a public ledger holds (whole numbers, booleans, null, ASCII
strings).
chain also holds each entry to these rules: agentId is this agent, type is one of the four, and at is a whole
number above zero; an authorized entry’s amount is a whole number, its purpose and scope are 32 bytes of
lowercase hex, as is a settled entry’s tx, and its addresses are checksummed; and every sent, settled and
failed entry refers to an earlier authorized entry that no settled or failed entry has closed yet. These print
only an entry that breaks one:
jq -r --arg id "$ID" 'def hex32: type == "string" and test("^0x[0-9a-f]{64}$"); select(.agentId != $id or (.type | IN("authorized", "sent", "settled", "failed") | not) or (.at | type != "number" or . != floor or . <= 0) or (.type == "authorized" and ((.amount | test("^[0-9]+$") | not) or (.purpose | hex32 | not) or (.scope | hex32 | not))) or (.type == "settled" and (.tx | hex32 | not))) | "entry \(.seq) breaks a rule"' ledger.jsonljq -rs 'reduce .[] as $e ({}; if $e.type == "authorized" then .[$e.seq | tostring] = "open" elif .[$e.ref | tostring] != "open" then .bad += ["entry \($e.seq) refers to \($e.ref), which is not an open payment"] elif $e.type == "sent" then . else .[$e.ref | tostring] = "closed" end) | .bad // [] | .[]' ledger.jsonljq -r 'select(.type == "authorized") | .payee, .asset, .client, .via | values' ledger.jsonl | sort -u | while read -r a; do [ "$(cast to-check-sum-address $a)" = "$a" ] || echo "$a is not checksummed"doneThey printed nothing.
The latest checkpoint
Section titled “The latest checkpoint”Its 32 bytes follow from what it states, and its head is the export’s after count entries:
curl -s $DESK/agents/$ID/checkpoints.json | jq .latest > checkpoint.jsoncast keccak "$(jq -cS '{format, chainId, identityRegistry, agentId, count, head, ledgerHead}' checkpoint.json)"jq -r .data checkpoint.jsonsed -n "$(jq .count checkpoint.json)p" ledger.jsonl | jq -r .hashjq -r .head checkpoint.json0x4b632e799ef07d7c80874ba1fcd212832caae1abf0a4a6915b85bcdb114ec6820x4b632e799ef07d7c80874ba1fcd212832caae1abf0a4a6915b85bcdb114ec6820xdbfd6b40f6835aae46af425ce9781bc051f90e4f7a91d6250f5143dd759c80430xdbfd6b40f6835aae46af425ce9781bc051f90e4f7a91d6250f5143dd759c8043Every earlier checkpoint has to name a head the export has, and one over no entries names 32 zero bytes. This loop prints only one that does not:
curl -s $DESK/agents/$ID/checkpoints.json -o checkpoints.jsonjq -c '.checkpoints[] | [.n, .count, .head]' checkpoints.json | while read -r c; do count=$(echo $c | jq '.[1]'); head=$(echo $c | jq -r '.[2]') [ "$count" = 0 ] && want=0x0000000000000000000000000000000000000000000000000000000000000000 || want=$(sed -n "${count}p" ledger.jsonl | jq -r .hash) [ "$want" = "$head" ] || echo "checkpoint $(echo $c | jq '.[0]') names a head the export does not have"doneIt printed nothing, for three checkpoints: one over no entries, made when the agent was new, and one after each delivery.
On a TDX checkpoint, .attestation.quote is checked as the evidence’s quote is above, with two differences: the
report data is the checkpoint’s data followed by the shipped-agents/deliverable tag, and the event log to replay is
the one inside .attestation.attestation (dstack’s MessagePack), which dstack-verifier decodes. Its compose-hash
event has to equal the measurement runtimeOf returned, and its app-id the evidence’s appId. A development desk’s
checkpoints carry no quote, so these steps did not run here.
A settled payment
Section titled “A settled payment”Find the settled line whose ref is the payment’s seq, then read its transaction. An ERC-20 Transfer log of the
payment’s asset has the agent’s wallet as its second topic, the payee as its third and the amount as its data:
jq -c 'select(.type == "settled" and .ref == 2)' ledger.jsonljq -c 'select(.seq == 2) | {asset, payee, amount}' ledger.jsonlTX=$(jq -r 'select(.type == "settled" and .ref == 2) | .tx' ledger.jsonl)cast receipt $TX --rpc-url $RPC --json | jq -c '.status, (.logs[] | select(.topics[0] == "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") | {address, from: .topics[1], to: .topics[2], amount: .data})'{"agentId":"26699","at":1796037308,"hash":"0xb76515ab4fc8961cb1746adbfc93001beebf7434f41b98fff1cb2a272dc7f5ff","prev":"0x08176acd1dc7a753b59cf99a4fe5d8aabceb3f333733af99c1171bdd6ab47567","ref":2,"seq":4,"tx":"0x4c0857fcf86e071fe4096715cc0da402c5a393ed84b49a658e111834a3b19e41","type":"settled"}{"asset":"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","payee":"0xf2c304B95565b5DaCb94Beb96b27040F9475a76B","amount":"250000"}"0x1"{"address":"0x5fc5360d0400a0fd4f2af552add042d716f1d168","from":"0x000000000000000000000000421dcc2ccb99ede58f0acd6c77d6c7db00ce790d","to":"0x000000000000000000000000f2c304b95565b5dacb94beb96b27040f9475a76b","amount":"0x000000000000000000000000000000000000000000000000000000000003d090"}0x3d090 is 250000 (cast to-dec). Each transfer log backs one entry only, so two entries cannot rest on the same
log. For an ETH payment (asset is the zero address) the transaction itself moves the money: cast tx $TX from,
cast tx $TX to and cast tx $TX value give the sender, the payee and the amount in wei.
The sender has to be the agent’s wallet:
cast call $IDENTITY 'getAgentWallet(uint256)(address)' $ID --rpc-url $RPC0x421dcC2ccB99eDE58F0ACD6C77D6C7DB00Ce790DAn earlier wallet of the agent counts too. Every wallet the agent has had is in the Identity Registry’s MetadataSet
events for its agentWallet key, read from the block the agent’s checkpoint list names, as verify ledger reads them:
FROM=$(curl -s $DESK/agents/$ID/checkpoints.json | jq -r .fromBlock)cast logs --rpc-url $RPC --address $IDENTITY --from-block $FROM \ 'MetadataSet(uint256 indexed agentId, string indexed indexedMetadataKey, string metadataKey, bytes metadataValue)' $ID agentWallet \ --json | jq -r '.[].data' | while read -r d; do cast decode-abi --input 'f(string,bytes)' $d | tail -1; done0x421dcc2ccb99ede58f0acd6c77d6c7db00ce790dA card purchase is sent from the card wallet its entry names in via, and a float entry records money the agent
received, from any sender.
The hires and the till
Section titled “The hires and the till”The numbers name the registry they were computed from, the block the desk reads from, the providers and the till. The
first command checks the registry against the one you set at the start, and the steps keep yours either way: if the
numbers name another, the desk computes its figures from a registry you did not choose, and verify numbers --registry fails registry for the same reason. verify numbers reads the registry from the block engagement 1 was
opened in when that is earlier than the desk’s block, since no hire can come before engagement 1. The commands below do
the same, starting 20 blocks early because several blocks can share one second:
curl -s $DESK/numbers.json -o numbers.json[ "$(jq -r .registry numbers.json | tr A-F a-f)" = "$(echo $REGISTRY | tr A-F a-f)" ] || echo "the numbers are computed from another registry"FROM=$(jq -r .fromBlock numbers.json); TILL=$(jq -r .till numbers.json)OPENED=$(cast call $REGISTRY 'getEngagement(uint256)((uint256,address,address,uint64,uint64,uint64,bytes32))' 1 --rpc-url $RPC --json | jq -r '.[0][5]')FIRST=$(( $(cast find-block $OPENED --rpc-url $RPC) - 20 ))[ "$FIRST" -lt "$FROM" ] && FROM=$FIRSTjq -c .providers numbers.jsoncast logs --rpc-url $RPC --address $REGISTRY --from-block $FROM \ 'EngagementOpened(uint256 indexed engagementId, uint256 indexed agentId, address indexed client, address provider, uint64 start, uint64 end, string termsURI, bytes32 termsHash)' \ --json | jq -c '.[] | {engagementId: .topics[1], agentId: .topics[2], client: .topics[3], provider: .data[0:66]}'["0x38C257D5274431cB7dc52D2E2ddD1f8A9d6C75ED"]{"engagementId":"0x0000000000000000000000000000000000000000000000000000000000000001","agentId":"0x000000000000000000000000000000000000000000000000000000000000684b","client":"0x0000000000000000000000006a3ea6e517dba00898a4cf5502a8a94926f21959","provider":"0x00000000000000000000000038c257d5274431cb7dc52d2e2ddd1f8a9d6c75ed"}{"engagementId":"0x0000000000000000000000000000000000000000000000000000000000000002","agentId":"0x000000000000000000000000000000000000000000000000000000000000684b","client":"0x0000000000000000000000006a3ea6e517dba00898a4cf5502a8a94926f21959","provider":"0x00000000000000000000000038c257d5274431cb7dc52d2e2ddd1f8a9d6c75ed"}The registry check printed nothing: the numbers name the registry set at the start. When getEngagement(1) reverts,
no engagement exists yet and there are no hires.
Keep the engagements whose provider is in providers: they are the hires, and /numbers/hires.json has to list
exactly these, with the same agent (0x684b is 26699), client and provider. Every USDG transfer out of the till has to
be a refund or a release the hires export lists:
cast logs --rpc-url $RPC --address 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 --from-block $FROM \ 'Transfer(address indexed from, address indexed to, uint256 value)' $TILL --json | jq -c '.[] | {tx: .transactionHash, to: .topics[2]}'curl -s $DESK/numbers/hires.json | jq -c '.hires[] | select(.payment) | .moves[] | {kind, to, tx}'{"tx":"0xe8efede2c92ab36a3ea1f59de8fef65eabcffb6752d7b381395f32c7254dba21","to":"0x0000000000000000000000004641827843606cc22a7cb53d1e2e1d619e853aaa"}{"kind":"release","to":"0x4641827843606cc22a7cB53D1E2e1D619e853aAA","tx":"0xe8efede2c92ab36a3ea1f59de8fef65eabcffb6752d7b381395f32c7254dba21"}Each payment into the till is checked the same way as a settled payment: its tx moves the listed amount of the price’s
asset from the payer to the till. Each listed move is a transfer of its amount from the till to its to, a refund
goes back to the wallet that paid, and one transfer backs one payment or one move of one hire.
A job’s outcome on Shipped’s registry
Section titled “A job’s outcome on Shipped’s registry”A job’s outcome is getDeed(<jobId>) on Shipped’s job registry (ShippedDeeds), 0xD5Da523ee49CB7Fe855B0C6fa38707190A9D531F:
its creator, its status (4 is settled), its ruling (1 or 7 accepted, 2 rejected, 5 conceded, 6 silence), its
remainderBps (the agent’s share, in basis points), who ruled, terms.refundTo (the client) and the job’s amount. The
amount is the amount= in the line [shipped-job:1 amount=… bond=…] that ends the terms’ milestone text, written when
the job was opened; a milestone without that line counts as zero.
DEEDS=0xD5Da523ee49CB7Fe855B0C6fa38707190A9D531FSIG='getDeed(uint256)((address,uint8,uint8,uint16,uint16,bool,uint64,uint64,uint64,uint64,uint64,uint64,address,address,uint256,(string,string,address,uint8,address,uint64,address,address,address,address,bytes,address,uint16,uint16,bool,uint32,uint32,uint32,uint32,uint128,uint128,address[])))'cast call $DEEDS "$SIG" 11 --rpc-url $RPC --json | jq -c '.[0] | {creator: .[0], status: .[1], ruling: .[2], remainderBps: .[3], ruledBy: .[12], refundTo: .[15][11], amount: (.[15][1] | capture("amount=(?<a>[0-9]+) bond=") | .a)}'{"creator":"0x421dcC2ccB99eDE58F0ACD6C77D6C7DB00Ce790D","status":4,"ruling":1,"remainderBps":10000,"ruledBy":"0x790e9b696B6FFa222f0E257B70Cb335ed177318A","refundTo":"0x6a3ea6E517dBa00898A4cf5502a8A94926F21959","amount":"…"}The amount is cut here, since it is the job’s price. The job id is the hire’s job.id in /numbers/hires.json.
verify numbers checks that the deed exists and that refundTo is the hire’s client; compare the creator with the
hire’s agentWallet yourself (here both are 0x421dcC2ccB99eDE58F0ACD6C77D6C7DB00Ce790D).
verify numbers explains how each outcome counts.
The remaining checks
Section titled “The remaining checks”These checks compare one value with another, with the commands above or one cast call:
| Check | Passes when |
|---|---|
agent, provider, wallet |
ownerOf(agentId) and getAgentWallet(agentId) on the Identity Registry and providerOf(agentId) on the Engagement Registry are not the zero address |
age |
setAt is at most 30 days before the time of the latest block (cast block latest -f timestamp) |
format, subject |
The document’s format is shipped-agents/runtime-evidence/v1, its chainId is 4663, and its identityRegistry, agentId and agentWallet are $IDENTITY, $ID and $WALLET |
attested |
type is tdx and the document has a quote |
allowed, app_pinned, kms_pinned, os_pinned, boot_pinned |
The measured compose hash, app id, key provider id, OS image and MRTD with RTMR0 to RTMR2 are among the values you trust (Pins and where each value comes from) |
checkpoint_format, checkpoint_subject |
The latest checkpoint’s format is shipped-agents/ledger-checkpoint/v1, count is a whole number, head and ledgerHead are 32 bytes of lowercase hex, chainId is 4663 and agentId is $ID |
chain (numbers) |
cast chain-id --rpc-url $RPC is the numbers’ chainId |
ledgers_complete, ledgers |
Every agent hired on chain has an entry in the numbers’ ledgers, and each of those ledgers passes the ledger steps above |
| The figures | Recomputed from the hires, the jobs and the ledgers with the methods in verify numbers, they equal each figure’s value in /numbers.json |