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, NFTs, 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
| Chain | ID |
|---|---|
| Ethereum | 1 |
| BSC | 56 |
| Polygon | 137 |
| Avalanche | 43114 |
| Arbitrum | 42161 |
| Optimism | 10 |
| Base | 8453 |
| zkSync | 324 |
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
nft — NFT 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.
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