Skip to content

Latest commit

 

History

History
83 lines (49 loc) · 3.89 KB

README.md

File metadata and controls

83 lines (49 loc) · 3.89 KB

Subsquid - an ETL framework for Web3 data

Subsquid framework is a set of tools to ingest, transform and present blockchain data.

Our current focus is on substrate-based chains, with support for EVM-based chains coming next.

Overview

Subsquid framework consists of several key components.

Archive

An Archive is a set of services formed by substrate-ingest, substrate-gateway, postgres compatible database and optionally substrate-explorer, which together

  1. ingest blockchain data
  2. decode and persist it in a normalized form
  3. make it available for further processing and exploration.

Compared to data access using a conventional chain node RPC, an archive allows one to access data in a more granular fashion and from multiple blocks at once. The explorer service provides a GraphQL API for querying historical blocks, events and transactions with rich filtering capabilities.

Processor

substrate-processor fetches on-chain data from an archive and executes user-defined mapping code against it.

Typegen tools

substrate-typegen(1) can generate facade TypeScript classes for substrate events, calls and storage items, allowing to work with chain data in a fully typesafe and runtime upgrades aware fashion.

Similarly, squid-evm-typegen(1) generates facade TypeScript classes for type-safe processing of EVM logs.

Postgres

substrate-processor is designed to be able to load the processed data into an arbitrary database and indeed one can run it without a persistent store.

However, extra tooling for data modeling and serving the data with GraphQL is available when a processor is run against a postgres-compatible database. In such a case, the Subsquid framework suggests the following dev flow:

  1. Define the target database schema using a GraphQL dialect enriched with custom directives
  2. Generate TypeORM entity classes with typeorm-codegen
  3. Generate and apply database migrations with typeorm-migration
  4. Use powerful and extensible GraphQL server to serve produced data right away.

Squid

ETL projects built with the Subsquid framework are called Squids.

Squids have a certain structure and are supposed to be developed as regular node.js packages. See squid-template for a reference.

A typical squid implements both data mapping and an API server presenting the data.

Squids can be deployed to a Subsquid cloud service called Aquairum. In the future, the cloud service will be replaced by an open network of decentralized squid operators.

For more details on how to build, run and deploy a squid consult the Docs

Other tools

The Subsquid framework incorporates a few npm packages that might be useful in a standalone mode:

Getting started

The best way to get started is to clone and inspect squid-template project.

Developer community

Our developers are active on telegram. Feel free to join and ask any question!

Contributing

Subsquid is an OpenSource project, contributions are welcomed, encouraged and will be rewarded!

Please consult CONTRIBUTING.md for hacking instructions and make sure to read our code of conduct.