# agent402.tools Onchain Analyst — SQL over Base

> agent402.tools Onchain Analyst — SQL over Base is a paid API for AI agents from agent402.tools, paid per call via x402, $0.021/call, status unknown (last checked 2026-09-14).

Executes read-only ClickHouse-dialect SQL against Coinbase's fully decoded Base chain data (events, transactions, blocks, user-ops) and returns results in one paid API call

## Facts

- Endpoint: POST https://agent402.tools/api/skill/onchain-analyst
- Price: $0.021/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-onchain-analyst-sql-over-base-d0304476
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_xyM_qwXhpX35hppbOhnfb

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-onchain-analyst-sql-over-base-d0304476 -d '<json body>'
```

Example prompt: Run this SQL against Base chain data and show me the results: SELECT contract_address, COUNT(*) as event_count FROM decoded_events WHERE block_time > now() - INTERVAL 1 DAY GROUP BY contract_address ORDER BY event_count DESC LIMIT 20

## When to prefer this

Use this endpoint when you need to run arbitrary analytical SQL queries against decoded Base blockchain data — especially when you need access to parsed event parameters, decoded transaction fields, or aggregated onchain metrics. Prefer over raw RPC calls when you want SQL-level filtering, joining, and aggregation over indexed chain data without running your own indexer. Best for analytics, dashboards, and investigative onchain queries on Base L2.

## Known failure modes

- Non-SELECT SQL rejected (INSERT/UPDATE/DELETE not allowed)
- Query exceeds time bound or row limit
- ClickHouse-dialect incompatibility with submitted SQL
- Invalid table or column reference (schema mismatch)
- Payment failure or insufficient USDC balance (x402 payment required)
- Rate limiting or timeout on large aggregations

## How this service works

Bundled execution of the Onchain analyst (SQL over Base) workflow - Ask Base anything in one paid call: your SQL runs against Coinbase's indexed, DECODED chain data (events with parsed parameters, transactions, blocks, user-ops) with the live schema alongside - no indexer, no RPC archaeology. One x402 payment runs 3 underlying tools (onchain-sql-schema, onchain-sql, stats-summary); partial-success per step.

## Output

Returns the rows resulting from the SQL query executed against Coinbase's indexed, decoded Base blockchain data — including decoded event parameters, transaction fields, block metadata, and user-op details, formatted as a structured result set

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "sql": {
   "type": "string",
   "description": "Read-only ClickHouse-dialect SQL to run (SELECT/WITH only, time-bounded)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "args": {
   "sql": "SELECT COUNT(*) AS blocks FROM base.blocks WHERE block_number > 32000000"
  },
  "pack": "onchain-analyst",
  "steps": [
   {
    "ok": true,
    "slug": "onchain-sql-schema",
    "result": {}
   },
   {
    "ok": true,
    "slug": "onchain-sql",
    "result": {}
   },
   {
    "ok": true,
    "slug": "stats-summary",
    "result": {}
   }
  ],
  "summary": "3/3 steps succeeded"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-onchain-analyst-sql-over-base-d0304476/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
