What SQL features are supported?
CoinbaSeQL supports all standard SQL query features including SELECT statements, WHERE filtering, JOINs, aggregations (COUNT, SUM, AVG, MIN, MAX), subqueries, Common Table Expressions (CTEs), UNION operations, and CASE statements. See the CoinbaSeQL reference for details.What’s the difference between SQL API and Wallet History API?
- SQL API: Write custom SQL queries against any blockchain data (events, transactions, blocks, transfers). Flexible and powerful.
- Wallet History API: Pre-built endpoints for wallet-specific data. Simple and fast for common wallet operations.
Do I need API keys?
- SQL Playground (browser): No API keys needed—just sign in to CDP Portal
- REST API (programmatic): Yes, create free Client API keys
What are the query limits?
- Maximum result set: 10,000 rows
- Query timeout: 30 seconds
- Maximum JOINs: 5 per query
- Query length: 50,000 characters maximum
- Rate limit: 100 requests per second
How do I optimize slow queries?
- Use indexed columns in WHERE clauses: For example, when querying
base.events
, query byevent_signature
andaddress
. Check the schema of each table - Use specific block ranges: Query smaller block ranges by
block_timestamp
rather than the entire blockchain’s history from genesis - Filter early: Put selective filters in WHERE clauses
- Avoid SELECT *: Select only the columns you need
What happens if my query times out?
If your query exceeds the 30-second timeout, you’ll receive atimed_out
error. To fix:
- Filter by
event_signature
to remove any irrelevant event logs - Reduce the block range in your WHERE clause via the
block_timestamp
field - Simplify complex JOINs (avoid
OR
in JOINs)
What networks are supported?
SQL API supports Base Mainnet and Base Sepolia. Each table is prefixed with the network (e.g.,base.events
, base.transactions
for mainnet, base_sepolia.events
for testnet).
How fresh is the data?
SQL API data is < 250ms from chain tip with query response latency < 500ms. This means you get near real-time blockchain data.What data types does SQL API support?
SQL API uses ClickHouse data types including:- Numeric: UInt8, UInt16, UInt32, UInt64, UInt128, UInt256, Int8, Int16, Int32, Int64, Int128, Int256
- String: String
- Boolean: Bool
- Temporal: Date, DateTime, DateTime64
- Complex: Array, Map, Tuple
How do I handle re-orgs?
Each table includes anaction
field:
1
or'added'
: Data was added to the chain-1
or'removed'
: Data was removed due to reorganization
action = 1
or action = 'added'
. The log_id
on each row can be used to identify duplicates.