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.

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.

Hydra CLI quickstart

$ npx @subsquid/[email protected] scaffold
and answer the prompts. It will generate a sample project and README with setup instructions.

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 fron the Indexer into domain-level entities defined by the user. The shape of entities is defined in schema.graphl. The data treansformation 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?

  • Explore live Hydra Indexer playground and query Kusama events and extrinsics
  • Install Hydra toolkit
  • Hydra tutorial: spin a query node in under five minutes
  • Learn how to define your own data schema and mappings to run a Hydra Indexer
Last modified 4d ago