> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstream.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Chain Groups

> How Cubes are organized into EVM, Solana, and Trading Chain Groups

## Overview

ChainStream GraphQL organizes its 25 Cubes into three **Chain Groups**. Each group represents a blockchain ecosystem and determines which Cubes are available, how the `network` parameter works, and what chain-specific fields exist.

```graphql theme={null}
type ChainStream {
  EVM(network: Network!, dataset: Dataset, aggregates: Aggregates) { ... }
  Solana(network: SolanaNetwork, dataset: Dataset, aggregates: Aggregates) { ... }
  Trading(dataset: Dataset, aggregates: Aggregates) { ... }
}
```

***

## EVM

The **EVM** group contains Cubes for all EVM-compatible blockchains. It **requires** a `network` argument to specify which chain to query.

### Available Networks

| Network ID | Blockchain      |
| :--------- | :-------------- |
| `eth`      | Ethereum        |
| `bsc`      | BNB Chain (BSC) |
| `polygon`  | Polygon         |

<Warning>
  **Polygon data availability:** Currently only **Prediction Markets** Cubes (`PredictionTrades`, `PredictionManagements`, `PredictionSettlements`) have data available for Polygon. Other Cubes (DEXTrades, Blocks, Transfers, etc.) are being deployed — queries against them may return errors.
</Warning>

### Cubes

**Shared with Solana:**
`DEXTrades`, `DEXTradeByTokens`, `Transfers`, `BalanceUpdates`, `DEXPoolEvents`, `TokenSupplyUpdates`, `Blocks`, `Transactions`, `TransactionBalances`, `DEXPools`, `TokenHolders`, `WalletTokenPnL`

**EVM-only:**

* `Events` — Smart contract event logs (decoded topics and data)
* `Calls` — Internal call traces (CALL, DELEGATECALL, CREATE, etc.)
* `MinerRewards` — Block rewards breakdown (static, dynamic, uncle, burned fees)
* `DEXPoolSlippages` — Pool price slippage analysis
* `Uncles` — Uncle block data (primarily Ethereum PoW historical)
* `PredictionTrades` — Prediction market trades *(primarily Polygon)*
* `PredictionManagements` — Prediction market management events *(primarily Polygon)*
* `PredictionSettlements` — Prediction market settlements *(primarily Polygon)*

### Example Query

```graphql theme={null}
query {
  EVM(network: eth, dataset: combined) {
    DEXTrades(
      limit: {count: 10}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Number }
      Transaction { Hash }
      Trade {
        Buy { Currency { SmartContract Symbol } Amount PriceInUSD }
        Sell { Currency { SmartContract Symbol } Amount }
        Dex { ProtocolName }
      }
    }
  }
}
```

***

## Solana

The **Solana** group contains Cubes for the Solana blockchain. The `network` argument is available and accepts `solana` as its value. It is optional and defaults to `solana`.

### Cubes

**Shared with EVM:**
`DEXTrades`, `DEXTradeByTokens`, `Transfers`, `BalanceUpdates`, `DEXPoolEvents`, `TokenSupplyUpdates`, `Blocks`, `Transactions`, `TransactionBalances`, `DEXPools`, `TokenHolders`, `WalletTokenPnL`

**Solana-only:**

* `Instructions` — Program instruction data (program address, method, accounts, logs)
* `InstructionBalanceUpdates` — Balance changes at instruction level
* `Rewards` — Validator and staking rewards
* `DEXOrders` — DEX order book events (limit orders, cancellations, fills)

### Example Query

```graphql theme={null}
query {
  Solana(dataset: realtime) {
    DEXTrades(
      limit: {count: 10}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Slot }
      Transaction { Hash }
      Trade {
        Buy { Currency { MintAddress Symbol } Amount PriceInUSD }
        Sell { Currency { MintAddress Symbol } Amount }
        Dex { ProgramAddress ProtocolName }
      }
    }
  }
}
```

### Field Names Across Chains

