The Graph works by turning messy on-chain data into clean, queryable APIs. Developers define what data they want in a subgraph, a network of Indexers processes the blockchain according to that definition, and applications then fetch the organized result through GraphQL queries in milliseconds. The whole system exists to solve one problem: blockchains are built for writing data, and painfully slow at reading it back.
This is the machinery behind thousands of dApps that most users never see. Understanding it explains why The Graph matters and where GRT fits into the flow.
What Is a Subgraph
A subgraph is an open API that describes a slice of blockchain data and how to structure it. It has three parts, and each does a specific job.
The Manifest
The manifest is the configuration file. It names the smart contracts to watch, the blockchain to index, the events to listen for, and the block to start from. It is the instruction sheet that tells Indexers exactly what to pay attention to.
The Schema
The schema defines the shape of the data, written in GraphQL. It declares the entities and fields an application will be able to query, like a token's transfers, a user's positions, or a pool's liquidity over time. Applications query against this schema.
The Mappings
Mappings are the logic that transforms raw blockchain events into the entities defined in the schema. Written in AssemblyScript, they run every time a relevant event fires, converting a raw log into structured, queryable data. This is where the real translation from chain to database happens.
The Lifecycle of a Query
Once a subgraph is deployed and indexed, serving data follows a clear path. Here is what happens when an application asks for information.
- The app sends a GraphQL query to The Graph's gateway, requesting exactly the fields it needs.
- The gateway routes the query to Indexers serving that subgraph, selecting based on price and performance.
- An Indexer processes the query against its indexed data and returns the result in milliseconds.
- A query fee is paid in GRT, settling to the Indexer and, in part, to the Curators who signaled the subgraph.
That fee flow is the network's revenue engine, and the way those fees split and partly burn is detailed in our GRT tokenomics guide. Every query is a tiny economic event, and at over a trillion cumulative queries, they add up.
How Indexing Actually Happens
Indexers are the operators that do the heavy lifting. Each runs a Graph Node, software that reads the blockchain, applies a subgraph's mappings, and stores the resulting data ready to serve. To participate, an Indexer stakes GRT as collateral, which can be slashed if it serves incorrect data, and submits Proofs of Indexing to verify its work.
Regular holders take part without running any of this by delegating GRT to Indexers, a process covered in our guide on how to stake GRT. To do so, they hold GRT in a self-custody wallet, and our best GRT wallets breakdown covers the options. The result is a network where technical operators and passive holders both contribute to keeping data available.
Substreams and the Faster Data Pipeline
Subgraphs are the original product, and The Graph has since built faster ways to move data. Substreams, powered by the Firehose extraction layer, stream blockchain data in parallel at high speed, feeding real-time systems that cannot wait for traditional indexing. DeFi protocols and trading systems on chains like Solana and Base use Substreams for low-latency data.
This is where The Graph's architecture diverges from an oracle network. Where systems compared in our The Graph vs Chainlink breakdown push external facts onto a chain, The Graph extracts and structures what is already on-chain, at growing speed and scale. The two solve retrieval and delivery as separate engineering problems.
Why the Architecture Matters
The design choices have real consequences for GRT holders. Because the network charges per query and burns a slice of every fee, actual usage feeds directly back into the token economy. That is the mechanism the bull case relies on, and it is central to the scenarios in our GRT price prediction analysis. A network serving record query volume has a working revenue engine, even when the token price does not reflect it.
The architecture also explains The Graph's durability. By making indexing a shared, incentivized public good rather than something every team rebuilds, it created infrastructure that gets more valuable as more applications depend on it. That network effect is the moat.
Frequently Asked Questions
What is a subgraph in The Graph?
A subgraph is an open API that defines what blockchain data to index and how to structure it. It consists of a manifest listing the contracts and events to watch, a GraphQL schema defining the data shape, and mappings that transform raw events into queryable entities. Applications query subgraphs to fetch organized on-chain data.
What programming language does The Graph use?
Subgraph schemas are written in GraphQL, and the mappings that transform blockchain data are written in AssemblyScript, a TypeScript-like language. Applications query subgraphs using GraphQL, requesting only the specific fields they need in a single request.
How does The Graph get data from blockchains?
Indexers run Graph Node software that reads the blockchain, applies a subgraph's mapping logic to relevant events, and stores the structured result. Newer tools like Substreams and Firehose extract data at higher speed for real-time applications. The processed data is then served to applications through GraphQL queries.
The Engine Behind Web3 Data
The Graph's architecture is a pipeline: subgraphs define the data, Indexers process it, and GraphQL queries deliver it, with GRT metering every step. Substreams and Firehose add speed for applications that need it. Together they turn blockchains from write-optimized ledgers into readable, queryable databases.
For anyone holding or trading GRT, this machinery is the fundamental value. The token is a claim on a working data network, and understanding how queries flow and fees settle is the clearest way to judge whether that network is worth its valuation.
Trade GRT on the spot market or open a leveraged position with GRT perpetual futures on LeveX. Explore the Crypto in a Minute series for more token deep-dives.
