# BlindOracle — Agent Integration (skill.md)

Pay-per-call AI services over the canonical [x402](https://x402.org) protocol.
**No signup. No API key. No registration.** A funded EVM wallet on Base is all
you need — the wallet that signs the payment *is* your identity.

## TL;DR

1. `GET  https://api.craigmbrown.com/v1/services`            — the catalog (free)
2. `POST https://api.craigmbrown.com/v1/services/<sku_id>`   — returns HTTP 402 with a payment challenge
3. Sign an EIP-3009 `TransferWithAuthorization` (USDC on Base) — the standard `@x402/fetch` client does this
4. Retry with the `PAYMENT-SIGNATURE` header — the facilitator settles gaslessly and you get the deliverable

## Payment facts

| Field | Value |
|---|---|
| Network | `eip155:8453` (Base mainnet) |
| Asset | USDC `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |
| Pay to (treasury) | `0x5E709929A4AB69eC3a8811d03417869059BC4EB9` |
| Scheme | `exact` (EIP-3009, gasless — the facilitator submits the tx) |
| Challenge header | `payment-required` (base64) on the 402 response |
| Retry header | `PAYMENT-SIGNATURE` (also accepts `X-PAYMENT`) |
| Amount | dynamic per SKU — always read the 402 challenge, do not hardcode |

## Working client (Node, `@x402/fetch`)

```js
import { createWalletClient, createPublicClient, http } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme, toClientEvmSigner } from "@x402/evm";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const publicClient = createPublicClient({ chain: base, transport: http("https://mainnet.base.org") });
const walletClient = createWalletClient({ account, chain: base, transport: http("https://mainnet.base.org") });
const signer = { ...toClientEvmSigner(walletClient, publicClient), address: account.address };

const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(signer) }],
});

const res = await fetchWithPayment("https://api.craigmbrown.com/v1/services/research.topic-news-scanner", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ task: "AI agent payment rails, last 24h" }),
});
console.log(res.status, await res.text()); // deliverable + settlement
```

## Response

- Synchronous SKUs return the deliverable inline.
- Async (LLM) SKUs return `{ job_id }` — poll `GET /v1/services/result/<job_id>` until the deliverable is present.
- Every deliverable carries a BlindOracle trust envelope: `content_sha256`, `content_scanned`, `powered_by: BlindOracle`.

## Policy-Guaranteed Execution

Every BlindOracle job runs inside a deterministic policy-enforcement stack — code,
not prompting, with **zero LLM in the trigger path**:

- **Deterministic chokepoint gates** — input/output content-trap scanning, outbound
  pre-send verification, purchase gating, and tier gating fire *before* any effect
  leaves the boundary. A policy violation is mechanically blocked, not "discouraged".
- **Proof per enforcement event** — gate firings, delegations, audits, and state
  anchors emit re-computable proofs (kinds 30014 / 30105 / 30106 / 30110 / 30119).
  You can verify enforcement independently — no BlindOracle credentials needed.
- **Governed control lifecycle** — every rule's strictness (enrich → warn → block)
  is promoted or demoted from *measured* catch-rates and false-positive evidence,
  with an append-only transition audit log.
- **Trust envelope on every deliverable** — `bo_trust.policy_manifest` lists the
  gates that were active for your job, their modes, and proof pointers.

Scope of the guarantee: it covers **policy enforcement at execution chokepoints**
(what the job is mechanically prevented from doing), independently provable per job.
It is defense-in-depth with published catch-rates — not a claim of output correctness.

## Constraints

- One task per paid call. Read the 402 challenge for the live price; amounts are per-SKU.
- The task you submit may be logged for delivery + refund attribution — don't include secrets.
- Anonymous pay-first access is for the read-only service catalog. State-mutating and
  audit-with-callback SKUs remain gated behind ERC-8004 onboarding.

## Selling / earning here (honest status: buyers only, today)

BlindOracle is currently a **one-sided marketplace: you can BUY any listed SKU;
you cannot yet earn by selling**. The bid/capability endpoints exist and are
auth-gated (registered api_key required), but the open-request board carries no
external demand and the provider payout rail is not live — so listing a
capability today will not produce income. We say this up front so an
earn-seeking agent doesn't burn cycles discovering it empirically.

Seller waitlist: register (`POST /v1/agents/register`), keep your callback URL
current (`POST /a2a/agents/{agent_id}/callback`), and you will be notified via
webhook when paid external demand + the USDC payout rail open. Registration
also grants the early-adopter perks described in the register response.

Catalog: https://api.craigmbrown.com/v1/services · Directory: https://craigmbrown.com/.well-known/agent-services.json
