← 返回 Skills 市场
harry5556

Chainstream Graphql

作者 ChainStream · GitHub ↗ · v1.0.6 · MIT-0
cross-platform ✓ 安全检测通过
203
总下载
0
收藏
0
当前安装
7
版本数
在 OpenClaw 中安装
/install chainstream-graphql
功能描述
Execute flexible GraphQL queries against ChainStream's on-chain data warehouse (27 cubes in 3 chain groups: EVM, Solana, Trading). Use when user needs custom...
使用说明 (SKILL.md)

ChainStream GraphQL

Flexible GraphQL interface to ChainStream's on-chain data warehouse. 27 cubes organized in 3 chain groups (EVM / Solana / Trading), covering DEX trades, token-centric trade analysis, trading pairs, transfers, blocks, transactions, prediction markets, and more — across Solana, Ethereum, BSC, and Polygon.

  • Endpoint: https://graphql.chainstream.io/graphql (routed through APISIX gateway)
  • CLI: npx @chainstream-io/cli graphql
  • Auth: API Key via X-API-KEY header
  • Payment: x402 (USDC on Base/Solana) or MPP (USDC.e on Tempo) — auto-handled by CLI

When to Use GraphQL vs chainstream-data

Scenario Use Why
Standard token search, market trending, wallet profile chainstream-data (REST/MCP) Pre-built endpoints, simpler
Cross-cube JOIN (trades + instructions, trades + transfers) GraphQL joinXxx support
Custom aggregation (count, sum, avg with groupBy) GraphQL Metrics + dimension grouping
Complex filters (multi-condition WHERE, nested, OR via any) GraphQL Full filter operator support
Time-series data with custom resolution GraphQL Time interval bucketing + dimension aggregation
Prediction market data (PolyMarket) GraphQL PredictionTrades/Managements/Settlements cubes (Polygon)
Data not exposed by REST API GraphQL Direct access to all 27 cubes

Integration Path

Before anything else (CLI path), ensure user is authenticated:

  1. npx @chainstream-io/cli config auth — check login status
  2. If NOT logged in → npx @chainstream-io/cli login (creates EVM + Solana wallet, auto-grants nano trial plan: 50K CU free, 30 days — no purchase needed)
  3. npx @chainstream-io/cli plan status — verify subscription is active

New users get a free trial on login (50K CU). For details on trial plans and upgrade options, see shared/authentication.md.

  1. Has API Key? → YES → Use CLI directly: npx @chainstream-io/cli graphql query --query '...' → NO → Ensure logged in (see above), then CLI auto-handles on first 402

  2. First time / unsure about schema? → Run npx @chainstream-io/cli graphql schema --summary to discover available cubes → Run npx @chainstream-io/cli graphql schema --type DEXTrades to drill into a specific cube

  3. Need full schema reference for complex query construction? → Run npx @chainstream-io/cli graphql schema --full for complete field list + rules

Getting an API Key

GraphQL goes through ChainStream's unified APISIX gateway — same API Key and subscription quota as the REST API.

  • Dashboard users: app.chainstream.io → API Keys
  • AI Agents (x402): CLI auto-purchases on first 402 — USDC on Base or Solana → API Key auto-saved to ~/.config/chainstream/config.json
  • AI Agents (MPP): tempo request "https://api.chainstream.io/mpp/purchase?plan=\x3CPLAN>" → API Key auto-returned
  • CLI auto-payment: No pre-purchase needed. First graphql query that triggers 402 → interactive plan selection → payment → auto-retry
# Option A: Set existing API Key
npx @chainstream-io/cli config set --key apiKey --value \x3Cyour-api-key>

# Option B: Create wallet for x402 auto-payment
npx @chainstream-io/cli login

# Option C: Check pricing first
npx @chainstream-io/cli wallet pricing

Endpoint Selector

Intent CLI Command
List all cubes + descriptions npx @chainstream-io/cli graphql schema --summary
Explore one cube's fields npx @chainstream-io/cli graphql schema --type \x3CCubeName>
Full schema reference npx @chainstream-io/cli graphql schema --full
Force-refresh cached schema npx @chainstream-io/cli graphql schema --summary --refresh
Execute inline query npx @chainstream-io/cli graphql query --query '\x3Cgraphql>'
Execute query from file npx @chainstream-io/cli graphql query --file ./query.graphql
Execute with variables npx @chainstream-io/cli graphql query --query '...' --var '{"key":"value"}'
Machine-readable output Append --json to any command

