Onchain SQL schema
GET /api/onchain-sql-schemaThe table + column schema for the onchain-sql tool - every queryable table (base.events, base.transactions, base.blocks, base.decoded_user_operations, base.transaction_attributions, solana.instructions, …) with its columns and types. Send GET /api/onchain-sql-schema with no input and pay $0.002 per call over x402 or MPP (there is no free tier). It returns a JSON object with schema.
Fetch once, then write SQL with confidence.
Parameters
Onchain SQL schema takes no parameters.
Example request
curl -i "https://agent402.tools/api/onchain-sql-schema"
Without payment this returns HTTP 402 Payment Required with the exact price for onchain-sql-schema; any x402 v2 or MPP client pays it and retries.
Example response
{
"schema": {
"base.events": [
{
"name": "block_number",
"type": "UInt64"
}
]
}
}| Field | Type | Always present | In the example |
|---|---|---|---|
schema | object | yes | 1 field: base.events |
From an MCP client
catalog.call {
"slug": "onchain-sql-schema",
"params": {}
}The hosted connector at https://agent402.tools/mcp needs a payment for onchain-sql-schema; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.13.32.
Errors and behavior
- There is no input to get wrong: any request to /api/onchain-sql-schema runs the tool.
- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement runs after the tool and only on a successful response. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
POSTwith a JSON body to /api/onchain-sql-schema is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.002" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/onchain-sql-schema");Part of these workflows
Onchain SQL schema is one step in this skill pack, each sold as a single call:
- Onchain analyst (SQL over Base) - Ask Base anything in one paid call: your SQL runs against indexed, DECODED chain data (events with parsed parameters, transactions, blocks, user-ops) with the live schema alongside - no indexer, no RPC archaeology.
Related tools
Onchain SQL (query Base with SQL)
Run read-only SQL against indexed, DECODED blockchain data - base.events (decoded logs with parameters).
Onramp link (fund a wallet with a card)
Generate a single-use hosted onramp URL that lets a human fund any wallet with a card or Apple Pay - the fastest way.
Testnet faucet (try x402 free)
Fund any address with testnet money from a testnet faucet - USDC (1) or ETH (0.0001) on Base Sepolia, USDC (1) or SOL.
Wallet token balances (indexed)
All token balances for any address in one call, from an indexed chain-data API - ERC-20 + native on EVM, SPL on Solana.
My usage (wallet-keyed purchase history)
Your own purchase history, keyed to the wallet that pays for the call - no wallet parameter, no signup: the x402 payment.
x402 seller dossier
Everything Agent402 knows about one x402 seller origin, in one read: identity and crawl history, the catalog.