This repository provides a lightweight java implementation of the Rosetta API. It uses Yaci-Store as an indexer to fetch the data from a Cardano node.
This component consists of:
- a full Cardano node
- a Cardano Submit API
- an indexer which stores data in Postgres
- the Mesh (formerly Rosetta) API
This implementation follows the Rosetta API specification and is compatible with the Rosetta CLI. It contains some extensions to fit the needs of the Cardano blockchain. These changes are documented in the wiki.
Detailed explanation to all components can be found in the wiki pages of this repository. It includes explanations about the Architecture, how to build and run the components and explanations to environment variables.
Since Yaci-Store is a comparatively lightweight indexer, the system requirements are lower than for other chain indexers. The following are the recommended system requirements for running this component:
- 4CPU Cores
- 32GB RAM
- 1TB of storage (PRUNING_ENABLED=false) [default]
- 400GB of storage (PRUNING_ENABLED=true)
Better hardware will improve the performance of the indexer and the node, which will result in faster syncing times.
By default this Cardano-node will sync the entire chain from Genesis. This will take up to 48-72 hours (dependening on the system resources).
If your user is not in the docker
group you might have to execute these commands with sudo
.
The default config is focused on mainnet. If you want to test this on other Cardano netwoks (like preview
or preprod
) please adjust the docker/.env.dockerfile
or read the Wiki page on Environment variables on other options and their default values.
git clone https://github.com/cardano-foundation/cardano-rosetta-java
cd cardano-rosetta-java
docker build -t rosetta-java -f ./docker/Dockerfile .
docker run --name rosetta -v {CUSTOM_MOUNT_PATH}:/node --env-file ./docker/.env.dockerfile -p 8082:8082 -d rosetta-java
Detailed explanation can be found in the Wiki.
Depending on using a snapshot feature or not, this will take X amount of time. You can follow along with the commands below. Your instance is ready when you see: DONE
.
If you want to run rosetta-java in offline mode you need to set the API_SPRING_PROFILES_ACTIVE
environment variable to offline
in ./docker/.env.dockerfile
.
This will disable the syncing of the node and won't start the db and the indexer.
Default is online
.
Useful commands:
- Following Docker container logs:
docker logs rosetta -f
- Access node logs:
docker exec rosetta tail -f /logs/node.log
- Access indexer logs:
docker exec rosetta tail -f /logs/indexer.log
- Interactive access to container:
docker exec -it rosetta bash # direct bash access within the container
# Useful commands within the container
cardano-cli query tip --mainnet # check node sync status
tail -f /logs/node.log # follow node logs
tail -f /logs/indexer.log # follow indexer logs
For every Release we provide pre-built docker images stored in the DockerHub Repositories of the Cardano Foundation (DockerHub) To start it use the following command:
docker run --name rosetta -v {CUSTOM_MOUNT_PATH}:/node --env-file ./docker/.env.dockerfile -p 8082:8082 -d cardanofoundation/cardano-rosetta-java:1.0-rc4
Changes to the configuration can be made by adjusting the docker/.env.dockerfile
file. For more information on the environment variables, please refer to the Wiki.
If you want to use the cardano-submit-api
you can additionally expose port 8090
. It can then be used to submit raw cbor transaction (API documentation here: Link)
docker run --name rosetta -v {CUSTOM_MOUNT_PATH}:/node --env-file ./docker/.env.dockerfile -p 8090:8090 -p 8082:8082 -d cardanofoundation/cardano-rosetta-java:1.0.1
If needed we also provide all components needed to run Rosetta in a docker-compose file. This will start:
- Cardano-node
- Cardano-Submit-API
- Yaci-Store
- Rosetta-API
- Postgres
docker-compose --env-file .env.docker-compose -f docker-compose.yaml up -d
Adjustments can be made by changing .env.docker-compose
file. For more information on the environment variables, please refer to the Wiki.
Thanks for visiting us and enjoy ❤️!