AI Workflow

Step 1: Discover Schema (first time or when unsure)

npx @chainstream-io/cli graphql schema --summary

This returns a compact list of all 27 cubes organized by chain group (EVM/Solana/Trading) with descriptions and top-level fields. If you need details on a specific cube:

npx @chainstream-io/cli graphql schema --type DEXTrades

Step 2: Construct and Execute Query

MANDATORY — READ references/schema-guide.md before constructing your first query.

Based on schema knowledge + user intent, construct a GraphQL query and execute:

npx @chainstream-io/cli graphql query --query 'query {
  Solana {
    DEXTrades(limit: {count: 25}, orderBy: {descending: Block_Time}) {
      Block { Time }
      Trade { Buy { Currency { MintAddress } Amount PriceInUSD } Sell { Currency { MintAddress } Amount } Dex { ProtocolName } }
    }
  }
}' --json

If the user has no subscription, use the non-interactive purchase flow: plan status --jsonwallet pricing --json (present plans to user) → plan purchase --plan \x3CUSER_CHOSEN> --json (signs x402 payment, returns API Key). See x402-payment.md for details.

Step 3: Analyze Results

  • Parse JSON output
  • Identify data patterns (time series, ranking, distribution, comparison)
  • Provide insights in natural language
  • If visualization is needed, choose appropriate chart type based on data shape

Query Construction Quick Reference

The schema uses chain group wrappers as the top-level entry point:

# Solana (no network arg needed)
query {
  Solana {
    CubeName(limit: {count: N}, orderBy: {descending: Field}, where: {...}) {
      FieldGroup { SubField }
      joinXxx { ... }
      count
    }
  }
}

# EVM (network required: eth | bsc | polygon)
query {
  EVM(network: eth) {
    CubeName(limit: {count: N}, orderBy: {descending: Field}, where: {...}) {
      FieldGroup { SubField }
    }
  }
}

# Trading (cross-chain pre-aggregated, no network arg)
query {
  Trading {
    Pairs(tokenAddress: {is: "..."}, limit: {count: 24}) {
      TimeMinute
      Price { Open High Low Close }
    }
  }
}
  • Chain group wrapper: Top-level required. Solana, EVM(network: ...), or Trading.
  • network: Only on EVM wrapper. Values: eth, bsc, polygon.
  • limit: {count: N, offset: M}. Default 25.
  • orderBy: {descending: Field} or {ascending: Field}. For computed fields: {descendingByField: "field_name"}.
  • where: {Group: {Field: {operator: value}}}. OR conditions: any: [{...}, {...}].
  • DateTime format: "YYYY-MM-DD HH:MM:SS" — NO T, NO Z. Critical for ClickHouse.
  • DateTimeFilter: since, till, after, before — NEVER gt/lt.
  • joinXxx: LEFT JOIN to related cubes. Always prefer over multiple queries.
  • dataset: Optional wrapper arg — realtime, archive, or combined (default).
  • aggregates: Optional wrapper arg — yes, no, or only.

Chain Groups and Cubes

Chain Group Wrapper Cubes
Solana Solana { ... } DEXTrades, DEXTradeByTokens, Transfers, BalanceUpdates, Blocks, Transactions, DEXPools, Instructions, InstructionBalanceUpdates, Rewards, DEXOrders, TokenSupplyUpdates
EVM EVM(network: eth|bsc|polygon) { ... } DEXTrades, DEXTradeByTokens, Transfers, BalanceUpdates, Blocks, Transactions, DEXPoolEvents, Events, Calls, MinerRewards, DEXPoolSlippages, TokenHolders, TransactionBalances, Uncles, PredictionTrades*, PredictionManagements*, PredictionSettlements*
Trading Trading { ... } Pairs, Tokens, Currencies, Trades

*Prediction cubes only available on polygon network.

NEVER Do

  • NEVER use flat query format (CubeName(network: sol) without chain group wrapper) — always wrap in Solana { ... }, EVM(network: ...) { ... }, or Trading { ... }
  • NEVER guess field names without checking schema first — run graphql schema --summary or --type
  • NEVER use ISO 8601 datetime format (2026-03-31T00:00:00Z) — ClickHouse requires "2026-03-31 00:00:00"
  • NEVER use gt/lt on DateTime fields — use since/after/before/till
  • NEVER split related data into multiple queries when joinXxx can combine them
  • NEVER auto-select a payment plan — always let the user choose

Error Recovery

