Indexing Blockchain Data - Your Options Compared

Compare ways to index blockchain data, from a custom RPC worker to The Graph, Ponder, Envio HyperIndex and SQD, with code and selection criteria.

In this guide
  1. Why dApps need an indexer
  2. The options at a glance
  3. Option 1: a custom worker over RPC
  4. Option 2: The Graph
  5. Option 3: Ponder
  6. Option 4: Envio HyperIndex and SQD
  7. How to choose
  8. FAQ
  9. Sources

Indexing means copying on-chain data into a store you can query quickly, because a node's JSON-RPC API cannot filter, sort or join. You have three broad choices: write a small worker that pulls logs over RPC into your own database, define a subgraph on The Graph, or run a code-first indexing framework such as Ponder, Envio HyperIndex or the SQD SDK. The right one depends on how much data you need, how fresh it must be and how much infrastructure you want to operate.

This comparison reflects the tools' documentation as of December 2026.

Why dApps need an indexer

A contract can tell you one account's balance. It cannot tell you "the 20 most recent transfers involving this account" or "all open orders sorted by price". Answering those from a node means scanning event logs across millions of blocks on every page load.

An indexer does that scan once, keeps up with new blocks, and writes the results somewhere queryable. Every option below does the same four jobs:

  1. Backfill historical events from a start block.
  2. Follow the chain head as new blocks arrive.
  3. Handle reorgs by undoing data from blocks that were replaced.
  4. Serve queries through SQL, GraphQL or your own API.
An indexer reads event logs from a node over JSON-RPC, backfills history, follows the chain head and rolls back on reorgs, then writes to a queryable store that the dApp queries with SQL or GraphQL.
The four jobs every indexer does, whichever tool you pick.

They differ in who writes the code for each job and who runs it.

The options at a glance

Option You write Runs on Query interface Good fit
Custom RPC worker Everything, in any language Your servers and database Whatever you build Few contracts, full control, existing backend
The Graph subgraphs Manifest, GraphQL schema, AssemblyScript mappings Subgraph Studio for testing, The Graph Network's indexers for production GraphQL Public data shared by many consumers, no servers to run
The Graph Substreams Stream-processing modules The Graph's Substreams providers Sinks into your own store High-volume, low-latency pipelines
Ponder TypeScript schema and handlers Your servers, with PostgreSQL GraphQL, SQL over HTTP, direct SQL TypeScript teams that want the data in their own Postgres
Envio HyperIndex Config, schema, TypeScript or ReScript handlers Envio Cloud or self-hosted GraphQL Multichain apps and large backfills
SQD (Portal and SDKs) TypeScript processors SQD Cloud or self-hosted Your database and API Custom pipelines over many networks, including non-EVM

Option 1: a custom worker over RPC

For a handful of events from one or two contracts, a worker of a few hundred lines is often enough. The core is eth_getLogs, shown here with viem 2.x:

import { createPublicClient, http, parseAbiItem, type Address } from 'viem';
import { mainnet } from 'viem/chains';

const client = createPublicClient({
  chain: mainnet,
  transport: http(process.env.RPC_URL),
});

const transferEvent = parseAbiItem(
  'event Transfer(address indexed from, address indexed to, uint256 value)',
);

export async function fetchTransfers(
  token: Address,
  fromBlock: bigint,
  toBlock: bigint,
) {
  const logs = await client.getLogs({
    address: token,
    event: transferEvent,
    fromBlock,
    toBlock,
  });

  return logs.map((log) => ({
    blockNumber: log.blockNumber,
    logIndex: log.logIndex,
    txHash: log.transactionHash,
    from: log.args.from,
    to: log.args.to,
    value: log.args.value, // bigint
  }));
}

Around that call you need a loop that:

  • walks the block range in chunks, because RPC providers limit how many blocks or results a single log query may cover, and the limits vary by provider;
  • writes each chunk and a progress cursor in one database transaction;
  • uses (block_number, log_index) as a unique key so reprocessing is harmless;
  • stores block hashes for recent blocks and rolls back when a parent hash does not match.

Our guide to off-chain data with PostgreSQL has the schema and SQL for all four points.

Strengths: no new vendor, any language, and the data lands where your backend already reads.

Costs: backfills over RPC are slow for busy contracts, and you own reorg handling, retries and monitoring. With many contracts or several chains, you end up rebuilding a framework.

Option 2: The Graph

The Graph's documentation describes two data products. Subgraphs are custom APIs that extract, process and serve blockchain data, and are its original and most widely used service. Substreams is a parallelized technology aimed at high-performance, real-time use cases.

A subgraph has three main files:

  • subgraph.yaml, the manifest naming the contracts, network and events to index;
  • schema.graphql, the entities you want to store and query;
  • mapping code in AssemblyScript that turns each event into entities.

A minimal entity for ERC-20 transfers looks like this:

type Transfer @entity(immutable: true) {
  id: Bytes!
  from: Bytes!
  to: Bytes!
  value: BigInt!
  blockNumber: BigInt!
}

The mapping function receives each Transfer event, creates an entity, copies the fields and saves it. The Graph CLI generates typed classes for events and entities from your ABI and schema.

How deployment works now

The workflow in current documentation is:

  1. Develop and test locally with Graph Node, or deploy to Subgraph Studio, which indexes the subgraph and gives you a development query URL.
  2. Publish the subgraph to The Graph Network. Publishing is an on-chain action.
  3. Independent indexers serve the subgraph. The docs note that a published subgraph is unlikely to be picked up by indexers unless it has curation signal.
  4. Applications query through a gateway with an API key, and the gateway bills for queries.

