Indexer Installation
The Algorand Indexer enables searching the blockchain for transactions, assets, accounts, and blocks using various criteria. While both V1 and V2 Indexers exist, the V1 Indexer is deprecated and can significantly slow down nodes. Users should use the V2 Indexer.
The V2 Indexer runs as an independent process that connects to a PostgreSQL compatible database containing the ledger data. The Indexer populates this database by connecting to an Algorand archival node and processing all ledger data. Alternatively, the Indexer can connect to a PostgreSQL database that has already been populated by another Indexer instance. This setup allows you to have multiple reader instances providing REST APIs for searching the database, while a single Indexer handles loading the ledger data.
The V2 Indexer is network agnostic and can connect to BetaNet, TestNet, or MainNet.
The source code for the Indexer is available on GitHub.
For more information, see:
- Searching the Blockchain feature guide
- REST API Indexer reference
- Indexer README
Indexer V2 Installation and Setup
Installation
-
Download the Indexer binaries from GitHub.
-
Extract the binaries:
You can place the binary in any directory. These instructions use an indexer folder in the current user’s home directory:
Running the Indexer
The Indexer provides two main services:
- Loading ledger data into a PostgreSQL database
- Providing a REST API to search this ledger data
You can configure the Indexer to point to a database loaded by another Indexer instance, and the database doesn’t need to be on the current node. This allows for a setup where one Indexer loads the database while multiple Indexers share this data through their REST APIs.
View all available options by running the
Indexer binary with the -h
flag.
Start as a Reader
To run the Indexer as a reader (without connecting to an Algorand node), use the --postgres
or
-P
option with a valid PostgreSQL connection string:
Start as a Data Loader
To populate the PostgreSQL database, provide the Algorand Archival node connection details using either:
- The Algorand Node data directory (
--algod
), if the node is on the same machine - The algod network host and port string (
--algod-net
) with the API token (--algod-token
)
The Indexer’s --data-dir
flag specifies where it writes its own data and is distinct from the
algod data directory mentioned above.
REST API Configuration
The Indexer provides a REST API for accessing the indexed blockchain data. The API can be configured for both server settings and authentication.
Server Configuration
- The API server defaults to port 8980
- Use the
--server
option with a [host:port] value to specify a different address (e.g.,--server localhost:3000
)
Authentication
- Set an API token using the
--token
parameter when starting the Indexer - If a token is set, all API clients must include this token in their requests to access the endpoints
View Indexer REST Endpoint specifications here.
To enable indexing on a node:
- Set the
isIndexerActive
configuration parameter totrue
- Ensure the node is in archival mode