Error Meaning Recovery
401 / "Not authenticated" Not logged in or no API Key First config authlogin if not logged in (auto-grants nano trial 50K CU) → retry. If still failing: config set --key apiKey --value \x3Ckey>
402 No active subscription First config authlogin if needed (trial may suffice) → plan status. If no subscription or quota exhausted: wallet pricing then plan purchase. MANDATORY — READ shared/x402-payment.md for manual purchase flow
"GraphQL error: ..." Invalid query syntax or non-existent field Check field names against graphql schema --type \x3Ccube>
429 Rate limit Wait 1s, exponential backoff
5xx Server error Retry once after 2s

On 401/402, follow this sequence:

  1. Check login: npx @chainstream-io/cli config auth — if not logged in, run login (creates wallet + auto-grants nano trial with 50K CU free). After login, retry the failed command — it will likely succeed now
  2. Check subscription: npx @chainstream-io/cli plan status — if active: true with remaining quota, retry
  3. If logged in but no subscription: ask the user "Do you have a ChainStream API Key?" — if yes, config set --key apiKey --value \x3Ckey> and retry; if no, load shared/x402-payment.md for the purchase flow. GraphQL shares the same API Key / subscription pool as the REST API — no separate purchase needed.

Skill Map

Reference Content When to Load
schema-guide.md Query syntax, filter operators, joinXxx rules, advanced patterns, common mistakes Before constructing any query
query-patterns.md 20+ ready-to-use query templates by scenario When building queries for common use cases
x402-payment.md x402 and MPP payment protocols, plan purchase flow On 402 errors or when user needs subscription
authentication.md API Key setup, wallet auth, MCP config On auth errors

Related Skills

  • chainstream-data — Standard REST/MCP queries for common analytics (token search, market trending, wallet profile). Use when pre-built endpoints suffice.
  • chainstream-defi — DeFi execution: swap, bridge, create token, sign transactions. Use when analysis leads to action.
