Introducing Checkpoint: a library for indexing StarkNet data

Earlier this year we announced Snapshot X, our upcoming on-chain voting framework launching on StarkNet. While building out Snapshot X, we realized that an app on StarkNet would benefit from a richer API layer than querying for data directly from the blockchain. The go-to solution to this on mainnet would have been to use The Graph to index on-chain data. At this time however, The Graph doesn’t support StarkNet so. We set out to build a solution ourselves, Checkpoint.

What is Checkpoint

Checkpoint is a library for indexing data from StarkNet events and making it accessible through GraphQL. It provides similar functionality to The Graph but for StarkNet. Checkpoint performs two main functionalities:

  1. Indexing contract data based on StarkNet events
  2. Exposes a GraphQL API to query this data.

How it works

Checkpoint learns what and how to index StarkNet data based on configuration parameters and user-defined JavaScript functions called Data Writers.

The configuration parameters define the smart contract addresses of interest and the relevant events Checkpoint should be tracking. The Data Writers describe the logic that maps events to data that Checkpoint will store in its database. Checkpoint then exposes the stored data to the public through a GraphQL API.

This diagram shows the flow of data once a Checkpoint instance has started processing StarkNet transactions:

Flow diagram of Checkpoints Interaction
Flow diagram of Checkpoints Interaction

As highlighted in the flow diagram above:

  1. A decentralized application adds data to StarkNet through a transaction on a smart contract.
  2. The smart contract emits one or more events while processing the transaction. Checkpoint continually scans StarkNet for new blocks and checks if transactions contain events for your configured contracts.
  3. Checkpoint then calls the data writer function for the respective event. Writers are responsible for writing entity objects to the database.
  4. The dApp 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.

How to get started

Checkpoint is currently out in beta. You can visit Checkpoint’s website at checkpoint.fyi to get started. We have a quick start guide for you to get up and running in no time.

Please join Snapshot’s Discord server here to give the team feedback; this will help us significantly improve the product to cater for your specific needs.

Website: checkpoint.fyi

Docs: docs.checkpoint.fyi

Telegram: t.me/+dk7Q7FAVJ1oyMDFl

Discord: discord.gg/snapshot

Subscribe to Snapshot Labs
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.