The Tezos RPC API exposes all the information you could possibly need to build applications using blockchain data, however, the RPC API alone might not be efficient for your particular use-case, this is where indexers come into play, here we are going to look at two different indexers for Tezos.

Why

Generally all information about the blockchain is exposed in the RPC API, however the Tezos node itself does not keep indexes ( used for fast lookup of data ) on some information you might need, for queries like “Get all transaction of this Contract” you need a different data structure than the node alone stores, here is what the RPC API looks like:

If you were to draw a picture of the relationships of data exposed in the RPC API it might look something like this:

In this Data Model you can go from left to right, so for example “Get all Contracts that have changed in this Block”, however you can’t easily go from right to left, as in “Get all Blocks that include transactions to this Contract” — you could do that by fetching the information of every single Block and see if it contains the information relevant, but this would be very inefficient.

Tezos Indexers take all of that information and save it to a database so that you can do much faster and complicated queries, hence the Data Model of these indexers will look a bit more interesting than this.

First, we look at Conseil, a ”Rich query API for creating web and mobile applications around multiple blockchains” that is actively developed by Cryptonomic, it fetches all its Data via the RPC API and stores it in a SQL Database ( like PostgreSQL ).

https://github.com/Cryptonomic/Conseil

The Database Schema of Conseil is pretty straightforward:

However, you don’t need to deal with that Database directly as Conseil also includes A very well documented API.

Other projects of Cryptonomic include ConseilJS, a javascript library to interact with this API, as well as Arronax — a blockchain explorer, and Tezori — a Tezos Wallet, both built on Conseil.

Next, we will look at the Indexer by Nomadic Labs, you can find the project here:

https://gitlab.com/nomadic-labs/tezos-indexer/tree/mainnet

Similar to Conseil this indexer also uses a PostgreSQL database, however with a more normalized Data Model

Unfortunately, this project does not come with its own API, so if you want to use this you will have to make SQL queries to this Database yourself.

This Indexer is still a work in progress and currently only works on Tezos Mainnet, but it is actively developed by Nomadic Labs, so we look forward to seeing how this project evolves!