checkpoint
Search…
Introduction
Checkpoint is a library for indexing data from StarkNet events and making it accessible through GraphQL. Checkpoint is inspired by The Graph and focused on providing similar functionality for StarkNet.

How it works

Checkpoint learns what and how to index StarkNet data based on configuration parameters, known as the Checkpoint configuration. Checkpoint configuration defines the smart contracts of interest and the relevant events to be tracked. The logic for how to map events to data that Checkpoint will store in its database is defined in user-defined Javascript functions called Checkpoint data writers. Checkpoint then exposes the stored data to the public through a GraphQL API.
This diagram gives more detail about the flow of data once a Checkpoint instance has started processing StarkNet transactions:
Checkpoint Flow Diagram
As highlighted in the flow diagram above:
  1. 1.
    A decentralized application adds data to StarkNet through a transaction on a smart contract.
  2. 2.
    The smart contract emits one or more events while processing the transaction. Checkpoint continually scans StarkNet for new blocks and checks if it contains events for your configured contracts they may contain.
  3. 3.
    Checkpoint calls the data writer function for the respective event. Writers are responsible for writing entity objects to the database.
  4. 4.
    The decentralized application queries the Checkpoint GraphQL API. Checkpoint translates the GraphQL queries into SQL queries to fetch this entity data from the database. The decentralized application displays this data in a rich UI for end-users, which they can also use to issue new transactions on StarkNet, and the cycle repeats.
For each block where Checkpoint encounters relevant events, it creates a record in the database to keep track of it. These records can be queried through the GraphQL API using the _checkpoints query. You can read more about how to do that here.
Also, you can provide a list of blocks as seeds to Checkpoint to help speed up its initial indexing. You can read more about how this works here.

Installation

Checkpoint is an NPM package that can be installed through the following command:
1
npm install @snaphsot-labs/checkpoint
Copied!

Guides: Jump right in

Follow our handy guides to get started with Checkpoint as quickly as possible:

Core Concepts: Dive a little deeper

Learn the fundamentals of Checkpoint to get a deeper understanding of how it works:
Last modified 8d ago