Skip to content

iotaledger/rebased-stardust-indexer

Repository files navigation

Indexer of stardust migration objects

A simple application indexing custom data from the stardust-migration objects. Please note that a running fullnode instance is required for syncing the data.

Development

Docker Setup

1. Build the Docker Image

To build the Docker image (forcing a fresh build without using cached layers), run:

docker compose build --no-cache

2. Run the Docker Container

To start the container in detached mode, run:

docker compose up -d

3. Stop the Docker Container

To stop the running container and remove the associated resources, use:

docker compose down

Environment Configuration

The application uses a pre-existing .env file for configuration. You can modify it if needed.

Basic Configuration

  • OBJECTS_DB_URL: The SQLite database URL. Used to store Migrations Objects.
  • PROGRESS_STORE_DB_URL: The SQLite database URL. Used to store latest synced checkpoints.
  • REMOTE_STORE_URL: The fullnode REST API URL used to fetch checkpoint data and synchronize.
  • REST_API_SOCKET_ADDRESS: Address where the REST API will listen (e.g., 0.0.0.0:3000).
  • METRICS_SOCKET_ADDRESS: Address where the Prometheus metrics will be exposed (e.g., 0.0.0.0:3001).

Refined Configuration

  • LOG_LEVEL: Logging level (e.g., INFO, DEBUG).
  • DB_CONNECTION_TIMEOUT_SECS: Timeout (in seconds) for database connections.
  • DB_POOL_SIZE: Maximum database connection pool size.
  • DOWNLOAD_QUEUE_SIZE: Max queue size of checkpoints for the Indexer to process.
  • CHECKPOINT_PROCESSING_BATCH_DATA_LIMIT: Limit indexing parallelism on big checkpoints to avoid OOM, by limiting the total size of batch checkpoints to ~20MB.
  • RESET_DB: Indicates whether to reset the database on startup (true or false).
  • PACKAGE_ID: Instruct the Indexer to store Objects generated by these package IDs.

Notes

  • Any changes to the .env file will take effect the next time the container is built or restarted.
  • Keep the .env file secure, as it may contain sensitive information.

Manual Setup

  1. Install Diesel CLI
  2. Run diesel setup

Run the application

$ cargo run

Run the tests

$ cargo test

Swagger Documentation

Access the Swagger documentation at /swagger-ui.

Supported features

  • Index expiration unlock conditions for shared Nft and Basic outputs.
  • Set a custom package defining the stardust outputs, assuming that the type layout is the same as in [iota-framework][].
  • Expose a REST API to serve the indexed data.