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.
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.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 it contains events for your configured contracts they may contain.
- 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
_checkpointsquery. You can read more about how to do that here.
Checkpoint is an NPM package that can be installed through the following command:
npm install @snapshot-labs/checkpoint@beta
Follow our handy guides to get started with Checkpoint as quickly as possible:
Learn the fundamentals of Checkpoint to get a deeper understanding of how it works: