query-onchain-data

Installation
Summary

Query onchain data on Base using SQL with per-query x402 payments.

  • Access decoded events, transactions, and blocks via CoinbaseQL, a ClickHouse-based SQL dialect supporting joins, CTEs, subqueries, and standard functions
  • Three main tables available: base.events (decoded smart contract logs), base.transactions (full transaction data), and base.blocks (block metadata)
  • Requires filtering on indexed fields (event_signature, address, block_timestamp) in event queries to avoid full table scans; use event_signature instead of event_name for performance
  • Each query costs $0.10 USDC; wallet must be authenticated and funded before execution
  • Supports address normalization with lower() function and time-bounded queries for efficient data retrieval
SKILL.md

Query Onchain Data on Base

Use the CDP SQL API to query onchain data (events, transactions, blocks, transfers) on Base. Queries are executed via x402 and are charged per query.

Confirm wallet is initialized and authed

npx awal@2.10.0 status

If the wallet is not authenticated, refer to the authenticate-wallet skill.

Executing a Query

npx awal@2.10.0 x402 pay https://x402.cdp.coinbase.com/platform/v2/data/query/run -X POST -d '{"sql": "<YOUR_QUERY>"}' --json

IMPORTANT: Always single-quote the -d JSON string to prevent bash variable expansion.

Related skills

More from coinbase/agentic-wallet-skills

Installs
1.8K
GitHub Stars
105
First Seen
Feb 12, 2026