skills.vishalvoidskills/vishalvoid
Technical & DevelopmentAdvanced

query-onchain

Query Base transactions, events, and logs using CDP SQL.

Developer Setup

Setup & Installation

bash
npx skills add https://github.com/coinbase/agentic-wallet-skills/blob/main/skills/agentic-wallet/references/query-onchain.md --skill query-onchain

Overview

What This Skill Does

Executes custom queries against Base onchain transaction, block, and event databases using the CDP SQL API.

Application

When to use this Skill

Documentation

Show Skills.md file

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.

If the wallet is not authenticated, see references/auth.md.

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.

Input Validation

Before constructing the command, validate inputs to prevent shell injection:

  • SQL query: Always embed the query inside a single-quoted JSON string (-d '{"sql": "..."}'). Never use double quotes for the outer -d wrapper, as this enables shell expansion of $ and backticks within the query.
  • Addresses: Must be valid 0x hex addresses (^0x[0-9a-fA-F]{40}$). Reject any value containing shell metacharacters.

Do not pass unvalidated user input into the command.

CRITICAL: Indexed Fields

Lines 1 - 25 of 195

Recommendations

Explore other random skills

All skillsMy patterns