The Indexer API, Transaction Stream Service, and Custom Processors are currently in beta. Please report any problems you encounter by creating an issue in the aptos-indexer-processors repo.
This guide will walk you through setting up a self-hosted Indexer API.
Currently this guide only explains how to run processor part of the Indexer API. By the end of this guide you will have a running processor that consumes transactions from the Transaction Stream Service, parses them, and stores them in the database. Unfortunately this guide does not explain how to attach an API to this system right now.
- A running PostgreSQL instance is required, with a valid user and database. In this example we call the user
postgresand the database
- If you wish to use Docker, you must have Docker installed. Installation Guide.
To run the service we need to define a config file. We will start with this template:
From here you will likely want to change the values of some of these fields. Let's go through some of them.
A single instance of the service only runs a single processor. If you want to run multiple processors, you must run multiple instances of the service. In this case, it is up to you whether to use the same database or not.
This is the processor you want to run. You can see what processors are available here. Some examples:
This is the connection string to your PostgreSQL database. It should be in the format
If you're running this from a Docker Desktop environment (which you likely are if you're using MacOS or Windows) you must set
postgresql://host.docker.internal:5432/indexer instead. With Docker Desktop this is how the binary can reach the host network.
This is the URL for the Transaction Stream Service. If you are using the Labs-Hosted instance you can find the URLs for each network at this page. Make sure to select the correct URL for the network you want to index. If you are running this service locally the value should be
This is the auth token used to connect to the Transaction Stream Service. If you are using the Labs-Hosted instance you can use the API Gateway to get an API key. Learn more at this page.
Run with source code
Clone the repo:
git clone email@example.com:aptos-labs/aptos-indexer-processors.git
git clone https://github.com/aptos-labs/aptos-indexer-processors.git
Navigate to the directory for the service:
Run the service:
cargo run --release -- -c config.yaml
Run with Docker
To run the service with Docker, use the following command:
docker run -it --network host --mount type=bind,source=/tmp/config.yaml,target=/config.yaml aptoslabs/indexer-processor-rust -c /config.yaml
This command binds the container to the host network and mounts the config file from the host into the container. This specific invocation assumes that your config file in the host is at
See the image on DockerHub here: https://hub.docker.com/r/aptoslabs/indexer-processor-rust/tags.