Skip to main content

IOTA Indexer

The IOTA Indexer is a node data service that serves data from the IOTA protocol, including both data directly generated from chain and derivative data.

Indexer architecture

Functions

The IOTA Indexer provides three main functionalities:

  • Ingest data from a full node to a relational database. Data on full nodes is stored as BCS bytes in an embedded RocksDB database, thus the query capabilities are very limited. The indexer pulls checkpoint blob data, schematizing them into various tables like objects, transactions, and so on, with proper indices.
  • Serve online transaction processing (OLTP) RPC requests. With data in relational databases, IOTA indexer spins a stateless reader binary as JSON RPC server with the associated interface.
  • Other than OLTP data ingestion and requests, the Indexer also supports some analytical data ingestion like transactions per second (TPS) and daily active user (DAU) metrics.
Indexer Worker

One Indexer instance can provide one of the above mentioned functionalities. They can be enabled with the corresponding flag in the Indexer CLI like:

  • --fullnode-sync-worker
  • --rpc-server-worker
  • --analytical-worker

Some RPC calls mentioned in (/iota-api-ref) will only work with an indexer running. This is always mentioned in the RPC call description if it is the case. Indexer RPC calls that provide metrics are provided by the analytical worker.

Run an Indexer

Refer to the IOTA Indexer README to run an indexer with a local or managed Postgres-compatible database.

Run GraphQL Interface

Alternatively to the JSON-RPC, a GraphQL interface can be used to provide read access to the Indexer database, and enable execution of transactions to the full node.

GraphQL server architecture

A running Indexer database instance is required for the GraphQL API to be functional, so it is advised that an Indexer sync worker is setup and started first.

Then the GraphQL server can be started with the following command:

$ iota-graphql-rpc start-server [OPTIONS]

Options:
-i, --ide-title <IDE_TITLE> The title to display at the top of the page
-d, --db-url <DB_URL> DB URL for data fetching
--db-pool-size <DB_POOL_SIZE> Pool size for DB connections
-p, --port <PORT> Port to bind the server to
--host <HOST> Host to bind the server to
--prom-port <PROM_PORT> Port to bind the prometheus server to
--prom-host <PROM_HOST> Host to bind the prometheus server to
-c, --config <CONFIG> Path to TOML file containing configuration for service
--node-rpc-url <NODE_RPC_URL> RPC url to the Node for tx execution
-h, --help Print help

For more information see IOTA GraphQL-RPC README.