This is documentation for the legacy indexer. To learn how to run the underlying infrastructure for the latest indexer stack, see Transaction Stream Service.
Run an Aptos Indexer
The below installation steps are verified only on macOS with Apple silicon. They might require minor tweaking when running on other builds.
To run an indexer fullnode, these are the steps in summary:
- Make sure that you have all the required tools and packages described below in this document.
- Follow the instructions to set up a public fullnode but do not start the fullnode yet.
- Edit the
fullnode.yamlas described below in this document.
- Run the indexer fullnode per the instructions below.
Install the packages below. Note, you may have already installed many of these while preparing your development environment. You can confirm by running
which command-name and ensuring the package appears in the output (although
libpq will not be returned even when installed).
Important: If you are on macOS, you will need to install Docker following the official guidance rather than
For an Aptos indexer fullnode, install these packages:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Run the commands emitted in the output to add the command to your path and install any dependencies
cargoRust package manager -
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
brew install docker
- libpq Postgres C API library containing the
brew install libpqMake sure to perform all export commands after the installation.
postgresPostgreSQL server -
brew install postgresql
brew install diesel
Set up the database
- Start the PostgreSQL server:
brew services start postgresql
- Ensure you can run
psql postgresand then exit the prompt by entering:
- Create a PostgreSQL user
createusercommand (find it with
/path/to/createuser -s postgres
aptos-corerepository if you have not already:
git clone https://github.com/aptos-labs/aptos-core.git
- Navigate (or
- Create the database schema:This will create a database schema with the subdirectory
diesel migration run --database-url postgresql://localhost/postgres
migrationslocated in this
aptos-core/crates/indexerdirectory. If for some reason this database is already in use, try a different database. For example:
DATABASE_URL=postgres://postgres@localhost:5432/indexer_v2 diesel database reset
Start the fullnode indexer
Follow the instructions to set up a public fullnode and prepare the setup, but do not yet start the indexer (with
Pull the latest indexer Docker image with:
docker pull aptoslabs/validator:nightly_indexer
./fullnode.yamland add the following configuration:
# This is to avoid the node being pruned
Instead of syncing your indexer fullnode from genesis, which may take a long period of time, you can choose to bootstrap your fullnode using backup data before starting it. To do so, follow the instructions to restore from a backup.
- Run the indexer fullnode with either
docker rundepending upon your setup. Remember to supply the arguments you need for your specific node:or:
docker run -p 8080:8080 \
-p 9101:9101 -p 6180:6180 \
-v $(pwd):/opt/aptos/etc -v $(pwd)/data:/opt/aptos/data \
--workdir /opt/aptos/etc \
--name=aptos-fullnode aptoslabs/validator:nightly_indexer aptos-node \
cargo run -p aptos-node --features "indexer" --release -- -f ./fullnode.yaml
Restart the indexer
To restart the PostgreSQL server:
shut down the server by searching for the
postmasterprocess and killing it:
ps -ef | grep -i postmaster
Copy the process ID (PID) for the process and pass it to the following command to shut it down:
kill -INT PID
Restart the PostgreSQL server with:
brew services restart postgresql@14