Getting Started with Yaci Store 2.x.x
Current Version: 2.0.0-beta3
This is the latest beta release of Yaci Store with ledger-state support. Yaci Store can now calculate and derive ledger stateβsuch as rewards, ADAPot, and governance stateβfrom on-chain data.
Unlike DB Sync, which receives ledger events directly from a local Cardano Node (both implemented in Haskell), Yaci Store independently computes all required ledger state from the on-chain data itself.
Status of Ledger State Data Accuracy
Ledger State calculations include:
- Epoch Stake and Rewards
- ADAPot values
- Governance State (dRep distribution, Proposal Status, dRep Status)
Reward Calculation and ADAPot Status
ADAPot values are matching for all 3 public networks up to the recent epochs:
- Mainnet: Up to epoch 569 (recent epoch when this document was written)
- Preprod: Up to epoch 227 (recent epoch when this document was written)
- Preview: Up to epoch 989 (recent epoch when this document was written)
We will update this section with any discrepancies for future mismatches.
Governance State Data
Governance action proposal statuses are correctly calculated up to recent epochs and are matching. However, there are some known mismatches in dRep distribution and dRep active_until
values. For a detailed breakdown and the latest mismatch reports, see the 2.0.0-beta3 mismatch summary. We will be working on fixing these in future releases.
Beta Release Status
Except for governance state and reward data, all other stores are production-ready and can be used in production environments.
While governance state data calculation has some mismatches, and even though reward/epoch stake data are all correct, we are keeping the beta label for now. There will be a few more beta releases while we fix all issues in the ledger state. Meanwhile, you can use other stores (UTXO, block, metadata, etc.) in production.
Out-of-the-Box Applications
1. Yaci Store App
- The default indexer application, includes all modules.
- Ledger-state calculation is disabled by default but can be enabled via profile.
3. Yaci Store Admin CLI App
- CLI tool to apply optional indexes after sync is complete.
- Optional indexes improve API query performance and are not applied during initial sync.
Types of Distribution
Yaci Store provides three types of distributions:
- Yaci Store Docker Distribution
- Yaci Store Zip Distribution (JARs)
- Yaci Store Native (GraalVM) Distribution (Preview)
1. Yaci Store Docker Distribution
This distribution provides scripts to help you easily run Yaci Store, perform administrative tasks, and monitor the system using Prometheus and Grafana.
The Docker distribution includes:
- PostgreSQL
- Yaci Store app
- Ledger State app
- Admin CLI tools
- Monitoring stack (Prometheus + Grafana)
π¦ Contents
Key files and directories included:
.
βββ yaci-store.sh # Start/stop Yaci Store application
βββ admin-cli.sh # Admin operations (apply-indexes, rollback, etc.)
βββ monitoring.sh # Start/stop Prometheus + Grafana monitoring stack
βββ compose/
β βββ .env # Environment file (contains Docker image tag)
β βββ yaci-store-monolith.yml # Compose file for Yaci Store and PostgreSQL
β βββ admin-cli-compose.yml # Compose file for admin CLI container
β βββ monitoring.yml # Compose file for monitoring stack
β βββ ...
βββ config/ # Yaci Store configuration files mounted inside the container
β βββ env # Environment file (e.g., to enable ledger-state profile)
β βββ application.properties
β βββ application-ledger-state.properties
β βββ application-plugins.yml
βββ plugin-scripts/ # Folder for custom plugin scripts (mounted inside the container)
βββ grafana/ # Grafana configuration and dashboards
βββ prometheus/ # Prometheus configuration
π§ Edit Configuration
Before starting Yaci Store, update the Cardano node connection details.
Edit the following values in config/application.properties
:
store.cardano.host=preprod-node.world.dev.cardano.org
store.cardano.port=30000
store.cardano.protocol-magic=1
π Running Yaci Store
Use yaci-store.sh
to start, stop, or view logs of the Yaci Store application.
β Start
./yaci-store.sh start
This starts Yaci Store and PostgreSQL in the background.
- π Yaci Store API runs on http://localhost:8080 (opens in a new tab)
- π API docs (Swagger UI): http://localhost:8080/swagger-ui/index.html (opens in a new tab)
π Stop both Yaci Store and PostgreSQL
./yaci-store.sh stop
π Stop only Yaci Store (PostgreSQL stays running)
./yaci-store.sh stop:yaci-store
π View logs
./yaci-store.sh logs # Logs from all containers
./yaci-store.sh logs:yaci-store # Only Yaci Store logs
./yaci-store.sh logs:db # Only PostgreSQL logs
βοΈ Enable Ledger-State Profile
To run Yaci Store with the ledger-state
profile:
- Open the
env
file under theconfig/
folder. - Uncomment or add the following line:
SPRING_PROFILES_ACTIVE=ledger-state
- Start the application:
./yaci-store.sh start
If ledger state is enabled, verify the log message to ensure that ledger-state calculation is active
While running Yaci Store with ledger-state calculation enabled, you may see logs similar to the example below, indicating that address balance calculation is active β which is required for ledger-state calculation.
# of blocks written: 100, Time taken: 25 ms
Block No: 4746 , Era: Shelley
### Starting account balance calculation upto block: 4846 ###
Total Stake Address Balance records 0, Time taken to save: 0
Time taken to delete stake address balance history: 0
### Total balance processing and saving time 1 ###
# of blocks written: 100, Time taken: 28 ms
Block No: 4846 , Era: Shelley
### Starting account balance calculation upto block: 4946 ###
Total Stake Address Balance records 0, Time taken to save: 0
Time taken to delete stake address balance history: 0
### Total balance processing and saving time 1 ###
π οΈ Admin Operations
Use admin-cli.sh
to run administrative tasks like applying indexes or rolling back to a specific epoch.
βΆοΈ Apply Indexes
./admin-cli.sh apply-indexes
β οΈ This applies database indexes required for optimal read performance from API endpoints.
π Important: Only run this after the full sync is complete. Applying indexes early can significantly slow down the sync process.
π Rollback
./admin-cli.sh rollback-data --epoch <epoch_no>
β οΈ Important: Before performing rollback, you must stop Yaci Store but keep PostgreSQL running. Use the following command to stop only Yaci Store:
./yaci-store.sh stop:yaci-store
In interactive mode, you'll be prompted to confirm the rollback operation.
π Monitoring (Prometheus + Grafana)
Use monitoring.sh
to start or stop the monitoring stack.
β Start monitoring services
./monitoring.sh start
- π Prometheus: http://localhost:9090 (opens in a new tab)
- π Grafana: http://localhost:3000 (opens in a new tab)
Default login:
admin / changeme
π Stop monitoring services
./monitoring.sh stop
π Accessing PostgreSQL
To connect to the PostgreSQL database running in Docker, you can use the included psql.sh
script:
./psql.sh
This script opens an interactive psql
session inside the running PostgreSQL container.
π‘ Make sure the Yaci Store stack is already running (
./yaci-store.sh start
) before using this script.
2. Yaci Store Zip Distribution (JARs)
Filename: yaci-store-<version>.zip
Includes:
yaci-store.jar
yaci-store-ledger-state.jar
- Config files (
application.properties
)
Pre-requisites
- Java 21 or Java 24 (Recommended)
You can use sdkman (opens in a new tab) to install Java 21 or 24.
sdk install java 24.0.1-tem
sdk use java 24.0.1-tem
Check if JAVA_HOME env variable is set correctly:
echo $JAVA_HOME
Edit Config
- Edit
application.properties
to set the Cardano network and Database connection settings - Check the following properties and update them accordingly
store.cardano.host=preview-node.world.dev.cardano.org
store.cardano.port=30002
store.cardano.protocol-magic=2
spring.datasource.url=jdbc:postgresql://localhost:5432/yaci_indexer?currentSchema=preview
spring.datasource.username=user
spring.datasource.password=password
Usage
-
To run Yaci Store (without ledger-state):
./bin/start.sh
-
To enable ledger-state calculation with all other on-chain data:
./bin/start.sh ledger-state
If ledger state is enabled, verify the log message to ensure that ledger-state calculation is active
While running Yaci Store with ledger-state calculation enabled, you may see logs similar to the example below, indicating that address balance calculation is active β which is required for ledger-state calculation.
# of blocks written: 100, Time taken: 25 ms
Block No: 4746 , Era: Shelley
### Starting account balance calculation upto block: 4846 ###
Total Stake Address Balance records 0, Time taken to save: 0
Time taken to delete stake address balance history: 0
### Total balance processing and saving time 1 ###
# of blocks written: 100, Time taken: 28 ms
Block No: 4846 , Era: Shelley
### Starting account balance calculation upto block: 4946 ###
Total Stake Address Balance records 0, Time taken to save: 0
Time taken to delete stake address balance history: 0
### Total balance processing and saving time 1 ###
2.1 Apply Optional Indexes
After the initial sync is complete:
./bin/yaci-cli.sh
This launches the Admin CLI (yaci-store-admin-cli.jar
). At the CLI prompt:
yaci-store> apply-indexes
3. Yaci Store Native (GraalVM) Distribution (Preview)
Native binaries are available under a separate release tag:
<version>-native
(e.g., 2.0.0-beta3-native
)
Download Format
Look for platform-specific ZIP files in this format:
yaci-store-<version>-<os>-<arch>-all.zip
Example:
yaci-store-2.0.0-beta3-linux-x64-all.zip
β οΈ Only use the ZIP files ending with
-all
. Ignore files ending withn2c
.
Setup
-
Extract the ZIP.
-
Edit
config/application.properties
to configure:- Cardano network info (host/port/protocol magic)
- PostgreSQL connection settings
-
Run the app:
./yaci-store
- Run with ledger-state profile:
SPRING_PROFILES_ACTIVE=ledger-state ./yaci-store
Known Issues or Limitations
- Performance of Reward Calculation on Mainnet
- Ledger-state calculations currently happen during epoch transition. That means rewards paid in epoch X are calculated during the transition from epoch X-1 to X.
- On Mainnet, this takes around 20β40 minutes per transition (depends on your PostgreSQL resources).
- In a future release, we plan to start reward calculation in epoch X-1 after the stability window, similar to how the Haskell node works. This will reduce the computation load during epoch boundaries.
Note:
If you are running ledger-state calculation for mainnet, you may also need to tune your PostgreSQL configuration though the default config will work but will take longer. In the next beta release we will provide the postgres configuration for mainnet sync.