{"uid":"cap_S6lJirBZM_-n6ADJZIL0z","slug":"agent402-tools-onchain-sql-5c983a9b","name":"agent402.tools Onchain SQL","description":"Run read-only SQL against Coinbase's indexed, DECODED blockchain data - base.events (decoded logs with parameters), base.transactions, base.blocks, base.decoded_user_operations, base.transaction_attributions (builder codes), plus solana.instructions and hyperevm.events. ClickHouse-dialect SELECTs, server-side grammar validation, up to 50k rows / 30s / 12 joins. Ask Base anything - token flows, event analytics, gas studies - in one call, no indexer to run.","url":"https://agent402.tools/api/onchain-sql","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"sql":{"type":"string","description":"Read-only SELECT (ClickHouse dialect, max 10,000 chars). Tables: base.events, base.transactions, base.blocks, base.encoded_logs, base.decoded_user_operations, base.transaction_attributions, base_sepolia.*, solana.instructions, hyperevm.events"},"cacheSeconds":{"type":"number","description":"Accept cached results up to this old (max 900). Cheaper + faster for repeated analytics."}}},"responseSchema":{"type":"json","example":{"rows":[{"txs":123456}],"rowCount":1}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"1.00","reviews":0,"stars":null,"state":"rated"},"availabilityStatus":"healthy","priceObserved":{"p10Cents":"2.0000","medianCents":"2.0000","p90Cents":"2.0000","minCents":"2.0000","maxCents":"2.0000","p95Cents":"2.0000","sampleCount":2,"varies":false,"failureChargeRate":null},"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_nlPGkZCGYOEiGEkbit0kM","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Run read-only ClickHouse SQL queries against decoded, indexed blockchain data for Base, Base Sepolia, Solana, and HyperEVM networks","exampleAgentPrompt":"Can you query the Base blockchain for the top 10 contracts by number of decoded events in the last 1000 blocks? Run a SELECT against base.events grouped by contract address, and cache results for 300 seconds to save cost.","exampleUseCases":null,"resultDescription":"Returns rows matching the SQL query from Coinbase's indexed decoded blockchain tables — including decoded log parameters, transaction hashes, block numbers, addresses, and other onchain fields depending on which tables are queried.","failureModes":["Invalid SQL syntax returns a parse or execution error","Queries exceeding 10,000 characters are rejected","Non-SELECT statements (INSERT, UPDATE, DROP) are rejected as read-only enforcement","Referencing tables outside the allowed schema returns an unknown table error","Cache miss on cold query may take longer than expected","Payment failure via x402 returns 402 with payment details","Query result set too large may be truncated or timeout"],"whenToPreferThis":"Use this endpoint when you need to run arbitrary analytical SQL against decoded, indexed Base, Solana, or HyperEVM blockchain data — especially when you need decoded event parameters rather than raw hex logs, or when you want to aggregate and filter onchain activity with full SQL expressiveness. Prefer this over block explorer APIs when you need joins, aggregations, or custom WHERE clauses across millions of rows.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":2,"lastUsedAt":"2026-08-28T00:54:15.797Z","lastSuccessfullyRanAt":"2026-08-28T00:54:15.797Z","lastHealthCheckAt":"2026-09-14T19:14:05.146Z","isFirstParty":false}