The table below shows the conventional field names for each chain. However, the Record type contains **all fields from all chains as a superset** — both `MintAddress` and `SmartContract` exist in every Cube's Record type and return the same underlying data. You can use either name on any chain.

| Concept          | Conventional (Solana) | Conventional (EVM) | Cross-chain?            |
| :--------------- | :-------------------- | :----------------- | :---------------------- |
| Token address    | `MintAddress`         | `SmartContract`    | Both work on all chains |
| Transaction ID   | `Signature` / `Hash`  | `Hash`             | Both work on all chains |
| Block identifier | `Slot`                | `Number`           | Both work on all chains |
| Program/Contract | `ProgramAddress`      | `SmartContract`    | Both work on all chains |
| Fee payer        | `FeePayer`            | `From`             | Both work on all chains |

<Tip>
  This means you can use a **single query template** across all chains without changing field names. For example, `Currency { MintAddress }` works on both Solana and EVM queries.
</Tip>

***

## Trading

The **Trading** group provides **cross-chain pre-aggregated** trading analytics. It combines data from all supported chains into unified materialized views with a `chain` dimension for filtering.

### Cubes

* `Pairs` — OHLC candlestick data (open/high/low/close, volume, trade count)
* `Tokens` — Per-token trade statistics (volume, buy/sell breakdown, unique traders)

### Key Differences from EVM/Solana Groups

1. **No `network` argument** — The Trading group combines data across chains. Use the `chain` dimension within the data to filter by network.
2. **Cross-chain data** — A single query can return data for `sol`, `eth`, and `bsc` together.
3. **Pre-aggregated** — Data is materialized at minute granularity from the DWM layer.

### Example: Cross-Chain OHLC

```graphql theme={null}
query {
  Trading(aggregates: yes) {
    Pairs(
      where: { Token: { Address: { is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" } } }
      limit: {count: 60}
      orderBy: {descending: Block_Time}
    ) {
      Token { Address }
      Market { Network }
      Interval { Time }
      Price { Ohlc { Open High Low Close } }
      Volume { Usd Native }
      Stats { TradeCount BuyCount SellCount }
    }
  }
}
```

### Example: Token Trade Stats by Chain

```graphql theme={null}
query {
  Trading {
    Tokens(
      where: {
        Token: { Address: { is: "0xdac17f958d2ee523a2206206994597c13d831ec7" } }
        Market: { Network: { is: "eth" } }
      }
      limit: {count: 30}
      orderBy: {descending: Block_Time}
    ) {
      Interval { Time }
      Volume { Usd BuyVolumeUSD SellVolumeUSD }
      Stats { TradeCount UniqueBuyers UniqueSellers }
    }
  }
}
```

***

## Chain Group Comparison

| Feature                  | EVM                                                                 | Solana                                                      | Trading                  |
| :----------------------- | :------------------------------------------------------------------ | :---------------------------------------------------------- | :----------------------- |
| **`network` argument**   | Required (`eth`, `bsc`, `polygon`)                                  | Optional (`solana`, defaults to `solana`)                   | Not needed (cross-chain) |
| **Unique Cubes**         | Events, Calls, MinerRewards, Uncles, DEXPoolSlippages, Prediction\* | Instructions, InstructionBalanceUpdates, Rewards, DEXOrders | Pairs, Tokens            |
| **Data granularity**     | Per-event (DWD) + aggregated (DWM/DWS)                              | Per-event + instruction-level                               | Pre-aggregated (DWM)     |
| **`dataset` support**    | Yes (most Cubes)                                                    | Yes (most Cubes)                                            | Yes                      |
| **`aggregates` support** | Yes                                                                 | Yes                                                         | Yes                      |

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Data Cubes" icon="cubes" href="/en/graphql/schema/cubes">
    Detailed field structures and use cases for all 25 Cubes.
  </Card>

  <Card title="Dataset & Aggregates" icon="database" href="/en/graphql/schema/dataset-aggregates">
    Control data source scope and pre-aggregation behavior.
  </Card>
</CardGroup>
