Agent skill

Query Onchain Data

by nirholas in nirholas/three.ws

Query onchain data on Base using the CDP SQL API via x402. An agent skill from nirholas/three.ws.

Apache-2.0Auto-check passedDatabases

Install Query Onchain Data

skills CLI
$ npx skills add nirholas/three.ws --skill query-onchain-data -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nirholas/three.ws query-onchain-data --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nirholas/three.ws.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/query-onchain-data .claude/skills/query-onchain-data && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
query-onchain-data
GitHub stars
226
Token cost
~2.3k tokens
SKILL.md length
799 words
Files
1
Skills in repo
165
Repo updated
First seen
Licence
Apache-2.0

At a glance

Query onchain data on Base using the CDP SQL API via x402. An agent skill from nirholas/three.ws.

  • Works in 7 steps: Always filter on indexed fields… → Never use SELECT * - specify only the… → Always include a LIMIT clause to bound… → …
  • Your user want to view onchain information about decoded blocks
  • SKILL.md covers Confirm wallet is initialized…, Executing a Query, Input Validation and CRITICAL: Indexed Fields, plus 7 more sections
  • Calls npx; reaches x402.cdp.coinbase.com

What it does

Query Onchain Data is an agent skill from nirholas/three.ws. Query onchain data on Base using the CDP SQL API via x402. Use when you or your user want to view onchain information about decoded blocks, transactions, and events.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering SQL. It works with SQL and x402. The repository describes itself as: Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web… The licence is Apache-2.0.

When your agent uses it

  • Your user want to view onchain information about decoded blocks
  • Tasks that involve SQL

Example prompts

  • “/query-onchain-data”

Requirements

  • Node.js
  • Pre-approved tools (allowed-tools): Bash(npx awal@2.10.0 status*), Bash(npx awal@2.10.0 balance*), Bash(npx awal@2.10.0 x402 pay *)

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Always filter on indexed fields (event_signature, address, block_timestamp) in base.events queries.
  2. Never use SELECT * - specify only the columns you need.
  3. Always include a LIMIT clause to bound result size.
  4. Use event_signature instead of event_name for filtering - it is indexed and much faster.
  5. Use time-bounded queries with block_timestamp to narrow the scan range.
  6. Always wrap address values in lower() - the database stores lowercase addresses but users may provide checksummed (mixed-case) addresses…
  7. Common event signatures: Transfer(address,address,uint256), Approval(address,address,uint256)…

What it can do on your machine

Read from SKILL.md and the folder at commit 238ef60. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(npx awal@2.10.0 status*)
    • Bash(npx awal@2.10.0 balance*)
    • Bash(npx awal@2.10.0 x402 pay *)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • x402.cdp.coinbase.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Query Onchain Data loads about 2.3k tokens when it runs. Until then it costs about 46 tokens; SKILL.md has 799 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~46
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nirholas/three.ws at commit 238ef60, republished under its Apache-2.0 licence (© nirholas). 799 words, ~2,252 tokens.