Older tutorials mention a free "hosted service". It was shut down in June 2024 in favor of the network, so treat any guide built around it as outdated.

Strengths: nothing to operate, a GraphQL API out of the box, and a data set that other teams can also query. Unit tests are possible with the Matchstick framework.

Costs: mappings are written in AssemblyScript, a restricted TypeScript-like language without the npm ecosystem. Data lives behind a GraphQL endpoint rather than in your own database, so joining it with application tables takes extra work. Production queries are metered.

Option 3: Ponder

Ponder is an open-source TypeScript framework that you run yourself. It was at version 0.18 when this article was written, so it is still pre-1.0 and its APIs can change between minor releases.

You define tables in ponder.schema.ts:

import { onchainTable, index } from "ponder";

export const transfers = onchainTable(
  "transfers",
  (t) => ({
    id: t.text().primaryKey(),
    from: t.hex().notNull(),
    to: t.hex().notNull(),
    value: t.bigint().notNull(),
    blockNumber: t.bigint().notNull(),
  }),
  (table) => ({
    toIdx: index().on(table.to),
  }),
);

and write handlers as ordinary TypeScript:

import { ponder } from "ponder:registry";
import { transfers } from "ponder:schema";

ponder.on("ERC20:Transfer", async ({ event, context }) => {
  await context.db.insert(transfers).values({
    id: event.id,
    from: event.args.from, // argument names come from your ABI
    to: event.args.to,
    value: event.args.value,
    blockNumber: event.block.number,
  });
});

"ERC20:Transfer" combines a contract name from ponder.config.ts with an event name from its ABI. A new project is scaffolded with the create-ponder tool.

Ponder writes to PostgreSQL and exposes the data three ways: an auto-generated GraphQL API, SQL over HTTP, and direct SQL. Indexes declared in the schema are created after the backfill finishes.

Strengths: plain TypeScript with full type inference from ABIs, any npm package inside handlers, and results in a database you control.

Costs: you host it, you supply RPC endpoints, and you track a fast-moving pre-1.0 project.

Option 4: Envio HyperIndex and SQD

Both of these pair an indexing framework with a specialized data source that replaces plain RPC for historical data.

Envio HyperIndex

HyperIndex is Envio's multichain indexing framework. Projects are created with envio init, handlers are written in TypeScript or ReScript, and indexed data is served through a GraphQL API. Per its documentation it can index EVM, SVM (Solana) and Fuel chains, with Solana support marked stable from v3.11.

Historical data comes from HyperSync, Envio's own data engine, which is the default source on every chain it supports. Envio's docs state it is far faster than fetching the same data over RPC; that is the vendor's claim, so benchmark with your own contracts. You can switch to RPC as a source without changing handler code.

From version 3, HyperSync requires an API token (ENVIO_API_TOKEN) when you self-host; indexers on Envio Cloud do not need a custom one, and local chains such as Anvil need none.

SQD

SQD (formerly Subsquid) offers several pieces:

  • Portal, an HTTP API that streams raw blockchain data as JSON Lines for arbitrary block ranges;
  • TypeScript SDKs (Squid and Pipes) for decoding, transforming and persisting that data to a database of your choice;
  • Cloud, managed hosting for indexers;
  • the SQD Network, the decentralized data lake behind Portal.

Its documentation lists more than 110 networks, including Ethereum, Solana, Base, Arbitrum and Bitcoin.

Strengths of both: a purpose-built source for backfills, multichain support and optional managed hosting.

Costs of both: a dependency on one provider's data service for historical sync, and usage tiers to read before committing.

How to choose

Work through these questions in order:

  1. How much history? A new contract with modest activity syncs fine over RPC. Years of events from a busy protocol push you toward HyperSync, SQD Portal or Substreams.
  2. Where must the data live? If you need joins with application tables, pick something that writes to your own PostgreSQL: a custom worker, Ponder or the SQD SDK.
  3. Who operates it? If nobody on the team wants to run servers, a subgraph or a managed cloud is the realistic answer.
  4. Which chains? Check each tool's supported-networks list, particularly for newer rollups and for permissioned networks, where hosted data services are rarely available (see private vs public blockchains). Layer 2 explained for developers covers why finality and reorg behavior differ on rollups.
  5. What does the team know? TypeScript developers are productive in Ponder, HyperIndex or SQD on day one. AssemblyScript has a learning curve.

Whatever you choose, keep handlers deterministic so that a full resync from the start block reproduces the same result.

Indexers only see what contracts emit, so design events with indexing in mind and test that they fire correctly; see our comparison of smart contract testing tools. An indexed dashboard also makes a convincing portfolio project.

FAQ

Can I skip indexing and read everything from the front end?

For current state of a few values, yes: direct contract reads are simpler and always fresh. For history, lists, search or aggregates, no. Log scans from the browser are slow and quickly hit RPC rate limits.

Is indexed data trustworthy?

It is a derived copy. Bugs in handlers, missed reorgs or provider gaps can make it wrong. Use the index for display and discovery, and re-check anything that matters, such as a balance before a transaction, directly against the contract.

Subgraph or Ponder for a first project?

For a hosted GraphQL endpoint without running anything, start with a subgraph in Subgraph Studio. If you already run Node.js and PostgreSQL, Ponder keeps the data next to the rest of your application.

Sources

About the author

Alessandro Moretti is a crypto analyst and blockchain strategist who writes and maintains the guides on BlockDev Path. Every factual claim is checked against the primary sources listed above. Spotted an error? Tell us and we will correct it. See our editorial policy.