Blockscout Explorer API Skill
Use this skill to run Blockscout explorer operations through uxc + OpenAPI.
Reuse the uxc skill for shared execution, auth, and error-handling guidance.
Prerequisites
- -
uxc is installed and available in PATH. - Network access to a Blockscout deployment that exposes
/api/v2. - Access to the curated OpenAPI schema URL:
-
https://raw.githubusercontent.com/holon-run/uxc/main/skills/blockscout-openapi-skill/references/blockscout-v2.openapi.json
- - A target Blockscout instance. Examples in this skill use
https://eth.blockscout.com/api/v2.
Scope
This skill covers a read-first explorer surface:
- - address summary lookup
- address token balances
- address transaction history
- token metadata
- token holder reads
- transaction detail lookup
- block detail lookup
This skill does not cover:
- - Blockscout GraphQL
- raw JSON-RPC proxying
- write operations or admin/configuration flows
- custom authenticated gateways beyond what the caller explicitly binds
Authentication
Public Blockscout instances usually allow explorer reads without auth.
If you are targeting a self-hosted or gateway-protected instance, configure auth separately with standard uxc auth bindings for that host. This skill does not assume any default credential.
Core Workflow
- 1. Use the fixed link command by default:
-
command -v blockscout-openapi-cli
- If missing, create it:
uxc link blockscout-openapi-cli https://eth.blockscout.com/api/v2 --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/blockscout-openapi-skill/references/blockscout-v2.openapi.json
- INLINECODE10
- 2. Inspect operation schema first:
-
blockscout-openapi-cli get:/addresses/{address_hash} -h
-
blockscout-openapi-cli get:/tokens/{address_hash} -h
- INLINECODE13
- 3. Prefer narrow lookup validation before larger history reads:
-
blockscout-openapi-cli get:/blocks/{block_number_or_hash} block_number_or_hash=latest
-
blockscout-openapi-cli get:/addresses/{address_hash} address_hash=0xd8da6bf26964af9d7eed9e03e53415d37aa96045
- INLINECODE16
- 4. Execute with key/value parameters:
-
blockscout-openapi-cli get:/addresses/{address_hash}/transactions address_hash=0xd8da6bf26964af9d7eed9e03e53415d37aa96045
- INLINECODE18
Operation Groups
Address Reads
- - INLINECODE19
- INLINECODE20
- INLINECODE21
Token, Transaction, And Block Reads
- - INLINECODE22
- INLINECODE23
- INLINECODE24
- INLINECODE25
Multi-Instance Use
To target a different Blockscout deployment, keep the same schema and relink the command to another host that serves /api/v2:
CODEBLOCK0
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 transaction broadcast or contract write support.
- This schema is designed for Blockscout deployments that expose the explorer REST surface at
/api/v2. If host help fails, check the deployment path before assuming a protocol mismatch. - Pagination and filter options vary across deployments. Start with host help and operation help on the target instance before building large crawls.
- INLINECODE34 is equivalent to
uxc <blockscout_api_v2_host> --schema-url <blockscout_openapi_schema> <operation> ....
References
- - Usage patterns: INLINECODE36
- Curated OpenAPI schema: INLINECODE37
- Blockscout API docs: https://docs.blockscout.com/devs/apis-redirect
Blockscout 浏览器 API 技能
使用此技能通过 uxc + OpenAPI 运行 Blockscout 浏览器操作。
复用 uxc 技能以获取共享执行、认证和错误处理指导。
前提条件
- - uxc 已安装并可在 PATH 中使用。
- 可访问暴露 /api/v2 端点的 Blockscout 部署。
- 可访问精选的 OpenAPI 模式 URL:
- https://raw.githubusercontent.com/holon-run/uxc/main/skills/blockscout-openapi-skill/references/blockscout-v2.openapi.json
- - 目标 Blockscout 实例。本技能中的示例使用 https://eth.blockscout.com/api/v2。
范围
本技能涵盖只读浏览器功能:
- - 地址摘要查询
- 地址代币余额
- 地址交易历史
- 代币元数据
- 代币持有者查询
- 交易详情查询
- 区块详情查询
本技能不涵盖:
- - Blockscout GraphQL
- 原始 JSON-RPC 代理
- 写入操作或管理/配置流程
- 除调用者明确绑定外的自定义认证网关
认证
公共 Blockscout 实例通常允许无需认证的浏览器读取操作。
如果目标是自托管或受网关保护的实例,请使用该主机的标准 uxc auth 绑定单独配置认证。本技能不假定任何默认凭据。
核心工作流程
- 1. 默认使用固定链接命令:
- command -v blockscout-openapi-cli
- 如果缺失,创建它:
uxc link blockscout-openapi-cli https://eth.blockscout.com/api/v2 --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/blockscout-openapi-skill/references/blockscout-v2.openapi.json
- blockscout-openapi-cli -h
- 2. 首先检查操作模式:
- blockscout-openapi-cli get:/addresses/{address_hash} -h
- blockscout-openapi-cli get:/tokens/{address_hash} -h
- blockscout-openapi-cli get:/transactions/{hash} -h
- 3. 在进行大规模历史读取前,优先进行窄范围查询验证:
- blockscout-openapi-cli get:/blocks/{block
numberor
hash} blocknumber
orhash=latest
- blockscout-openapi-cli get:/addresses/{address
hash} addresshash=0xd8da6bf26964af9d7eed9e03e53415d37aa96045
- blockscout-openapi-cli get:/tokens/{address
hash} addresshash=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
- 4. 使用键/值参数执行:
- blockscout-openapi-cli get:/addresses/{address
hash}/transactions addresshash=0xd8da6bf26964af9d7eed9e03e53415d37aa96045
- blockscout-openapi-cli get:/tokens/{address
hash}/holders addresshash=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
操作组
地址读取
- - get:/addresses/{addresshash}
- get:/addresses/{addresshash}/token-balances
- get:/addresses/{address_hash}/transactions
代币、交易和区块读取
- - get:/tokens/{addresshash}
- get:/tokens/{addresshash}/holders
- get:/transactions/{hash}
- get:/blocks/{blocknumberor_hash}
多实例使用
要定位不同的 Blockscout 部署,保持相同模式并将命令重新链接到另一个提供 /api/v2 的主机:
bash
uxc link blockscout-openapi-cli https://optimism.blockscout.com/api/v2 \
--schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/blockscout-openapi-skill/references/blockscout-v2.openapi.json
防护措施
- - 保持自动化在 JSON 输出格式上;不要使用 --text。
- 首先解析稳定字段:ok、kind、protocol、data、error。
- 将此 v1 技能视为只读。不要暗示交易广播或合约写入支持。
- 此模式适用于在 /api/v2 暴露浏览器 REST 接口的 Blockscout 部署。如果主机帮助失败,在假定协议不匹配前检查部署路径。
- 分页和过滤选项因部署而异。在构建大规模爬取前,先在目标实例上运行主机帮助和操作帮助。
- blockscout-openapi-cli ... 等同于 uxc apiv2host> --schema-url openapi_schema> ...。
参考资料
- - 使用模式:references/usage-patterns.md
- 精选 OpenAPI 模式:references/blockscout-v2.openapi.json
- Blockscout API 文档:https://docs.blockscout.com/devs/apis-redirect