# Ternoa indexer

### Overview⛓️ <a href="#overview" id="overview"></a>

The indexer is an open, flexible, and fast tool based on the [**SubQuery Framework**](https://doc.subquery.network/)**.** It is used to transform blockchain data into a **graphql queryable database**.

#### How it works:

The indexer scans through each block and their events to see what happened on the Ternoa Blockchain. It then parses all that data into entities and inserts it in a Postgres DB. Ternoa deploys its indexer, and anybody can run his own.

> You can get more information on the [**SubQuery official documentation**](https://doc.subquery.network/faqs/faqs.html)

> You can also check out [**our repository**](https://github.com/capsule-corp-ternoa/ternoa-subql) to see how we set up the subquery project to connect to the ternoa blockchain.

#### The most important files are:

* Project.yaml: set up the endpoint, the genesis hash, the types file, and the different filters to get only the specific events / extrinsics needed. We can also filter on the success status of the event / extrinsic.
* Schema.graphql: specifies the custom data we need to record in our Postgres db.
* The Mappings folder: Your mappingHandlers will handle the functions to transform the blockchain data into the needed GraphQL entities contained in the Schema.graphql. More info [here](https://academy.subquery.network/build/mapping/polkadot.html)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ternoa.network/getting-started/javascript-sdk/ternoa-indexer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
