https://github.com/threefoldtech/ledger_graphql
Graphql for TFchain
https://github.com/threefoldtech/ledger_graphql
Last synced: 2 days ago
JSON representation
Graphql for TFchain
- Host: GitHub
- URL: https://github.com/threefoldtech/ledger_graphql
- Owner: threefoldtech
- License: apache-2.0
- Created: 2022-01-04T16:07:56.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2026-05-27T14:04:37.000Z (7 days ago)
- Last Synced: 2026-05-27T16:04:46.283Z (7 days ago)
- Language: TypeScript
- Size: 16.4 MB
- Stars: 2
- Watchers: 8
- Forks: 3
- Open Issues: 29
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Ledger GraphQL
A high-performance indexing layer with a queryable GraphQL API over Ledger Chain on-chain data. It enables efficient data access for dashboards, applications, and analytics tools without directly querying the blockchain.
## What this is
This project provides a Subsquid-based indexer that consumes raw blockchain events from Ledger Chain, transforms them into a structured schema, and exposes them through a GraphQL endpoint. It replaces direct chain queries with a fast, developer-friendly API suitable for front-end applications and data analytics.
## What this repository contains
- **Indexer** — Docker Compose setup for the Squid indexer that ingests on-chain events
- **Processor** — Event processing pipeline that maps raw chain data to database models
- **GraphQL schema** — `schema.graphql` defining the queryable data model
- **Database migrations** — Migration files for the processor database
- **Type definitions** — Chain-specific type files for decoding events
- **Mapping functions** — Logic for transforming events into indexed entities
- **Scripts** — Utility scripts for generating initial state and development workflows
## Role in the stack
The indexer sits between the blockchain and consumer applications. It decouples data access from the chain, allowing complex queries, aggregations, and historical lookups that would be inefficient or impossible via direct RPC calls. Dashboards, explorers, and third-party integrations rely on this layer for real-time and historical data.
The data pipeline is:
```
Ledger Chain => Squid Indexer => Indexer GraphQL gateway => Squid Processor => Database => Query Node GraphQL endpoint
```
## Relation to ThreeFold
This technology is used within the ThreeFold ecosystem and was first deployed on the ThreeFold Grid. The component itself is designed as reusable infrastructure technology and should be understood by its technical function first, independent of any specific deployment.
## Ownership
This repository is owned and maintained by TF-Tech NV, a Belgian company responsible for the development and maintenance of this technology.
## Prerequisites
- Node v16.x
- Docker
- Docker Compose
## Running
See [docs](./docs/readme.md) for detailed running instructions.
## Project layout
- `indexer` — Docker Compose setup for the indexer
- `db` — Processor database migration files
- `scripts` — Scripts for generating initial state and development scripts
- `src` — Source code
- `mappings` — Mapper functions for indexer data
- `model` — Generated models from the `schema.graphql` file
- `types` — Type files that require manual edits when the schema or chain types change
- `processor.ts` — Processor entrypoint
- `typegen` — Declaration file generation (used for development)
- `tfchainVersions.jsonl` — Generated Ledger Chain runtime versions and their data
- `typegen.json` — Typegen config
- `typesBundle.json` — Typegen bundle config
- `schema.graphql` — The GraphQL schema file; changes to this file result in changes to the models in `src/models`
## License
This project is licensed under the Apache License 2.0 — see the [LICENSE](LICENSE) file for details.