chainbase-openapi-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseChainbase Web3 API Skill
Chainbase Web3 API 技能
Use this skill to run Chainbase indexed data operations through + OpenAPI.
uxcReuse the skill for shared execution, auth, and error-handling guidance.
uxc使用本技能可通过 + OpenAPI执行Chainbase已索引数据的操作。
uxc复用技能以获取通用的执行、认证及错误处理指引。
uxcPrerequisites
前置条件
- is installed and available in
uxc.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 header auth.
X-API-KEYConfigure one API-key credential and bind it to :
api.chainbase.onlinebash
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 100Validate the active mapping when auth looks wrong:
bash
uxc auth binding match https://api.chainbase.onlineChainbase采用请求头认证方式。
X-API-KEY配置一个API密钥凭证并将其绑定到:
api.chainbase.onlinebash
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.onlineCore Workflow
核心工作流程
-
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
-
Inspect operation schema first:
chainbase-openapi-cli get:/v1/account/balance -hchainbase-openapi-cli get:/v1/account/tokens -hchainbase-openapi-cli get:/v1/token/metadata -h
-
Prefer narrow account validation before broader reads:
chainbase-openapi-cli get:/v1/account/balance chain_id=1 address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045chainbase-openapi-cli get:/v1/token/price chain_id=1 contract_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48chainbase-openapi-cli get:/v1/tx/detail chain_id=1 tx_hash=0x4e3f3bc239f496f59c3e4d4a4d5f10f7f0d6d9f4cd790beeb520d05f6f7d98ae
-
Execute with key/value parameters:
chainbase-openapi-cli get:/v1/account/tokens chain_id=1 address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045 page=1 limit=20chainbase-openapi-cli get:/v1/token/holders chain_id=1 contract_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 page=1 limit=20
-
默认使用固定链接命令:
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
-
先查看操作schema:
chainbase-openapi-cli get:/v1/account/balance -hchainbase-openapi-cli get:/v1/account/tokens -hchainbase-openapi-cli get:/v1/token/metadata -h
-
在进行大范围读取前,优先进行小范围账户验证:
chainbase-openapi-cli get:/v1/account/balance chain_id=1 address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045chainbase-openapi-cli get:/v1/token/price chain_id=1 contract_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48chainbase-openapi-cli get:/v1/tx/detail chain_id=1 tx_hash=0x4e3f3bc239f496f59c3e4d4a4d5f10f7f0d6d9f4cd790beeb520d05f6f7d98ae
-
使用键值对参数执行操作:
chainbase-openapi-cli get:/v1/account/tokens chain_id=1 address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045 page=1 limit=20chainbase-openapi-cli get:/v1/token/holders chain_id=1 contract_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 page=1 limit=20
Operation Groups
操作分组
Account Reads
账户读取操作
get:/v1/account/balanceget:/v1/account/tokensget:/v1/account/txs
get:/v1/account/balanceget:/v1/account/tokensget:/v1/account/txs
Token And Transaction Reads
代币与交易读取操作
get:/v1/token/metadataget:/v1/token/holdersget:/v1/token/priceget:/v1/tx/detail
get:/v1/token/metadataget:/v1/token/holdersget:/v1/token/priceget:/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 and
pagevalues before building large crawls.limit - is equivalent to
chainbase-openapi-cli <operation> ....uxc https://api.chainbase.online --schema-url <chainbase_openapi_schema> <operation> ...
- 自动化操作请使用JSON输出格式;不要使用参数。
--text - 优先解析稳定字段:、
ok、kind、protocol、data。error - 本v1技能为只读性质,不支持RPC写入方法、内存池发送或签名操作。
- Chainbase拥有多个产品场景,本技能仅限定于上的索引式HTTP读取操作。
https://api.chainbase.online - 在进行大规模爬取前,先使用较小的和
page参数值进行测试。limit - 等同于
chainbase-openapi-cli <operation> ...。uxc https://api.chainbase.online --schema-url <chainbase_openapi_schema> <operation> ...
References
参考资料
- Usage patterns:
references/usage-patterns.md - Curated OpenAPI schema:
references/chainbase-web3.openapi.json - Chainbase auth docs: https://docs.chainbase.com/quickstart/authenticate-your-api-key
- Chainbase Web3 API docs: https://docs.chainbase.com/api-reference/web3-api/balance
- 使用模式:
references/usage-patterns.md - 精心整理的OpenAPI schema:
references/chainbase-web3.openapi.json - Chainbase认证文档:https://docs.chainbase.com/quickstart/authenticate-your-api-key
- Chainbase Web3 API文档:https://docs.chainbase.com/api-reference/web3-api/balance