Crypto glossary

Blockchain indexer (subgraph)

Definition

A blockchain indexer reads raw chain data, such as blocks and event logs, and organises it into a database that apps can query quickly, often as a subgraph.

Nodes are good at answering narrow questions, like the balance of one address at the latest block, but bad at questions such as every swap a user made in a pool last year. Indexers fill that gap. They process blocks and event logs as they arrive, transform them with custom rules and store the results in a database exposed through GraphQL, SQL or REST. A subgraph, the format popularised by The Graph, is one such definition of which contracts and events to index and how.

Almost every dApp front end depends on indexed data to show positions, histories and charts, and analytics platforms are built on the same idea. Options range from decentralised indexing networks to hosted services and self-hosted frameworks that teams run on their own servers.

Indexed data is a derived copy and can lag behind the chain, break after a contract upgrade or mishandle reorgs, where recent blocks are replaced. If an indexer goes down, an app may look broken even though funds on-chain are fine. Many decentralised apps also quietly rely on a single centralised indexing provider.

Example

A lending app's dashboard shows a user's full borrowing history by querying a subgraph that indexes every Borrow and Repay event from the protocol's contracts.

Related terms

Latest articles on Blockchain indexer