Introducing Hydra, a GraphQL query node for substrate chains
A query node builder for Substrate chains
A Substrate query node framework. Hydra gives a smooth way to provide powerful GraphQL queries to app developers over your Substrate blockchain state and history.

What's Hydra?

Hydra is a query node for Substrate-based blockchains. A query node ingests data from a substrate chain and provides rich, domain-specific, and highly customizable access to the blockchain data, far beyond the scope of direct RPC calls. For example, expired Kusama Treasury spending proposals are pruned from the state of the Kusama blockchain, so querying, say, one-year-old proposals is problematic. Indeed, one has to track the evolution of the state by sequentially applying the Treasury events and extrinsics in each historical block.
That's where Hydra gets you covered. Define your data model and the Hydra indexer will get it in sync with the chain. On top of that, you get a batteries-included GraphQL server with comprehensive filtering, pagination, and even full-text search capabilities.

Hydra Quickstart


    Node 14.x

Option 1 (the best)

Clone the template repo and follow the instructions in README. The project is ready for hacking!

Option 2

$ npx @subsquid/hydra-cli scaffold
and answer the prompts. It will generate a sample project and README with setup instructions.

Architecture one-liner

A Hydra query node ingests substrate events in a multi-step pipeline:
Substrate Chain => Hydra Indexer => Indexer GraphQL gateway => Hydra Processor => Database => Query Node GraphQL endpoint
We recommend using a publicly available Hydra Indexer hosted by Subsquid. The following Hydra Indexer endpoints are currently available and are ready to be used either in a Hydra pipeline or as a standalone API-friendly explorer.
Get in touch with Subsquid to get your chain indexed by Subsquid. You can also set up a self-hosted Hydra Indexer as described in the docs.

Bird-eye overview

A Hydra pipeline has two principal components: Hydra Indexer and Hydra Processor. Hydra Indexer ingests raw data from a substrate chain. Hydra Processor transforms the raw data pulled from the Indexer into domain-level entities defined by the user. The shape of entities is defined in schema.graphql. The data transformation rules (or "mappings") are stateless Javascript functions defining how the Substrate runtime event data should be handled. The set of runtime events, event filters and other Processor settings are defined in manifest.yml. hydra-cli provides additional scaffolding and codegen tooling for running and developing a Hydra Processor tailored for the provided schema file.
Hydra Indexer (top) and Hydra Processor (bottom) data flows

What's next?

Last modified 7d ago