Introducing Dappetizer: Indexing Framework for Tezos
Having a contract indexer and a dedicated API is a requirement for many dapps. It allows your app to query any data outside of what’s available when connecting to Tezos node RPC.
In the early days of Tezos, building a contract indexer was not easy — it had to be built pretty much from scratch, often repeating the same code and inviting errors. Fortunately, a lot of work has been done since: the excellent indexing framework DipDup for Python has been released, and we at Agile Ventures have been working on our own indexing framework, Dappetizer, built on TypeScript/JavaScript and Taquito.
We wanted to share a preview of Dappetizer (0.9.1) while we are getting ready to release the first stable version (1.0.0) in a couple of weeks.
About Dappetizer
Dappetizer is a framework focused on simplicity and streamlining of common use cases encountered when building a contract indexer.
- The whole indexing lifecycle is taken care of automatically. The framework keeps track of which blocks were already indexed and when new blocks become available. It also detects and handles block reorganizations.
- Dappetizer comes with its own scaffolding tool, which makes prototyping or starting a new project easy.
- Persistence support is built-in. We currently support PostgreSQL and SQLite with more databases likely coming.
- We had containerization in mind when designing Dappetizer — indexers are easy to run in Docker.
- The runtime only depends on Tezos Node RPC and optionally an IPFS gateway (for contract metadata).
Getting started with Dappetizer
The first step is installing the latest version (0.9.1 at the time of writing) with NPM:
npm install @tezos-dappetizer/cli
You can scaffold a new project by giving Dappetizer a contract address to index. As an example we will use a Quipuswap exchange contract (XTZ — kUSD):
npx dappetizer init KT1K4EwTpbvYN9agJdjpyJm4ZZdhpUNKB3F6
This will generate the whole project structure (including package.json
) with required dependencies as needed. You can see that Dappetizer already scaffolded an indexer in src/quipu-token-indexer.ts
:
export class QuipuTokenIndexer {
@indexEntrypoint('approve')
async indexApprove(
parameter: QuipuTokenApproveParameter,
dbContext: DbContext,
indexingContext: EntrypointIndexingContext,
): Promise<void> {
// Implement your indexing logic here or delete the method if not needed.
}
...
The indexing methods let you react to everything related to the contract: entrypoint calls, storage changes, bigmap updates, and so on. You can store whatever information you need in a database — Dappetizer already comes with the support of PostgreSQL and TypeORM, but you can use your own persistence layer if needed. Finally, indexing is started simply by running npx dappetizer start
.
For full details on how to set up a new indexer, please follow our quickstart guide.
What’s next
We plan on releasing Dappetizer 1.0.0 this month. The focus for the near future is on improving documentation, writing new guides, and polishing the overall experience with the framework.
As always, all feedback is welcome! If you want to let us know your suggestions, ask a question, or just want to say “hi,” come join us on our Discord server!