Overview
The Chainbase CLI is a command-line tool for accessing Chainbase Web3 API data directly from your terminal. It outputs JSON by default, making it ideal for scripting, automation, and AI agent integration.- Query tokens, balances, transactions, and more across 8+ EVM chains
- JSON output by default for machine-parseable results
- Async SQL queries against Chainbase’s on-chain data warehouse
- Smart contract read calls without writing code
Installation
Requires Node.js >= 18.
Configuration
Set API Key
Get your API key from the Chainbase Console, then configure:Set Default Chain
Supported Chains
Supports all EVM-compatible chains available on Chainbase. See the full list at Supported Networks.Global Options
Every command supports these options:| Option | Description | Default |
|---|---|---|
--chain <id> | Chain ID to query | 1 (or your default-chain) |
--pretty | Human-readable formatted output | false |
--page <n> | Page number for paginated results | 1 |
--limit <n> | Results per page | 20 |
Commands
block — Block Queries
tx — Transaction Queries
token — Token Queries
balance — Balance & Portfolio
domain — ENS & Space ID
address — Address Labels
contract — Smart Contract Calls
sql — SQL Queries
Execute SQL queries against Chainbase’s on-chain data warehouse. Queries run asynchronously — submit, check status, then retrieve results.
tops — Crypto Social Intelligence
Query crypto social signals from Tops. No API key required. Free to use.
Rate limits: 10 req/s · 60 req/min · 600 req/hour (per client IP)
| Subcommand | Description |
|---|---|
trending [--language <lang>] | List trending crypto narratives ranked by heat score (zh/en/ko) |
topic <topic_id> | Structured details (summary, score, representative posts) for a topic |
posts <topic_id> | Raw Twitter/X posts under a topic |
search <keyword> | Find narrative candidate topics by keyword |
mentions <keyword> | Search recent Twitter/X mentions for a keyword |
topic_id values come from trending or search results. Use --json to get machine-parseable output when piping into other tools.
AI Agent Integration
The CLI is designed for AI agent automation with predictable, machine-parseable output:- JSON by default — no colors or formatting unless
--prettyis used - Consistent error format — errors output as
{"error":"message"}to stderr - Discoverable — run
--helpon any command for usage info - Predictable pattern —
chainbase <group> <action> [args] [options]
Learn More
- Chainbase API Reference — Full API documentation
- Supported Networks — Complete list of supported chains
- GitHub Repository — Source code and contributions
- npm Package — Package details and versions