Skip to content

Commit

Permalink
fix: RA-37 rewrite readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shleger committed May 6, 2024
1 parent 5b63359 commit a2c81d2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 62 deletions.
70 changes: 8 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cardano-foundation_cardano-rosetta-java&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=cardano-foundation_cardano-rosetta-java)

# Cardano Rosetta API Java implementation
This repository provides a lightweight java implementation of the Rosetta API. It uses [Yaci-Store](https://github.com/bloxbean/yaci-store) as an indexer
to fetch the data from the node.
## What the project is about?

This repository provides a lightweight java implementation of the [Rosetta API](https://github.com/coinbase/mesh-specifications). It uses [Yaci-Store](https://github.com/bloxbean/yaci-store) as an indexer
to fetch the data from a Cardano node.

## :construction: Current Development status :construction:
- [x] Architecture clean up for yaci-store
Expand All @@ -18,68 +19,13 @@ to fetch the data from the node.
- [ ] /mempool/transaction
- [x] Construction API
- [ ] Extending Tests
- [ ] Comparison with [Rosetta-Ts](https://github.com/cardano-foundation/cardano-rosetta)
- [ ] Rosetta-cli test
- [ ] Refactoring

## Getting Started

### Prerequisites

- Docker
- Docker Compose
- Java 21
- For integration tests: Node 14+

### How to build

- Clone the repository
- For local environment:
- Copy `.env.docker-compose` to `.env`
- Fill the `.env` file with your values (explain below) or use the provided for docker-compose setup
- Start SpringBoot application with `mvn spring-boot:run` within submodule `api` or `yaci-indexer`
- Run `docker compose -f docker-compose.yaml up --build` to start rosetta api service including yaci-store and a cardano node
- Using the provided env file `docker-compose --env-file .env.docker-compose -f docker-compose.yaml up --build`
* Note: the first time you run the command, it will take a little bit of your time to build the cardano-node, and next time it will be cached when run. So please be patient.

### How to run integration tests

- Run `docker compose --env-file .env.IntegrationTest -f docker-integration-test-environment.yaml up --build -d --wait`
- Using CLI
- Install newman `npm install -g newman` (Node version 14+ needed)
- Run `newman run ./postmanTests/rosetta-java.postman_collection.json -e ./postmanTests/Rosetta-java-env.postman_environment.json -r cli`
- Using Postman
- Install [Postman](https://www.postman.com)
- Import the collection `./postmanTests/rosetta-java.postman_collection.json`
- Import the environment `./postmanTests/Rosetta-java-env.postman_environment.json`
- Run the collection

## Documentation

### Restore a snapshot
**TBD for yaci-store**

A node snapshot can be downloaded from [here](https://csnapshots.io/). Download the snapshot and place the files within the `CARDANO_NODE_DB` Path.

For mainnet the following command can be used to restore the snapshot:
```bash
curl -o - https://downloads.csnapshots.io/mainnet/$(curl -s https://downloads.csnapshots.io/mainnet/mainnet-db-snapshot.json| jq -r .[].file_name ) | lz4 -c -d - | tar -x -C ${CARDANO_NODE_DB}
```

### Mempool Monitoring
Mempool monitoring can be activated when adding the spring profile `mempool` to the rosetta api service.
It will be turned off by default. Since it is only working for nodes, which participate in the network and available within P2P from other nodes.
So the Node itself needs extra configuration to be able to query mempool transactions.

### Documentation
- [Architecture Overview](https://github.com/cardano-foundation/cardano-rosetta-java/wiki)
- [Cardano specific API Additions](./docs/cardano-specific-api-additions.md)
- [Dev H2 Quickstart Guide](./docs/dev-h2-quick-start-guide.md)
- [Environment Variables](./docs/environment-variables.md)

## Contributing

File an issue or a PR or reach out directly to us if you want to contribute.

When contributing to this project and interacting with others, please follow our [Contributing Guidelines](./CONTRIBUTING.md) and [Code of Conduct](./CODE-OF-CONDUCT.md).
Please refer to our [wiki page](https://github.com/cardano-foundation/cardano-rosetta-java/wiki) for more information on the project.

---

Thanks for visiting and enjoy :heart:!
32 changes: 32 additions & 0 deletions docs/docker-getting-started-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Getting Started with Docker

### Prerequisites

- Docker
- Docker Compose
- Java 21
- For integration tests: Node 14+

### How to build

- Clone the repository
- For local environment:
- Copy `.env.docker-compose` to `.env`
- Fill the `.env` file with your values (explain below) or use the provided for docker-compose setup
- Start SpringBoot application with `mvn spring-boot:run` within submodule `api` or `yaci-indexer`
- Run `docker compose -f docker-compose.yaml up --build` to start rosetta api service including yaci-store and a cardano node
- Using the provided env file `docker-compose --env-file .env.docker-compose -f docker-compose.yaml up --build`
* Note: the first time you run the command, it will take a little bit of your time to build the cardano-node, and next time it will be cached when run. So please be patient.

### How to run integration tests

- Run `docker compose --env-file .env.IntegrationTest -f docker-integration-test-environment.yaml up --build -d --wait`
- Using CLI
- Install newman `npm install -g newman` (Node version 14+ needed)
- Run `newman run ./postmanTests/rosetta-java.postman_collection.json -e ./postmanTests/Rosetta-java-env.postman_environment.json -r cli`
- Using Postman
- Install [Postman](https://www.postman.com)
- Import the collection `./postmanTests/rosetta-java.postman_collection.json`
- Import the environment `./postmanTests/Rosetta-java-env.postman_environment.json`
- Run the collection

25 changes: 25 additions & 0 deletions docs/mempool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
- [Architecture Overview](https://github.com/cardano-foundation/cardano-rosetta-java/wiki)
- [Cardano specific API Additions](./docs/cardano-specific-api-additions.md)
- User guides
- TODO
- Development Guides
- [Getting Started with H2](./docs/dev-h2-quick-start-guide.md)
- [Getting Started with Docker](./docs/docker-getting-started-guide)
- [Environment Variables](./docs/environment-variables.md)
- [Contributing Guidelines](./CONTRIBUTING.md)


### Restore a snapshot
**TBD for yaci-store**

A node snapshot can be downloaded from [here](https://csnapshots.io/). Download the snapshot and place the files within the `CARDANO_NODE_DB` Path.

For mainnet the following command can be used to restore the snapshot:
```bash
curl -o - https://downloads.csnapshots.io/mainnet/$(curl -s https://downloads.csnapshots.io/mainnet/mainnet-db-snapshot.json| jq -r .[].file_name ) | lz4 -c -d - | tar -x -C ${CARDANO_NODE_DB}
```

### Mempool Monitoring
Mempool monitoring can be activated when adding the spring profile `mempool` to the rosetta api service.
It will be turned off by default. Since it is only working for nodes, which participate in the network and available within P2P from other nodes.
So the Node itself needs extra configuration to be able to query mempool transactions.

0 comments on commit a2c81d2

Please sign in to comment.