For developers

Add independent reconciliation
to your existing agent.

Keep your wallet and executor. Start with the published MIT SDK 0.10.1 and authenticated free preflight, then connect one supported payment flow to your workspace. The wallet enforces and signs; OCD records and reconciles.

Start here · TypeScript commerce SDK

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.

  1. 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_KEY through your secret manager or local environment; never put it in browser code, logs or source control. Pass it as accountApiKey so new operations belong to your workspace. It does not authorize wallet spending.
  2. Install in your application.
    npm install @onchaindiligence/sdk@0.10.1
    Published package · SDK documentation.
  3. Configure durable recovery. Use NodeFileRecoveryStore on private persistent disk for a single deployment, or implement CommerceRecoveryStore against 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, use ocd.open({ operationId, action, policy }) with the same store and free mode before retrying op.preflight(). ocd.load(operationId) alone does not restore pending preflight inputs; never create a replacement operation because a response is ambiguous.
  4. 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.
  5. 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.
  6. 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:
    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
    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.
Free preflight · authenticated and bounded100 completed evaluations per workspace per UTC month, including 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.
Production free preflight · no payment execution
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.

Legacy paid mode remains an explicit alternativePaid preflight costs 0.01 USDC on Base, including evaluations returning 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 →

Production integration excerpt · paid · inside your async handler
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.

Choose your path

Five entry points.
Clear responsibilities.

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

Public agent interface

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 →

Published MIT prerelease · next tag

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.

1 · Declared and checked

Before the tool runs, OCD records the declared payment (exact amount, network, asset and recipient) and checks it against your policy. Only ALLOW proceeds.

2 · Your executor stays in control

The upstream tool and its wallet or executor authorize, sign and send. OCD never receives wallet keys.

3 · Reference captured

The proxy captures the transaction reference the tool returns. It is kept as the executor’s report, not as settlement.

4 · Settlement observed

OCD independently observes the supported onchain settlement for that reference.

5 · Reconciled

What was declared, reported and settled is compared through OCD’s existing finalizer. Mismatches and gaps stay explicit.

6 · Evidence retrievable

A proxy-owned status tool returns the operation and receipt state, and can resume evidence. It never runs the purchase again.

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.

Proxy free-mode setup · configured flows only
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.
What's shipped today

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.

Settlement networks

Independent settlement observation: Base and Ethereum USDC, Tempo pathUSD and Solana USDC. Network observation is not native support for every payment protocol on that network. Start this pilot on Base USDC.

Commerce executors

Turnkey, Crossmint, Coinbase CDP and Circle executor adapters have provider-specific setup and recovery contracts. PayBox has an SDK adapter seam, not a proven native integration. No native FLOP, Tempo MPP or Stripe MPP commerce integration is claimed. Check the SDK documentation for exact restrictions.

Action evidence

Allowance, swap, bridge, and Lido staking — each with its own preflight validation and independent settlement observation, priced and payment-gated over MCP.

Same tools, any agent runtime

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.

Free, always

Retrieve and verify
a receipt, at no cost.

get_receipt

Retrieval is free — look up any public receipt by ID, over MCP or the resolver.

verify_receipt

Verification is free. Online verification against OCD’s own key registry is convenient; independent/offline verification remains available for callers who want to run it themselves — see Verify.

Claude Marketplace · Free public MCP

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.

  1. In Claude, go to Settings/Customize → Connectors → Add custom connector.
  2. Paste the server URL: https://mcp.onchaindiligence.com/public/mcp
  3. Name it OnChainDiligence. Authentication: None. Transport: Streamable HTTP.
  4. Click Add — no account, credentials, or setup required.

inspect_payment

Compare a proposed payment against your policy: ALLOW, REQUIRE_APPROVAL or BLOCK. Deterministic only — no external lookups, signing or payment.

get_receipt

Retrieve a public, signed OCD receipt by its exact receipt ID.

create_payment_receipt

For a completed supported payment, independently observe the exact network and transaction reference and create or return a signed observation-only receipt (decision UNKNOWN). Evidence only: it never sends or authorizes a payment, and does not show which agent made it. If pending, retry the same request.

verify_receipt

Check a receipt’s proof: VALID, INVALID or UNVERIFIABLE.

Try it against a real example receipt: OCD-RCP-NB51-QG4S-VCAN-Y57F →

example prompts, once the connector is added
"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."
Install

npm and PyPI.

TypeScript / npm

Published and installable today.

npm install @onchaindiligence/agent-evidence →

Python

onchaindiligence-agent-evidence — source and tests are public on GitHub. Not yet published to PyPI; install from source until it is.

View the Python package →

Compliance API

The underlying Evidence Provider checks, callable directly over HTTP or MCP.

Read the API docs →
Callable service

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.

  1. Connect an MCP client to https://mcp.onchaindiligence.com/mcp.
  2. Call tools/list and choose a tool, such as screen_wallet.
  3. Call it once without payment. The response returns the exact x402 requirement in structuredContent.accepts[0].
  4. Have the agent apply its own policy, then authorize the returned USDC requirement from its own wallet and retry with _meta["x402/payment"].
  5. Read the signed result. The service is non-custodial: it never receives a wallet private key.
minimal screen_wallet flow
// 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 →

Agent Evidence Interoperability Profile v1

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 →

  1. Install @onchaindiligence/agent-evidence
  2. Construct Mandate / Evidence / Policy / Decision / Execution records
  3. Seal a bundle with sealBundle
  4. Publish signer lifecycle metadata at /.well-known/agent-evidence-keys
  5. Hand the bundle to an independent verifier — browser handoff or any transport
  6. Verifier resolves trust via trustPolicyFromKeyRegistry or its own policy
  7. Receive VALID / INVALID / UNVERIFIABLE
verify.ts
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