Kotlin based indexer as used by: https://realfi.info. Provides historical and latest prices for all Cardano Native Tokens (CNT). Uses;
- Bloxbean Yaci JVM based Cardano mini-protocols library
- Blockbean YaciStore general purpose indexer, only for txOutput resolution (modular option)
- dcSpark Carp general purpose indexer, only for txOutput resolution (modular option)
- Koios Koios Cardano data API, only for txOutput resolution (modular option)
- Blockfrost Blockfrost Cardano data API, only for txOutput resolution (modular option)
- Cardano Foundation Token Registry for CNT metadata (modular, can be swapped)
- Trades obtained from on-chain Cardano DEX data including Minswap V1/V2, Sundaeswap V1 and Wingriders (modular can be extended)
- Koin dependency injection
## Make webserver log directory
sudo mkdir /var/log/spring
sudo chown -R <your-user>:<your-user> /var/log/spring
## Make indexer log directory
mkdir /var/log/prise/
sudo chown -R <your-user>:<your-user> /var/log/prise
## Build the db schema
cd webserver
## Edit src/main/resources/application.properties (or add application-default.properties); particularly spring.datasource.username & password
mvn clean install -DskipTests
mvn spring-boot:run
## If you dont need the webserver, shut it down
cd indexer
cp prise.example.properties prise.properties
cp prise.example.properties src/test/resources/prise.properties
## Edit properties as needed; particularly database (x2) url + login, cardano-node (cnode) url and API keys for any data API used
cd indexer
mvn clean install -DskipTests
mvn exec:exec -Dconfig=prise.properties
run.mode=livesync|oneshot
latest.prices.livesync.update.interval.seconds=
make.historical.data=true|false
start.metrics.server=true|false
metrics.server.port=
app.datasource.driver-class-name=
app.datasource.url=
app.datasource.username=
app.datasource.password=
token.metadata.service.module=tokenRegistry
chain.database.service.module=koios|carpJDBC
cnode.address=
cnode.port=
start.point.time=
*see prise.example.properties for more detailed descriptions
# selects specific logback config logack-$logEnv.xml
logEnv=prod|dev
Component | Description |
---|---|
indexer | Core component which listens to blockchain, parses trade data, computes and persists latest and historical prices |
webserver | Optional; simple Spring Boot webserver with latest price and historical price endpoints |
Dependency | Description |
---|---|
Cardano-node | Access to a fully synced Cardano node instance, for best performance in terms of stability and sync speed, use a dedicated node on a local network. Tested with cardano-node v8.9.2 |
Carp (Only if using Carp module) | Access to a fully synced Carp database. Carp is a general purpose modular Cardano indexer using Posgresql. This is required primarily to resolve utxo references. Other alternatives will work also however will require custom implementation of the ChainDatabaseService interface |
Yaci Store (Only if using Yaci Store module) | Access to a fully synced Yaci Store database. Yaci Store is a general purpose modular Cardano indexer using Posgresql or MySQL. This is required primarily to resolve utxo references. Other alternatives will work also however will require custom implementation of the ChainDatabaseService interface |
Module | Description | Implementations |
---|---|---|
ChainDatabaseService | Implementations provide an ability to resolve transaction output references (e.g. txHash#index) and searching for the nearest block to a given slot/time | |
TokenMetadataService | Implementations provide the ability to resolve token decimals specifications for Cardano Native Tokens | The tokens.cardano.org service Other implementations can be added as required |
Tested with Java 11
* Have noticed at least one issue using Java 20
due to an issue with the KoinTest Mocking framework
(Unsupported class file major version 64)
Official Linux Installation Guide
Official macOS Installation Guide
Login as mysql root user
mysql> CREATE DATABASE prise;
mysql> CREATE USER 'prise'@'localhost' IDENTIFIED BY '<password>';
mysql> GRANT ALL PRIVILEGES ON prise.* TO 'prise'@'localhost' WITH GRANT OPTION;
mysql> flush privileges;
* Make sure Operating System is using a timezone without daylight savings. Otherwise will see odd weekly candles misaligned
e.g. timedatectl set-timezone Asia/Kuala_Lumpur
Contributions welcome
This project is made possible by Delegators to the AUSST Cardano Stakepool and supporters of Edgx R&D