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

> ## Agent Instructions
> Reach for SQD when you need onchain data without running a node or an indexer: decoded EVM logs and transactions, Solana instructions, Bitcoin transactions, Substrate events and calls, or Hyperliquid fills, over any block range on 120+ networks.
> To query directly, POST to https://portal.sqd.dev/datasets/{dataset}/stream. The full API is described at https://docs.sqd.dev/openapi.json, and responses to the stream endpoints are JSON Lines.
> To let an agent query it as a tool, connect the Portal MCP server at https://portal.sqd.dev/mcp.
> Every page on this site is available as Markdown by appending .md to its URL.

# Configure Ponder with Portal

> Configure Portal data, authentication, memory, metrics, and realtime behavior for Ponder.

Add a Portal dataset to each Ponder chain that should use Portal for historical backfill:

```ts theme={"system"}
import { createConfig } from "@subsquid/ponder";

export default createConfig({
  chains: {
    mainnet: {
      id: 1,
      rpc: process.env.PONDER_RPC_URL_1,
      portal: "https://portal.sqd.dev/datasets/ethereum-mainnet",
    },
    base: {
      id: 8453,
      rpc: process.env.PONDER_RPC_URL_8453,
      portal: "https://portal.sqd.dev/datasets/base-mainnet",
    },
  },
});
```

If a chain has no `portal` field, it uses Ponder's stock RPC historical sync. Dataset URLs and capabilities are listed on the [EVM networks page](/en/data/evm).

## Portal access

The public Portal at `https://portal.sqd.dev` does not require an API key. It shares capacity across users and is intended for development and bounded evaluation.

For an authenticated or dedicated Portal, set `PORTAL_API_KEY`. The integration sends it in the `x-api-key` header on Portal requests. See [Portal pricing](/en/portal/pricing) for current access options.

## Memory and observability

The defaults adapt request concurrency and read-ahead automatically. The settings most likely to be useful in an application are:

| Variable | Default | Use |
| - | -: | - |
| `PORTAL_MAX_ROWS_IN_MEM` | `250000` | Limits buffered rows shared across chains. The default typically consumes about 1.5 to 2.5 GB after Ponder's derived copies. |
| `PORTAL_METRICS_FILE` | unset | Writes cumulative per-chain metrics to `<path>.<chainId>`. |
| `PORTAL_GATE_LOG` | unset | Set to `1` to log the shared concurrency and buffer controller every 20 seconds. |
| `PORTAL_PROGRESS_INTERVAL` | `10000` | Sets the Portal progress-log interval in milliseconds. Set to `0` to disable it. |
| `PORTAL_CHECKS` | `on` | Runs constant-time runtime invariant checks. `strict` adds full-structure checks intended for tests. |

For chunk sizing, concurrency, timeouts, and discovery settings, use the repository's [configuration reference](https://github.com/subsquid-labs/portal-ponder/blob/main/portal/INTEGRATION.md#tuning). Raising concurrency does not help when Ponder's indexing loop is already the bottleneck.

## Realtime

Realtime indexing uses Ponder's RPC path by default. This is also the default for reorg handling. Keep the RPC configured for chain setup and `readContract` even if you test another realtime mode.

<Warning>
  `PORTAL_REALTIME=stream` is experimental. The current implementation accepts only log sources that do not request transaction receipts. It rejects block, transaction, trace, transfer, and receipt-dependent sources at startup. Use RPC realtime unless you have validated this mode for your app.
</Warning>

When stream realtime is enabled, historical sync stops at Portal's finalized head and the Portal `/stream` supplies the later blocks. Without this flag, an interval beyond the Portal finalized head falls back to stock RPC historical sync.


## Related topics

- [Use Portal with Ponder](/en/sdk/alternative-clients/ponder.md)
- [Ponder and Portal examples](/en/sdk/alternative-clients/ponder/examples.md)
- [Run the Ponder and Portal example](/en/sdk/alternative-clients/ponder/quickstart.md)
- [Migrate a Ponder app to Portal](/en/sdk/alternative-clients/ponder/guides/migrate.md)
- [Private Portal setup](/en/portal/self-hosting.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.