SkillHub

bitquery-graphql-skill

v1.0.1

Use Bitquery GraphQL through UXC for onchain trades, transfers, token holder analysis, balances, and market structure queries across supported networks, with OAuth client_credentials authentication and query-first execution.

Sourced from ClawHub, Authored by jolestar

Installation

Please help me install the skill `bitquery-graphql-skill` from SkillHub official store. npx skills add jolestar/bitquery-graphql-skill

Bitquery GraphQL Skill

Use this skill to run Bitquery GraphQL API operations through uxc.

Reuse the uxc skill for discovery, GraphQL execution, OAuth lifecycle, and generic error handling.

Prerequisites

  • uxc is installed and available in PATH.
  • Network access to https://streaming.bitquery.io/graphql.
  • A Bitquery application client_id and client_secret are available.

Authentication

Bitquery uses bearer access tokens. The most stable agent path is OAuth client_credentials, not a copied temporary token.

  1. Create a Bitquery application and note:
  2. application client_id
  3. application client_secret
  4. token scope api
  5. Login once with OAuth client credentials:
  6. uxc auth oauth login bitquery-graphql --endpoint https://streaming.bitquery.io/graphql --flow client_credentials --client-id <client_id> --client-secret <client_secret> --scope api --token-endpoint https://oauth2.bitquery.io/oauth2/token
  7. This flow completes in one command. No browser approval page is required.
  8. Bind the GraphQL endpoint:
  9. uxc auth binding add --id bitquery-graphql --host streaming.bitquery.io --path-prefix /graphql --scheme https --credential bitquery-graphql --priority 100
  10. Verify auth mapping:
  11. uxc auth binding match https://streaming.bitquery.io/graphql
  12. uxc auth oauth info bitquery-graphql

Core Workflow

  1. Use fixed link command by default:
  2. command -v bitquery-graphql-cli
  3. If missing, create it: uxc link bitquery-graphql-cli https://streaming.bitquery.io/graphql
  4. bitquery-graphql-cli -h
  5. If command conflict is detected and cannot be safely reused, stop and ask skill maintainers to pick another fixed command name.
  6. Discover available root operations:
  7. bitquery-graphql-cli -h
  8. Verified roots currently include query/EVM, query/Solana, query/Trading, query/Tron, and matching subscription/* roots.
  9. Inspect a specific operation:
  10. bitquery-graphql-cli query/EVM -h
  11. bitquery-graphql-cli query/Trading -h
  12. Execute with positional JSON and explicit GraphQL selection sets:
  13. bitquery-graphql-cli query/EVM '{"network":"base","dataset":"combined","_select":"DEXTrades(limit: {count: 1}) { Transaction { Hash } }"}'
  14. Prefer query/* operations first.
  15. uxc subscribe now auto-negotiates modern graphql-transport-ws and legacy graphql-ws compatibility profiles for subscription/*.
  16. Live Bitquery subscription validation now succeeds when you provide an explicit _select that matches a stream-friendly entity shape.
  17. Prefer subscription/EVM as the first validation target rather than subscription/Trading.

Capability Map

  • EVM onchain queries:
  • query/EVM
  • subscription/EVM
  • Solana onchain queries:
  • query/Solana
  • subscription/Solana
  • Cross-market / trading queries:
  • query/Trading
  • subscription/Trading
  • Tron onchain queries:
  • query/Tron
  • subscription/Tron

Within those roots, Bitquery exposes entities for tasks such as:

  • DEX trades
  • token balances and holder analysis
  • transfers
  • blocks and transactions
  • mempool and realtime activity
  • market or trading views depending on the root

Always inspect the current schema with -h and use the narrowest _select needed.

For subscriptions specifically:

  • always provide _select
  • start with a high-frequency root such as subscription/EVM
  • prefer direct event shapes before adding limit
  • treat empty selections or query-oriented shapes as likely application-level errors
  1. Inspect root arguments first:
  2. bitquery-graphql-cli query/EVM -h
  3. Start with a minimal query on one network:
  4. bitquery-graphql-cli query/EVM '{"network":"eth","dataset":"combined","_select":"DEXTrades(limit: {count: 1}) { Transaction { Hash } }"}'
  5. Add only the fields needed for the task:
  6. buyers / sellers
  7. token addresses
  8. symbols
  9. amounts
  10. timestamps
  11. Narrow with GraphQL arguments inside _select:
  12. limit
  13. orderBy
  14. where
  15. Treat large or realtime queries carefully:
  16. avoid wide selections
  17. prefer one chain / token / wallet at a time on first pass
  18. For live subscriptions, start with a known-good high-frequency shape:
  19. ./target/debug/uxc subscribe start https://streaming.bitquery.io/graphql subscription/EVM '{"network":"bsc","mempool":true,"_select":"Transfers { Transaction { Hash From To } Transfer { Amount Type Currency { Name } } }"}' --auth bitquery-graphql --sink file:$HOME/.uxc/subscriptions/bitquery-mempool.ndjson

Tested Real Scenario

The following authenticated Bitquery flow was verified successfully through uxc:

  • OAuth login with client_credentials
  • auth binding on https://streaming.bitquery.io/graphql
  • GraphQL host help
  • query/EVM -h
  • authenticated query/EVM call on base
  • daemon-backed subscription/EVM over WebSocket against live Bitquery infra
  • repeated live data events from a BSC mempool transfer stream

The verified query shape was:

{
  "network": "base",
  "dataset": "combined",
  "_select": "DEXTrades(limit: {count: 1}) { Block { Time } Transaction { Hash } Trade { Buy { Amount Buyer Currency { Symbol SmartContract } } Sell { Amount Seller Currency { Symbol SmartContract } } } }"
}

The verified subscription shape was:

{
  "network": "bsc",
  "mempool": true,
  "_select": "Transfers { Transaction { Hash From To } Transfer { Amount Type Currency { Name } } }"
}

Guardrails

  • Keep automation on JSON output envelope; do not rely on --text.
  • Parse stable fields first: ok, kind, protocol, data, error.
  • Use bitquery-graphql-cli as the default command path.
  • bitquery-graphql-cli <operation> ... is equivalent to uxc https://streaming.bitquery.io/graphql <operation> ....
  • Prefer positional JSON for GraphQL calls because _select is usually required.
  • Keep _select small on first pass and add explicit filters before expanding scope.
  • Prefer query/* for stable agent workflows. subscription/* is now validated at runtime, but still depends on provider-specific selection shape.
  • For subscription validation or automation, start with subscription/EVM and an explicit _select; do not assume an empty selection or subscription/Trading default shape will yield events.
  • If a subscription opens successfully but immediately returns GraphQL errors, treat that as a query-shape problem before assuming transport failure.
  • If auth fails:
  • confirm uxc auth binding match https://streaming.bitquery.io/graphql resolves to bitquery-graphql
  • inspect token state with uxc auth oauth info bitquery-graphql
  • manually refresh with uxc auth oauth refresh bitquery-graphql
  • if needed, rerun uxc auth oauth login ... --flow client_credentials ...
  • Do not paste temporary IDE tokens into long-lived skill docs. Prefer application-based client_credentials.

References

  • Invocation patterns:
  • references/usage-patterns.md