Dynamic Schema Generation
The ChainStream GraphQL schema is dynamically generated at startup by activecube-rs, a Rust library that compiles Cube definitions into a fully-typed async-graphql schema. Each Cube maps to an analytical data model backed by an OLAP table, and activecube-rs automatically produces:- A top-level Query field for the Cube (nested under its Chain Group)
- A Record type (
{Cube}Record) representing the selectable dimensions - A Filter input (
{Cube}Filter) matching the dimension hierarchy - An OrderBy enum (
{Cube}OrderBy) with ASC/DESC variants for every dimension path
Because the schema is generated from Cube definitions, any new data model added in Rust is automatically reflected in the GraphQL endpoint after deployment.
Root Query Structure
The root query type is namedChainStream. Cubes are organized into three Chain Groups, each exposed as a top-level field:
Mutation or Subscription types — the GraphQL API is read-only analytical queries.
Chain Groups
Cubes are organized into three groups based on the blockchain ecosystem they target:| Chain Group | network Argument | Available Networks | Description |
|---|---|---|---|
| EVM | Required | eth, bsc, polygon | Shared Cubes for all EVM-compatible chains |
| Solana | Not needed | sol (implicit) | Cubes for Solana including chain-specific ones (Instructions, DEXOrders) |
| Trading | Not needed | Cross-chain (sol, eth, bsc) | Pre-aggregated trading analytics (OHLC candles, token statistics) with a chain dimension |
The EVM group requires a
network argument to select which chain to query. Solana and Trading do not need a network argument — Solana is implicit, and Trading includes a chain dimension within the data.Chain Group Parameters
Every Chain Group accepts two optional parameters that control data source behavior:Dataset
Thedataset parameter controls the time scope of data queried:
| Value | Description |
|---|---|
combined | Full range — queries both recent and historical data (default) |
realtime | Recent data only (approximately the last 24 hours) |
archive | Historical data up to the retention TTL |
Aggregates
Theaggregates parameter controls whether pre-aggregated (DWM/DWS) tables are used:
| Value | Description |
|---|---|
yes | Prefer pre-aggregated tables when available (default for applicable Cubes) |
no | Use raw detail tables only |
only | Only use pre-aggregated tables (faster but limited fields) |
Common Argument Pattern
Within a Chain Group, every Cube field accepts the same set of standard arguments, plus optional Cube-specific selectors:| Argument | Type | Required | Description |
|---|---|---|---|
where | {Cube}Filter | No | Nested filter object matching the dimension hierarchy |
limit | LimitInput | No | Pagination: {count: Int, offset: Int} |
orderBy | {Cube}OrderBy | No | Sort order enum ({Path}_ASC / {Path}_DESC) |
| selectors | Filter input | No | Shortcut filters (e.g., tokenAddress: {is: "..."}) |
LimitInput
count varies by Cube (typically 25). Maximum is 10,000 for most Cubes.
Generated Types per Cube
For each Cube, activecube-rs generates three companion types:Record Type
{Cube}Record — The return type containing all selectable dimensions and metrics. Field structure mirrors the Cube’s dimension hierarchy.Filter Input
{Cube}Filter — A nested input object where each dimension maps to a filter primitive (StringFilter, IntFilter, DateTimeFilter, etc.).OrderBy Enum
{Cube}OrderBy — Enum variants for every dimension path in both ASC and DESC directions (e.g., Block_Time_ASC, Trade_Buy_Amount_DESC).Introspection
The schema supports standard GraphQL introspection. You can explore types, fields, and arguments using__schema and __type queries:
- List All Cubes
- Inspect a Cube Type
- List Filter Operators
Next Steps
Data Cubes
Explore all 25 Cubes — their fields, selectors, and data warehouse layers.
Chain Groups
Understand the EVM, Solana, and Trading Chain Groups and their available Cubes.
Dataset & Aggregates
Control data source scope and pre-aggregation behavior with
dataset and aggregates.Filtering
Learn how to use
where filters and selector shortcuts to narrow your queries.Ordering & Pagination
Sort results and paginate through large datasets with
orderBy and limit.Metrics & Aggregation
Use
count, sum, avg, min, max, and uniq to aggregate data in your queries.