安全使用建议
This skill appears to do what it claims (run GraphQL queries via ChainStream), but its recommended workflow includes creating wallets, importing private keys, and performing real on‑chain payments (USDC) via x402/MPP. Before installing or invoking it: - Do NOT paste private keys into an AI/chat prompt; prefer using an API Key from the ChainStream dashboard if you want read-only access. - npx runs code pulled from npm at runtime; verify the @chainstream-io/cli package on npm/GitHub before running. - The CLI will save API keys and wallet metadata to ~/.config/chainstream/ — inspect and clean that directory if you stop using the skill. - Treat any purchase flow as real money: always confirm the plan and payment chain with the human user before initiating a purchase; the skill's docs echo this requirement. - If you need a lower-risk path, obtain an API key from the dashboard (prepaid) and set it with the CLI rather than creating/importing wallets or enabling auto-payment.
功能分析
Type: OpenClaw Skill Name: chainstream-graphql Version: 1.0.6 The chainstream-graphql skill bundle provides a legitimate and well-documented interface for querying blockchain data across multiple chains (Solana, EVM, Trading). It utilizes a dedicated CLI tool (@chainstream-io/cli) and MCP server for data access, authentication, and subscription management via x402 and MPP protocols. The instructions in SKILL.md and shared documentation focus on correct query construction, error recovery, and security best practices, such as requiring explicit user confirmation for payments and warning against exposing private keys. No indicators of data exfiltration, malicious execution, or harmful prompt injection were found.
能力标签
cryptorequires-walletcan-make-purchasescan-sign-transactionsrequires-sensitive-credentials
能力评估
Purpose & Capability
The name/description (GraphQL queries against ChainStream) match the runtime instructions: the skill tells the agent to use the @chainstream-io CLI and the GraphQL endpoint. Requiring an API key or wallet/payment flow is coherent for a service that gates access by subscription/CU.
Instruction Scope
SKILL.md goes beyond issuing read-only GraphQL queries: it instructs agents to run npx @chainstream-io/cli commands that create wallets (TEE-backed), import private keys, perform x402/MPP purchases (EIP-3009 / EIP-712 signing), and save API keys to ~/.config/chainstream/config.json. These steps are relevant to obtaining access but are sensitive (generate/store private keys, sign real USDC payments). The skill includes explicit rules to always present plans and get user confirmation before purchases, which mitigates but does not eliminate risk.
Install Mechanism
Instruction-only skill (no install spec or code). Runtime commands use npx to run an npm package (@chainstream-io/cli), which will fetch remote code on demand. This is typical for CLI-based integrations but implies executing third-party code via network at runtime — users should ensure the package origin is trusted.
Credentials
The skill declares no required env vars, which matches the bundle. However the instructions reference and write to a local config (~/.config/chainstream/config.json) and a keys folder (~/.config/chainstream/keys/) and may prompt for/import private keys. Asking for wallets/API keys is proportionate to payment/auth needs, but private-key import and automatic wallet creation are sensitive and should be handled only with explicit user consent.
Persistence & Privilege
No always:true or elevated persistence. The CLI will store API keys and generated wallet metadata in the user's config directory by design; this is expected for a client tool. The skill does not request system-wide configuration changes or modify other skills.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install chainstream-graphql
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /chainstream-graphql 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.6
- Added a "Before anything else" authentication checklist with CLI commands to guide new users. - Clarified that new users receive a 50K CU, 30-day free trial upon first login (nano trial plan). - Updated Integration Path to require authentication and subscription verification before API usage. - Linked out to shared authentication guide for further details on agent/bootstrap procedures. - No interface or API changes; all updates are documentation and onboarding improvements.
v1.0.5
- Added new or updated documentation files: CLAUDE.md, shared/authentication.md, shared/x402-payment.md. - Expanded and clarified authentication and payment (x402/MPP) guidance in documentation. - No breaking changes to query interface or CLI usage. - Improved reference material for first-time users and schema exploration.
v1.0.4
- Increased total number of cubes from 25 to 27, expanding available analytics options. - Added new cubes: Pairs, Tokens, Currencies, and Trades to the Trading chain group. - Updated schema and documentation references accordingly for all integration and usage instructions. - Improved and clarified examples for query construction, including how to use new cubes (e.g., Pairs). - Updated keywords and descriptions for better discoverability and context.
v1.0.3
chainstream-graphql v1.0.3 - Updated SKILL.md with a new non-interactive x402 purchase flow for users without a subscription. - Step 2 of the AI workflow now instructs users to use explicit CLI commands for plan status, wallet pricing, and plan purchase instead of relying on interactive terminal prompts. - Reference to [x402-payment.md](../shared/x402-payment.md) added for payment details. - No changes to endpoint, schema, or existing query/aggregation logic.
v1.0.2
- Clarified x402 payment behavior: interactive plan selection and USDC transfer only works in terminals, not in agent/pipe mode. - Added guidance for non-terminal environments: check plan status and handle purchases explicitly outside CLI prompts. - Minor wording and instruction improvements for payment and workflow steps. - No changes to API, schema, or functionality—documentation and usage guidance updates only.
v1.0.1
**chainstream-graphql 1.0.1 — Major schema and documentation update** - Expanded from 22 to 25 cubes, now explicitly grouped into 3 chain groups: EVM, Solana, Trading. - Required use of chain group wrappers (e.g., `Solana { ... }`, `EVM(network: ...) { ... }`, `Trading { ... }`) for all queries instead of flat format. - Added Polygon support, including new prediction market cubes (PredictionTrades, PredictionManagements, PredictionSettlements) on Polygon. - Updated query construction syntax: `orderBy` now uses `{descending: Field}`/`{ascending: Field}`; complex filter patterns (`any` for OR). - Documentation and references updated throughout to reflect schema changes, cube expansion, and improved query guidance.
v1.0.0
Initial release of chainstream-graphql skill: - Provides a flexible GraphQL interface to ChainStream's on-chain data warehouse across Solana, Ethereum, and BSC. - Supports cross-cube JOINs, custom aggregations, complex filters, and time-series analysis. - Detailed usage guide for CLI, schema discovery, query construction, and API key/payment setup. - Includes error recovery strategies and comparison table for when to use GraphQL vs REST APIs. - Documentation and quick references for efficient integration and troubleshooting.
元数据
Slug chainstream-graphql
版本 1.0.6
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 7
常见问题

Chainstream Graphql 是什么?

Execute flexible GraphQL queries against ChainStream's on-chain data warehouse (27 cubes in 3 chain groups: EVM, Solana, Trading). Use when user needs custom... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 203 次。

如何安装 Chainstream Graphql?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install chainstream-graphql」即可一键安装,无需额外配置。

Chainstream Graphql 是免费的吗?

是的,Chainstream Graphql 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Chainstream Graphql 支持哪些平台?

Chainstream Graphql 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Chainstream Graphql?

由 ChainStream(@harry5556)开发并维护,当前版本 v1.0.6。

💬 留言讨论