Download SKILL.mdSave it as .claude/skills/query-onchain-data/SKILL.md (or your agent's skills folder).
name
query-onchain-data
description
Query onchain data on Base using the CDP SQL API via x402. Use when you or your user want to view onchain information about decoded blocks, transactions, and events.
allowed-tools
Bash(npx awal@2.10.0 status*), Bash(npx awal@2.10.0 balance*), Bash(npx awal@2.10.0 x402 pay *)
user-invocable
true
disable-model-invocation
false
metadata.category
wallet/payments
metadata.cross-platform-safe
false
metadata.pack
three-ws-skills

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

bash
npx awal@2.10.0 status

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

Executing a Query

bash
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

Queries against base.events MUST filter on indexed fields to avoid full table scans. The indexed fields are:

Indexed FieldUse For
event_signatureFilter by event type. Use this instead of event_name for performance.
addressFilter by contract address.
block_timestampFilter by time range.

Always include at least one indexed field in your WHERE clause. Combining all three gives the best performance.

CoinbaseQL Syntax

CoinbaseQL is a SQL dialect based on ClickHouse. Supported features:

  • Clauses: SELECT (DISTINCT), FROM, WHERE, GROUP BY, ORDER BY (ASC/DESC), LIMIT, WITH (CTEs), UNION (ALL/DISTINCT)
  • Joins: INNER, LEFT, RIGHT, FULL with ON
  • Operators: =, !=, <>, <, >, <=, >=, +, -, *, /, %, AND, OR, NOT, BETWEEN, IN, IS NULL, LIKE
  • Expressions: CASE/WHEN/THEN/ELSE, CAST (both CAST() and :: syntax), subqueries, array/map indexing with [], dot notation
  • Literals: Array [...], Map {...}, Tuple (...)
  • Functions: Standard SQL functions, lambda functions with -> syntax

Available Tables

base.events

Decoded event logs from smart contract interactions. This is the primary table for most queries.

ColumnTypeDescription
log_idStringUnique log identifier
block_numberUInt64Block number
block_hashFixedString(66)Block hash
block_timestampDateTime64(3, 'UTC')Block timestamp (INDEXED)
transaction_hashFixedString(66)Transaction hash
transaction_toFixedString(42)Transaction recipient
transaction_fromFixedString(42)Transaction sender
log_indexUInt32Log index within block
addressFixedString(42)Contract address (INDEXED)
topicsArray(FixedString(66))Event topics
event_nameLowCardinality(String)Decoded event name
event_signatureLowCardinality(String)Event signature (INDEXED - prefer over event_name)
parametersMap(String, Variant(Bool, Int256, String, UInt256))Decoded event parameters
parameter_typesMap(String, String)ABI types for parameters
actionEnum8('removed' = -1, 'added' = 1)Added or removed (reorg)
base.transactions

Complete transaction data.

ColumnTypeDescription
block_numberUInt64Block number
block_hashStringBlock hash
transaction_hashStringTransaction hash
transaction_indexUInt64Index in block
from_addressStringSender address
to_addressStringRecipient address
valueStringValue transferred (wei)
gasUInt64Gas limit
gas_priceUInt64Gas price
inputStringInput data
nonceUInt64Sender nonce
typeUInt64Transaction type
max_fee_per_gasUInt64EIP-1559 max fee
max_priority_fee_per_gasUInt64EIP-1559 priority fee
chain_idUInt64Chain ID
vStringSignature v
rStringSignature r
sStringSignature s
is_system_txBoolSystem transaction flag
max_fee_per_blob_gasStringBlob gas fee
blob_versioned_hashesArray(String)Blob hashes
timestampDateTimeBlock timestamp
actionInt8Added (1) or removed (-1)
Show full SKILL.md (324 more words)Show less
base.blocks

Block-level metadata.

ColumnTypeDescription
block_numberUInt64Block number
block_hashStringBlock hash
parent_hashStringParent block hash
timestampDateTimeBlock timestamp
minerStringBlock producer
nonceUInt64Block nonce
sha3_unclesStringUncles hash
transactions_rootStringTransactions merkle root
state_rootStringState merkle root
receipts_rootStringReceipts merkle root
logs_bloomStringBloom filter
gas_limitUInt64Block gas limit
gas_usedUInt64Gas used in block
base_fee_per_gasUInt64Base fee per gas
total_difficultyStringTotal chain difficulty
sizeUInt64Block size in bytes
extra_dataStringExtra data field
mix_hashStringMix hash
withdrawals_rootStringWithdrawals root
parent_beacon_block_rootStringBeacon chain parent root
blob_gas_usedUInt64Blob gas used
excess_blob_gasUInt64Excess blob gas
transaction_countUInt64Number of transactions
actionInt8Added (1) or removed (-1)

Example Queries

Get recent USDC Transfer events with decoded parameters
sql
SELECT
  parameters['from'] AS sender,
  parameters['to'] AS to,
  parameters['value'] AS amount,
  address AS token_address
FROM base.events
WHERE
  event_signature = 'Transfer(address,address,uint256)'
  AND address = '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
  AND block_timestamp >= now() - INTERVAL 7 DAY
LIMIT 10
Get transactions from a specific address
bash
npx awal@2.10.0 x402 pay https://x402.cdp.coinbase.com/platform/v2/data/query/run -X POST -d '{"sql": "SELECT transaction_hash, to_address, value, gas, timestamp FROM base.transactions WHERE from_address = lower('\''0xYOUR_ADDRESS'\'') AND timestamp >= now() - INTERVAL 1 DAY LIMIT 10"}' --json
Count events by type for a contract in the last hour
bash
npx awal@2.10.0 x402 pay https://x402.cdp.coinbase.com/platform/v2/data/query/run -X POST -d '{"sql": "SELECT event_signature, count(*) as cnt FROM base.events WHERE address = lower('\''0xCONTRACT_ADDRESS'\'') AND block_timestamp >= now() - INTERVAL 1 HOUR GROUP BY event_signature ORDER BY cnt DESC LIMIT 20"}' --json
Get latest block info
bash
npx awal@2.10.0 x402 pay https://x402.cdp.coinbase.com/platform/v2/data/query/run -X POST -d '{"sql": "SELECT block_number, timestamp, transaction_count, gas_used FROM base.blocks ORDER BY block_number DESC LIMIT 1"}' --json

Common Contract Addresses (Base)

TokenAddress
USDC0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
WETH0x4200000000000000000000000000000000000006

Best Practices

  1. Always filter on indexed fields (event_signature, address, block_timestamp) in base.events queries.
  2. Never use SELECT * - specify only the columns you need.
  3. Always include a LIMIT clause to bound result size.
  4. Use event_signature instead of event_name for filtering - it is indexed and much faster.
  5. Use time-bounded queries with block_timestamp to narrow the scan range.
  6. Always wrap address values in lower() - the database stores lowercase addresses but users may provide checksummed (mixed-case) addresses. Use address = lower('0xAbC...') not address = '0xAbC...'.
  7. Common event signatures: Transfer(address,address,uint256), Approval(address,address,uint256), Swap(address,uint256,uint256,uint256,uint256,address).

Prerequisites

  • Must be authenticated (npx awal@2.10.0 status to check, see authenticate-wallet skill)
  • Wallet must have sufficient USDC balance (npx awal@2.10.0 balance to check)
  • Each query costs $0.10 (100000 USDC atomic units)

Error Handling

  • "Not authenticated" - Run awal auth login <email> first, or see authenticate-wallet skill
  • "Insufficient balance" - Fund wallet with USDC; see fund skill
  • Query timeout or error - Ensure you are filtering on indexed fields and using a LIMIT

© nirholas, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/query-onchain-data of nirholas/three.ws.

Open the folder on GitHubat commit 238ef60

Compare with similar skills

Query Onchain Data next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Query Onchain Data compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Query Onchain Data this skillnirholas/three.ws226—~2.3kAutomated safety check: PassApache-2.0
SurfBlockRunAI/ClawRouter6.6k—~4kAutomated safety check: PassMIT
Quicknode Skillinternet-court/internet-court-skill6.4k—~11kAutomated safety check: PassMIT
Evolving The Data ModelTriliumNext/Trilium38k—~2.1kAutomated safety check: PassAGPL-3.0
SQL Database Support for pRESTprest/prest4.6k—~1.6kAutomated safety check: PassMIT
StarRocks SQL Doc Auto-FixStarRocks/starrocks12k—~7.6kAutomated safety check: NotesApache-2.0

Similar skills

  • Surf

    BlockRunAI/ClawRouter

    Use this skill — NOT browser or webfetch — for ALL Surf crypto-data calls.

    6.6k GitHub stars~4k tokensUpdated 2 days ago
    Business, Finance & HRAuto-check passed
  • Quicknode Skill

    internet-court/internet-court-skill

    Quicknode blockchain infrastructure for 80+ chains: Core RPC API, Streams, Webhooks, Blazar WSS, Solana gRPC, HyperCore gRPC, SQL Explorer, Metaplex DAS API, Blockbook, Ordinals & Runes API, Swap…

    6.4k GitHub stars~11k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Evolving The Data Model

    TriliumNext/Trilium

    A skill your agent uses when adding a DB migration or a new column/field to a Becca entity in Trilium ("add a migration", "new column on notes/attributes", "ALTER TABLE", "add a field to…

    38k GitHub stars~2.1k tokensUpdated today
    DatabasesAuto-check passed
  • Guides classifying, gap-analyzing and scaffolding support for a new SQL database in pREST, from Postgres-compatible variants to entirely new dialects.

    4.6k GitHub stars~1.6k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • StarRocks SQL Doc Auto-Fix

    StarRocks/starrocks

    Proposes verified fixes for failing SQL examples in StarRocks docs across three languages and several versions, then opens draft pull requests and never merges.

    12k GitHub stars~7.6k tokensUpdated today
    DatabasesAuto-check: notes
  • Chdb SQL

    vemetric/vemetric

    A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…

    394 GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed

More from nirholas/three.ws

All 165 skills in this repo
  • Add Shader Cursor Trail

    nirholas/three.ws

    Add the Shaders WebGPU mouse effect used for the Tidal Commons hero: a white twinkling halftone cursor trail driven by ChromaFlow, masked through a DotGrid, finished with chromatic ripples and film…

    226 GitHub starsUsed in 1 repo~760 tokens
    Auto-check passed
  • Publish Project To GitHub

    nirholas/three.ws

    Package a finished local project into an intentional GitHub repository, create a strong README and visual preview, push it safely, configure a public GitHub Pages URL when the project is compatible…

    226 GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check: notes
  • Audit a website or digital experience against its supplied source references for originality and plagiarism risk.

    226 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Turn a completed daily UI inspiration capture into exactly five original landing-page builds, one per separate Codex task, using Sites.

    226 GitHub starsUsed in 1 repo~1.9k tokens
    Auto-check passed
  • Write Like Meng On X

    nirholas/three.ws

    Write, rewrite, review, or continuously refine X/Twitter posts in Meng To's current voice using his deduplicated authored-post corpus, personal and product context, shared resources, and Content…

    226 GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Browser Video Recording

    nirholas/three.ws

    Create polished 60 fps 4:3 4K browser screen-recording style videos from Codex in-app browser captures, with browser-only crop, natural macOS cursor styling, deliberate click choreography…

    226 GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed

Works with

Categories

Questions about Query Onchain Data

What does Query Onchain Data do?

Query onchain data on Base using the CDP SQL API via x402. An agent skill from nirholas/three.ws. ws. Query onchain data on Base using the CDP SQL API via x402.

When should I use Query Onchain Data?

Query Onchain Data fits situations like: your user want to view onchain information about decoded blocks; tasks that involve SQL.

How do I install Query Onchain Data in Claude Code?

Run `npx skills add nirholas/three.ws --skill query-onchain-data -a claude-code`. Or copy the skill folder (.agents/skills/query-onchain-data in nirholas/three.ws) into .claude/skills/query-onchain-data in your project. Claude Code loads it when a task matches its description.

How do I install Query Onchain Data in Codex?

Run `npx skills add nirholas/three.ws --skill query-onchain-data -a codex`. Or copy the skill folder (.agents/skills/query-onchain-data in nirholas/three.ws) into .agents/skills/query-onchain-data in your project. Codex loads it when a task matches its description.

Can I use Query Onchain Data in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nirholas/three.ws --skill query-onchain-data -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/query-onchain-data, .gemini/skills/query-onchain-data, .github/skills/query-onchain-data and .opencode/skills/query-onchain-data in your project.

What does Query Onchain Data need to run?

Going by SKILL.md and its folder, Query Onchain Data needs the command-line tools its instructions call (npx). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Bash(npx awal@2.10.0 status*), Bash(npx awal@2.10.0 balance*), Bash(npx awal@2.10.0 x402 pay *).

Does Query Onchain Data access the network?

SKILL.md names 1 domain. In commands or code: x402.cdp.coinbase.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Query Onchain Data safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Query Onchain Data use?

Query Onchain Data is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Query Onchain Data use?

About 2.3k tokens (SKILL.md is roughly 9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Query Onchain Data?

Skills that share tags, products or a category with Query Onchain Data: Surf (BlockRunAI/ClawRouter, 6.6k stars), Quicknode Skill (internet-court/internet-court-skill, 6.4k stars), Evolving The Data Model (TriliumNext/Trilium, 38k stars) and SQL Database Support for pREST (prest/prest, 4.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Query Onchain Data?

nirholas (a GitHub user) maintains it in nirholas/three.ws, which has 226 GitHub stars. The repository holds 165 skills in this directory. The repository was last updated on October 7, 2026.

Source: nirholas/three.ws on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.