chainbase-openapi-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Chainbase Web3 API Skill

Chainbase Web3 API 技能

Use this skill to run Chainbase indexed data operations through
uxc
+ OpenAPI.
Reuse the
uxc
skill for shared execution, auth, and error-handling guidance.
使用本技能可通过
uxc
+ OpenAPI执行Chainbase已索引数据的操作。
复用
uxc
技能以获取通用的执行、认证及错误处理指引。

Prerequisites

前置条件

  • uxc
    is installed and available in
    PATH
    .
  • Network access to
    https://api.chainbase.online
    .
  • Access to the curated OpenAPI schema URL:
    • https://raw.githubusercontent.com/holon-run/uxc/main/skills/chainbase-openapi-skill/references/chainbase-web3.openapi.json
  • A Chainbase API key.
  • 已安装
    uxc
    且其可在
    PATH
    中访问。
  • 可访问
    https://api.chainbase.online
    网络。
  • 可访问以下精心整理的OpenAPI schema URL:
    • https://raw.githubusercontent.com/holon-run/uxc/main/skills/chainbase-openapi-skill/references/chainbase-web3.openapi.json
  • 拥有Chainbase API密钥。

Scope

适用范围

This skill covers a read-first indexed data surface:
  • account native balance lookup
  • account token balances
  • account transaction history
  • token metadata
  • token holder reads
  • token price lookup
  • transaction detail lookup
This skill does not cover:
  • raw chain RPC methods
  • write or transaction submission flows
  • the broader Chainbase data product surface beyond the selected Web3 API reads
本技能覆盖以下只读优先的索引数据场景:
  • 账户原生余额查询
  • 账户代币余额
  • 账户交易历史
  • 代币元数据
  • 代币持有者信息读取
  • 代币价格查询
  • 交易详情查询
本技能包含以下内容:
  • 原始链RPC方法
  • 写入或交易提交流程
  • 除所选Web3 API读取功能外的其他Chainbase数据产品场景

Authentication

认证方式

Chainbase uses
X-API-KEY
header auth.
Configure one API-key credential and bind it to
api.chainbase.online
:
bash
uxc auth credential set chainbase \
  --auth-type api_key \
  --api-key-header X-API-KEY \
  --secret-env CHAINBASE_API_KEY

uxc auth binding add \
  --id chainbase \
  --host api.chainbase.online \
  --scheme https \
  --credential chainbase \
  --priority 100
Validate the active mapping when auth looks wrong:
bash
uxc auth binding match https://api.chainbase.online
Chainbase采用
X-API-KEY
请求头认证方式。
配置一个API密钥凭证并将其绑定到
api.chainbase.online
bash
uxc auth credential set chainbase \
  --auth-type api_key \
  --api-key-header X-API-KEY \
  --secret-env CHAINBASE_API_KEY

uxc auth binding add \
  --id chainbase \
  --host api.chainbase.online \
  --scheme https \
  --credential chainbase \
  --priority 100
当认证出现问题时,验证当前的映射关系:
bash
uxc auth binding match https://api.chainbase.online

Core Workflow

核心工作流程

  1. Use the fixed link command by default:
    • command -v chainbase-openapi-cli
    • If missing, create it:
      uxc link chainbase-openapi-cli https://api.chainbase.online --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/chainbase-openapi-skill/references/chainbase-web3.openapi.json
    • chainbase-openapi-cli -h
  2. Inspect operation schema first:
    • chainbase-openapi-cli get:/v1/account/balance -h
    • chainbase-openapi-cli get:/v1/account/tokens -h
    • chainbase-openapi-cli get:/v1/token/metadata -h
  3. Prefer narrow account validation before broader reads:
    • chainbase-openapi-cli get:/v1/account/balance chain_id=1 address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045
    • chainbase-openapi-cli get:/v1/token/price chain_id=1 contract_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
    • chainbase-openapi-cli get:/v1/tx/detail chain_id=1 tx_hash=0x4e3f3bc239f496f59c3e4d4a4d5f10f7f0d6d9f4cd790beeb520d05f6f7d98ae
  4. Execute with key/value parameters:
    • chainbase-openapi-cli get:/v1/account/tokens chain_id=1 address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045 page=1 limit=20
    • chainbase-openapi-cli get:/v1/token/holders chain_id=1 contract_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 page=1 limit=20
  1. 默认使用固定链接命令:
    • command -v chainbase-openapi-cli
    • 若不存在则创建:
      uxc link chainbase-openapi-cli https://api.chainbase.online --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/chainbase-openapi-skill/references/chainbase-web3.openapi.json
    • chainbase-openapi-cli -h
  2. 先查看操作schema:
    • chainbase-openapi-cli get:/v1/account/balance -h
    • chainbase-openapi-cli get:/v1/account/tokens -h
    • chainbase-openapi-cli get:/v1/token/metadata -h
  3. 在进行大范围读取前,优先进行小范围账户验证:
    • chainbase-openapi-cli get:/v1/account/balance chain_id=1 address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045
    • chainbase-openapi-cli get:/v1/token/price chain_id=1 contract_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
    • chainbase-openapi-cli get:/v1/tx/detail chain_id=1 tx_hash=0x4e3f3bc239f496f59c3e4d4a4d5f10f7f0d6d9f4cd790beeb520d05f6f7d98ae
  4. 使用键值对参数执行操作:
    • chainbase-openapi-cli get:/v1/account/tokens chain_id=1 address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045 page=1 limit=20
    • chainbase-openapi-cli get:/v1/token/holders chain_id=1 contract_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 page=1 limit=20

Operation Groups

操作分组

Account Reads

账户读取操作

  • get:/v1/account/balance
  • get:/v1/account/tokens
  • get:/v1/account/txs
  • get:/v1/account/balance
  • get:/v1/account/tokens
  • get:/v1/account/txs

Token And Transaction Reads

代币与交易读取操作

  • get:/v1/token/metadata
  • get:/v1/token/holders
  • get:/v1/token/price
  • get:/v1/tx/detail
  • get:/v1/token/metadata
  • get:/v1/token/holders
  • get:/v1/token/price
  • get:/v1/tx/detail

Guardrails

约束规则

  • Keep automation on the JSON output envelope; do not use
    --text
    .
  • Parse stable fields first:
    ok
    ,
    kind
    ,
    protocol
    ,
    data
    ,
    error
    .
  • Treat this v1 skill as read-only. Do not imply RPC write methods, mempool send, or signing support.
  • Chainbase has multiple product surfaces. This skill is intentionally limited to indexed HTTP reads on
    https://api.chainbase.online
    .
  • Start with small
    page
    and
    limit
    values before building large crawls.
  • chainbase-openapi-cli <operation> ...
    is equivalent to
    uxc https://api.chainbase.online --schema-url <chainbase_openapi_schema> <operation> ...
    .
  • 自动化操作请使用JSON输出格式;不要使用
    --text
    参数。
  • 优先解析稳定字段:
    ok
    kind
    protocol
    data
    error
  • 本v1技能为只读性质,不支持RPC写入方法、内存池发送或签名操作。
  • Chainbase拥有多个产品场景,本技能仅限定于
    https://api.chainbase.online
    上的索引式HTTP读取操作。
  • 在进行大规模爬取前,先使用较小的
    page
    limit
    参数值进行测试。
  • chainbase-openapi-cli <operation> ...
    等同于
    uxc https://api.chainbase.online --schema-url <chainbase_openapi_schema> <operation> ...

References

参考资料