Install SDK 0.10.1.
Get a free policy receipt.
Use Node.js 22+ and a workspace API key for the production free-mode example below. No OCD fee signer or funded wallet is needed to evaluate a proposal. The optional offline/mock quickstart uses an in-process demo server, not production.
- Create a workspace API key. Sign in to Dashboard → API Keys, create a named key and securely save the value shown once. Load it server-side as
OCD_API_KEYthrough your secret manager or local environment; never put it in browser code, logs or source control. Pass it asaccountApiKeyso new operations belong to your workspace. It does not authorize wallet spending. - Install in your application.
Published package · SDK documentation.npm install @onchaindiligence/sdk@0.10.1 - Configure durable recovery. Use
NodeFileRecoveryStoreon private persistent disk for a single deployment, or implementCommerceRecoveryStoreagainst your database for multi-instance/serverless use. Keep recovery credentials private and outside source control: the file store contains plaintext recovery credentials and capabilities, not encrypted secrets. Retain the operation ID and original action/policy. After an interrupted preflight, useocd.open({ operationId, action, policy })with the same store and free mode before retryingop.preflight().ocd.load(operationId)alone does not restore pending preflight inputs; never create a replacement operation because a response is ambiguous. - Evaluate a supported proposal in free mode. Set
preflightMode: 'free'explicitly. Free evaluations support canonical Base USDC and Solana mainnet USDC. The example stops after policy evaluation and receipt verification: it does not execute a payment. - Inspect and verify. Open Dashboard → Reconciliation in the same workspace, then Open evidence. Verify the signed preflight receipt and read its decision separately from execution or settlement. Use the pilot checklist before adding your executor.
- Optional: run the existing offline/mock quickstart. The fixture files live in the public SDK repository, not the npm tarball. Use a separate demo checkout:
It uses a mocked executor and demo server: no chain call, no real signing or payment. Read the same quickstart.ts; do not turn it into a live flow just by removing its demo fetch.git clone https://github.com/Qazza1/onchaindiligence-sdk.git ocd-sdk-demo cd ocd-sdk-demo git checkout 2237149238d86ed4ac46c8a5f7a66476ddb19da0 npm ci --ignore-scripts --no-audit --no-fund npx tsx examples/quickstart.ts
ALLOW and BLOCK. No OCD fee signer is needed in free mode. Exhaustion returns 429 free_allowance_exhausted; disabled service or errors stop the flow, never automatically switch to paid mode. Actual merchant payments and any gas remain separate.import { createCommerceClient, BASE_USDC } from '@onchaindiligence/sdk/commerce'
import { NodeFileRecoveryStore } from '@onchaindiligence/sdk/commerce/node'
if (!process.env.OCD_API_KEY) throw new Error('Set OCD_API_KEY first')
const ocd = createCommerceClient({
accountApiKey: process.env.OCD_API_KEY,
preflightMode: 'free',
recovery: new NodeFileRecoveryStore('./ocd-recovery'),
})
const action = {
kind: 'PAYMENT', resource: null, network: 'eip155:8453',
asset: BASE_USDC, amount: '0.001', sender: null,
recipient: '0x000000000000000000000000000000000000dEaD',
}
const policy = { max_amount: '0.01' }
const op = await ocd.open({
operationId: process.env.OCD_OPERATION_ID || undefined,
action, policy,
})
console.log({ operation_id: op.operationId }) // retain this non-secret ID
const evaluation = await op.preflight()
if ('receipt' in evaluation) {
const decision = evaluation.receipt.receipt.decision.status
const proof = await ocd.verifyReceipt(evaluation.receipt)
console.log({ result: evaluation.kind, decision,
receipt_id: evaluation.receipt.receipt.receipt_id, proof: proof.state })
} else {
console.log({ result: evaluation.kind, error: evaluation.error ?? null,
reset_at: evaluation.resetAt ?? null })
}
// Stop here: decision is a policy comparison; proof verifies the receipt.
// No executor, merchant payment, signing or settlement finalization.
Save this example as preflight.mjs and run node preflight.mjs after loading your key securely. For a retry after preflight interruption, set the non-secret OCD_OPERATION_ID to the printed ID, keep the original action/policy, recovery directory and working directory, then rerun. Omit it only for a deliberately new evaluation. If creation itself returned no operation ID or local persistence failed, stop and inspect your workspace operations/contact support; do not blindly rerun creation.
Read the decision, not just the receipt. ALLOW means the configured policy checks passed, not wallet authorization or sanctions clearance. BLOCK means a policy check failed. UNKNOWN means the evidence is insufficient; it and REQUIRE_APPROVAL map to SDK approval-required, not permission to execute. pending has no completed result yet. Only a separately configured executor can pay. Receipt proof VALID verifies integrity/authenticity, not settlement or delivery; do not rely on an INVALID or UNVERIFIABLE proof.
If the first request fails: 401 unauthorized — check that the active key came from this workspace’s API Keys page, not a Clerk/OAuth token or legacy account key. 429 free_allowance_exhausted — stop until resetAt (next UTC month) or contact support; no paid fallback. A burst-rate 429 rate_limited is separate: wait before retrying the same operation. 503 free_preflight_disabled — service disabled; stop. A transient pending — wait, then retry the same operation and inputs. A conflicting input/mode or missing recovery record requires investigation, not a replacement payment. Check Usage for allowance and contact support with only the operation ID and error code, never credentials.
Free receipts retain the same signing and verification semantics as paid receipts. Publication and offline examples are not evidence of a successful production free-receipt canary or a funded live proxy canary.
BLOCK, separate from the merchant payment. Choose it explicitly; it needs an x402-aware fetch and your dedicated low-balance fee wallet. No signer/private key is sent to OCD. Ordinary fetch cannot pay the challenge. SDK 0.10.1 withOcd does not support free mode: a workspace key alone does not change its paid route. Prefer the explicit free commerce client or proxy setup above/below for new integrations.Keep the original mode, operation ID and private recovery store when resuming an existing attempt. Historical records without a mode are paid; do not reset them or switch modes after an uncertain outcome. View your workspace allowance →
import { x402Client } from '@x402/core/client' import { ExactEvmScheme } from '@x402/evm/exact/client' import { wrapFetchWithPayment } from '@x402/fetch' import { createCommerceClient, apiPurchasePolicy, BASE_USDC } from '@onchaindiligence/sdk/commerce' import { NodeFileRecoveryStore } from '@onchaindiligence/sdk/commerce/node' // Pays the $0.01 preflight fee from your dedicated fee wallet. Never hard-code a key. if (!process.env.OCD_API_KEY) throw new Error('Set OCD_API_KEY first') const paidFetch = wrapFetchWithPayment(globalThis.fetch.bind(globalThis), new x402Client().register('eip155:8453', new ExactEvmScheme(feePayer))) const ocd = createCommerceClient({ preflightMode: 'paid', accountApiKey: process.env.OCD_API_KEY, recovery: new NodeFileRecoveryStore('./ocd-recovery'), fetch: paidFetch }) const { policy } = apiPurchasePolicy({ maxAmount: '1.00', allowedNetwork: 'eip155:8453', allowedAsset: BASE_USDC }) const op = await ocd.open({ action: proposedPayment, policy }) const preflight = await op.preflight() // OCD records the declared payment and evaluates your policy if (preflight.kind !== 'ready') return handle(preflight) // blocked, approval-required, pending or error: call no executor const execution = await op.execute({ executor: myExecutor }) // your wallet/executor authorizes, signs and submits if (execution.kind !== 'execution-recorded') return resumeLater(execution) // never replace an ambiguous payment const finalized = await op.observeAndFinalize() // OCD observes settlement onchain -- safe to retry while pending if (finalized.kind !== 'receipt-produced') return retryLater(finalized) // pending or terminal-error: no receipt yet const proof = await ocd.verifyReceipt(finalized.receipt) finalized.receipt.receipt.settlement.status // read each fact; never infer "success" from a receipt existing
ready carries an ALLOW decision; anything else means do not pay. Receipt proof VALID means cryptographic integrity and authenticity under the verifier contract only: read decision, execution, settlement and checks separately. It does not prove settlement, merchant fulfilment or payment authorization. The full walk-through, including provider claims and offline verification, is the autonomous payment reference.
npm install @onchaindiligence/sdk@0.10.1 @x402/core @x402/evm @x402/fetch ·
Package on npm → ·
The imports above are supported by SDK 0.10.1. Supply feePayer, proposedPayment, myExecutor and your result handlers; this excerpt is not the runnable mock quickstart.
Existing x402 client? SDK 0.10.1 exports withOcd(existingClient, { policy, accountApiKey, store, ocdFetch, onReceipt }). It supports only documented x402 v2 exact paths with canonical supported assets; v1, arbitrary tools and payment protocols are not intercepted. With a workspace key, the wrapper performs a free ownership read before the fee and aborts if ownership is not confirmed. Its default store is in-memory; even a durable store does not add the proxy’s stable purchase-attempt journal. A lost settlement response may still need manual recovery. See the supported wrapper setup and limits.
Five entry points.
Clear responsibilities.
Commerce SDK
Connect your executor to preflight, observation, reconciliation, recovery and Action Receipts. Your wallet keeps control of spending.
TypeScript quickstart →Published MIT prerelease · nextAuto-Evidence
Run one configured economic MCP tool through a local OCD evidence path. The agent calls the tool normally; your executor still pays.
How it works →Free · publicInspect & verify
Public MCP for proposed-payment inspection, observation receipts for completed payments, and public receipt retrieval/verification. No wallet authorization or payment execution.
https://mcp.onchaindiligence.com/public/mcpClaude setup below →Free · HTTPReceipt for a past payment
Already paid without OCD? Send the network and transaction reference; OCD independently observes the chain and returns a signed receipt. Its decision is UNKNOWN: it never claims OCD authorized the payment.
POST https://mcp.onchaindiligence.com/observe-paymentObserve-payment docs →Paid · x402Evidence providers
The separate paid MCP surface provides evidence services using x402. It is not exposed through the free Plugin.
https://mcp.onchaindiligence.com/mcpPaid MCP documentation →Available in ChatGPT & Codex through the published OnChainDiligence Plugin. Available in Claude through the Claude Marketplace. The free public MCP exposes four evidence tools: inspection, observation-receipt creation for completed payments, and public receipt retrieval and verification. It does not expose paid MCP capability or execute payments. Two paid x402 routes — sanctions screening and payment preflight — are listed in Coinbase’s public x402 Bazaar discovery index; a listing is discoverability, not an endorsement. Agent instructions → skill.md
A2A 1.0
Capability discovery and evidence access for autonomous agents.
Agent Card: https://mcp.onchaindiligence.com/.well-known/agent-card.json
JSON-RPC endpoint: https://mcp.onchaindiligence.com/a2a
Exactly three advertised skills: inspect-payment, get-receipt, verify-receipt. Discover the card and use its descriptions/examples to select a capability. Compatible with the official A2A CLI.
A2A is separate from the four-tool public MCP and is intentionally narrower: no receipt creation, payment execution, wallet signing, private/workspace tools, paid x402 tools or agent provenance mutation. It does not authorize spending. Caller identity is not payment provenance; VALID means cryptographic integrity under the verifier contract only, not safety, compliance, authorization, settlement or service delivery. Agent instructions →
Configure a supported flow once.
Evidence follows each call.
Auto-Evidence is a local stdio MCP proxy that sits between an agent host and one upstream MCP server. Ordinary tools pass through unchanged. For each economic tool you register in a strict descriptor, a call runs through an OCD evidence path, and the agent uses the tool as it normally would.
What a supported flow needs. Configured economic tools must carry the exact final amount, network, asset and recipient, plus a stable purchase-attempt ID reused on retries; their result must return a transaction reference. The published descriptorless x402 path supports v2 exact Base USDC by default, or opt-in Solana mainnet USDC with the documented optional dependencies. Free preflight requires a workspace API key, explicit preflightMode: 'free' and private persistent state, but no feeSigner. Your merchant-payment signer is still separate.
What it does not do. It does not make arbitrary tools work without configuration, and it guards only calls that go through it. Dispatch is automatic at most once per purchase-attempt ID within one local journal: a lost or uncertain response is never retried automatically, but this is not a global exactly-once guarantee. It does not prove merchant fulfilment, agent identity or authorization by your wallet. Upstream results are returned unchanged.
Install the published MIT prerelease by exact version: @onchaindiligence/auto-evidence-proxy@0.2.0-rc.0. The next tag points to it; latest remains older. Pin SDK 0.10.1 for free mode. Follow the published README for supported flows and Solana opt-in setup.
npm install @onchaindiligence/auto-evidence-proxy@0.2.0-rc.0 @onchaindiligence/sdk@0.10.1
import { resolve } from 'node:path'
import { openAutoEvidence } from '@onchaindiligence/auto-evidence-proxy'
const evidence = await openAutoEvidence({
accountApiKey: process.env.OCD_API_KEY,
preflightMode: 'free',
stateDir: resolve('./ocd-state'), // private persistent storage, not ephemeral disk
})
// Use evidence with a documented proxy flow; setup alone does not intercept payments.
// Close with await evidence.close() when your process stops.
Networks, executors,
and action evidence.
The MCP server and SDK are the source of truth for the exact current surface — this is a summary, not a substitute for reading the code.
ChatGPT, Claude, Gemini,
or ordinary TypeScript.
OCD exposes the same application/MCP interfaces from ChatGPT-style MCP/app environments, Claude MCP, Gemini or custom-tool/MCP environments, and ordinary TypeScript applications — one integration, not three. The application-level commerce hook above (not the model remembering to call a tool) is the real enforcement mechanism.
Retrieve and verify
a receipt, at no cost.
Use OnChainDiligence
with Claude.
Open the Claude Marketplace listing, or use the custom connector setup below. A free MCP connector lets an agent inspect a proposed payment before it is sent, ask OnChainDiligence to independently create evidence for a completed transaction, and retrieve/verify OCD receipts. It cannot send payments, sign wallet transactions, custody funds, authorize spending, reach private operations, or call the paid x402 MCP surface — it only produces and checks evidence.
- In Claude, go to Settings/Customize → Connectors → Add custom connector.
- Paste the server URL:
https://mcp.onchaindiligence.com/public/mcp - Name it OnChainDiligence. Authentication: None. Transport: Streamable HTTP.
- Click Add — no account, credentials, or setup required.
Try it against a real example receipt: OCD-RCP-NB51-QG4S-VCAN-Y57F →
"Inspect a $0.001 USDC payment on Base against a $1 maximum." "Create an OCD receipt for this completed Base transaction: 0x<hash>." "Retrieve OCD receipt OCD-RCP-NB51-QG4S-VCAN-Y57F." "Verify that receipt and tell me what it does and doesn't prove."
npm and PyPI.
Use OnChainDiligence
from an agent.
The MCP service is a separate callable interface from the Technocore signing DID. It exposes public-data diligence tools over Streamable HTTP and charges only after an agent approves a server-supplied x402 requirement.
- Connect an MCP client to
https://mcp.onchaindiligence.com/mcp. - Call
tools/listand choose a tool, such asscreen_wallet. - Call it once without payment. The response returns the exact x402 requirement in
structuredContent.accepts[0]. - Have the agent apply its own policy, then authorize the returned USDC requirement from its own wallet and retry with
_meta["x402/payment"]. - Read the signed result. The service is non-custodial: it never receives a wallet private key.
// Configure your MCP client with this public endpoint. const client = await connectMcp('https://mcp.onchaindiligence.com/mcp') const { tools } = await client.listTools() const unpaid = await client.callTool({ name: 'screen_wallet', arguments: { address: '0x0000000000000000000000000000000000000000' } }) const requirement = unpaid.structuredContent.accepts[0] // amount, asset, Base, recipient // Only after your agent's policy approves the server-supplied requirement: const payment = await createPaymentHeader(agentWallet, 1, requirement) const result = await client.callTool({ name: 'screen_wallet', arguments: { address }, _meta: { 'x402/payment': payment } })
The live service returned 10000 atomic USDC units ($0.01) for screen_wallet during validation on 2026-09-03. Do not hard-code that value: always use the requirement returned by the live server. MCP documentation →
Make your agent
independently verifiable.
ArcFX is the working example of this pattern, not a requirement for using it. Full spec: AGENT_EVIDENCE_INTEROP.md →
- Install
@onchaindiligence/agent-evidence - Construct Mandate / Evidence / Policy / Decision / Execution records
- Seal a bundle with
sealBundle - Publish signer lifecycle metadata at
/.well-known/agent-evidence-keys - Hand the bundle to an independent verifier — browser handoff or any transport
- Verifier resolves trust via
trustPolicyFromKeyRegistryor its own policy - Receive
VALID / INVALID / UNVERIFIABLE
import { trustPolicyFromKeyRegistry, verifyBundle } from '@onchaindiligence/agent-evidence' // Fetching is the caller's job -- the SDK stays offline-usable. const registry = await fetch('https://issuer.example/.well-known/agent-evidence-keys').then(r => r.json()) const policy = trustPolicyFromKeyRegistry(registry, { expectedIssuer: 'issuer', expectedEnvironment: 'production' }) const report = verifyBundle(bundle, policy) report.state // VALID | INVALID | UNVERIFIABLE
The contract, implementation
and tools are inspectable.
Start with the format and shared conformance corpus, construct or verify bundles in Python, then connect the existing API, SDK, CLI and MCP evidence sources.
Agent Evidence v0
Normative format, trust model and verification algorithm.
Read specification → SchemasPublic catalog
Stable Draft 2020-12 schema URLs for every v0 artifact.
Open catalog → PythonReference package
Deterministic builders, DSSE sealing and offline tri-state verification.
View package → TypeScriptAgent Evidence package
Public Node.js package for deterministic bundles, DSSE sealing and offline verification.
Install from npm → Production proofP1.8 reference bundle
Real Chainalysis and SEC evidence, policy-bound decision and withheld execution.
Inspect bundle → InteropConformance corpus
Language-neutral valid, invalid and unverifiable vectors.
Inspect vectors → TypeScriptSDK
Typed API client and offline attestation verification.
View SDK → CLICommand line
Call production checks and verify signed attestations offline.
View CLI → Agent toolsMCP server
Payment inspection, receipts and evidence-provider tools for agents over MCP.
Read MCP docs → BrowserAttestation verifier
Verify current API attestations against an explicit key record.
Open verifier →