The buyer script uses native fetch and ESM imports.
Prove Ontario's x402 rail with a 0.01 USDC trust scan
Run one paid request against Ontario's live agent-trust-scan endpoint. If it settles,
you have verified the full HTTP 402, payment, retry, and JSON response flow yourself. No account,
sales call, or API key.
Real-money boundary
This page makes it easy to spend 0.01 USDC on Base. Use a fresh funded wallet, never paste a seed phrase, and do not use a wallet that can spend more than you intend.
Preconditions
Put a private key in EVM_PRIVATE_KEY; do not paste a seed phrase.
The trust scan price is 10000 atomic USDC on Base.
The example scans Ontario's public x402 manifest.
Step 1 - probe without payment
The unpaid request should return HTTP 402 Payment Required with a machine-readable
x402 challenge for /api/x402/agent-trust-scan.
curl -i -X POST https://ontarioprotocol.com/api/x402/agent-trust-scan \
-H 'Content-Type: application/json' \
-d '{"target_url":"https://ontarioprotocol.com/.well-known/x402.json","agent_id":"external-builder-prove-rail"}'
- Expected status:
402 - Expected network:
base - Expected amount:
10000atomic USDC - Expected resource:
/api/x402/agent-trust-scan
Step 2 - pay and retry with the x402 fetch client
npm init -y npm install @x402/fetch @x402/evm viem
EVM_PRIVATE_KEY='0xREPLACE_WITH_FUNDED_BASE_WALLET_PRIVATE_KEY' \
node --input-type=module <<'NODE'
import { x402Client, wrapFetchWithPayment, x402HTTPClient } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const endpoint = "https://ontarioprotocol.com/api/x402/agent-trust-scan";
const body = {
target_url: "https://ontarioprotocol.com/.well-known/x402.json",
agent_id: "external-builder-prove-rail"
};
if (!process.env.EVM_PRIVATE_KEY || process.env.EVM_PRIVATE_KEY.includes("REPLACE_")) {
throw new Error("Set EVM_PRIVATE_KEY to a funded Base wallet private key.");
}
const signer = privateKeyToAccount(process.env.EVM_PRIVATE_KEY);
const client = new x402Client();
registerExactEvmScheme(client, { signer });
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const response = await fetchWithPayment(endpoint, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body)
});
const payload = await response.json();
const httpClient = new x402HTTPClient(client);
const payment = httpClient.getPaymentSettleResponse((name) => response.headers.get(name));
console.log(JSON.stringify({
http_status: response.status,
settled: payment?.success === true || payment?.status === "settled",
payment,
report_summary: {
trust_score: payload?.report?.trust_score,
issue_count: payload?.report?.issues?.length ?? null,
signal_count: payload?.report?.signals?.length ?? null
}
}, null, 2));
NODE
Step 3 - verify the settlement evidence
A successful proof has HTTP 200, a settled x402 payment response, and a full Base
transaction hash matching ^0x[0-9a-f]{64}$. Then confirm the same transaction appears
in Ontario's public treasury ledger.
curl -sS 'https://ontarioprotocol.com/api/treasury/ledger?limit=10' | jq .
payment.successis true or status is settledpayment.transactionis a full Base transaction hashhttps://ontarioprotocol.com/api/treasury/ledgerlater shows the same tx