Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/adabox-aio/ogmios-java-client

Ogmios Java Client Library
https://github.com/adabox-aio/ogmios-java-client

cardano cardano-community java rpc websocket

Last synced: 3 days ago
JSON representation

Ogmios Java Client Library

Awesome Lists containing this project

README

        


Build


CodeQL


Coverage


Maven


Sponsors





ogmios

## What is Ogmios?
**Ogmios** Java Client Library is based on [Ogmios](https://github.com/CardanoSolutions/ogmios) JSON/RPC lightweight bridge interface for [Cardano Node](https://github.com/input-output-hk/cardano-node/) by [Matthias Benkort](https://github.com/KtorZ).

It offers a **WebSocket API** that enables local clients to speak [Ouroboros' mini-protocols](https://hydra.iohk.io/build/1070091/download/1/network.pdf#chapter.3) via **JSON/RPC**.

## Overview
**Ogmios Java Client** is a Java library that can be used to convert Java Objects into their **Ogmios** Requests **JSON/RPC** representation. It can also be used to convert **Ogmios JSON/RPC** Responses to their equivalent Java objects.

The Java library allows synchronous communication with **Ogmios** Server by interacting with a Websocket client connection using a timeout parameter.

## Features
- Synchronous messaging using Java objects
- Transaction submission with enhanced error messages
- Transaction Evaluation
- Structured Java Objects logging
- Full ledger state query support:

| Query | Result | Supported |
|------------------------------|----------------------------------------------------------------------------------|:------------------:|
| `blockHeight` | The chain's highest block number. | :heavy_check_mark: |
| `chainTip` | The chain's current tip. | :heavy_check_mark: |
| `currentEpoch` | The current epoch of the ledger. | :heavy_check_mark: |
| `currentProtocolParameters` | The current protocol parameters. | :heavy_check_mark: |
| `delegationsAndRewards` | Current delegation settings and rewards of given reward accounts. | :heavy_check_mark: |
| `eraStart` | The information regarding the beginning of the current era. | :heavy_check_mark: |
| `eraSummaries` | Era bounds and slotting parameters details, required for proper slot arithmetic. | :heavy_check_mark: |
| `genesisConfig` | Get a compact version of the era's genesis configuration. | :heavy_check_mark: |
| `ledgerTip` | The most recent block tip known of the ledger. | :heavy_check_mark: |
| `nonMyopicMemberRewards` | Non-myopic member rewards for each pool. Used in ranking. | :heavy_check_mark: |
| `poolIds` | The list of all pool identifiers currently registered and active. | :heavy_check_mark: |
| `poolParameters` | Stake pool parameters submitted with registration certificates. | :heavy_check_mark: |
| `poolsRanking` | Retrieve stake pools ranking (a.k.a desirability). | :heavy_check_mark: |
| `proposedProtocolParameters` | The last update proposal w.r.t. protocol parameters, if any. | :heavy_check_mark: |
| `rewardsProvenance` | Get details about rewards calculation for the ongoing epoch. | :heavy_check_mark: |
| `stakeDistribution` | Distribution of the stake across all known stake pools. | :heavy_check_mark: |
| `systemStart` | The chain's start time (UTC). | :heavy_check_mark: |
| `utxo` | Current UTXO, possibly filtered by output reference. | :heavy_check_mark: |

## Getting Started

### Dependency management tool

Below is a brief guide to using dependency management tools like maven or gradle.

#### Maven
To use maven add this dependency to your pom.xml:
```xml

io.adabox
ogmios-java-client
1.0.0

```

#### Gradle
To use Gradle add the maven central repository to your repositories list:
```
mavenCentral()
```
Then you can just add the latest version to your build.
```
compile "io.adabox:ogmios-java-client:1.0.0"
```
Or this option if you use gradle 7.0 and above.
```
implementation io.github.adabox-aio:ogmios-java-client:1.0.0'
```

### Hosted Dandelion's instances, by [Gimbalabs](https://gimbalabs.com/).
| Network | URL |
|---------|--------------------------------------------|
| Mainnet | `wss://ogmios-api.mainnet.dandelion.link/` |
| Testnet | `wss://ogmios-api.testnet.dandelion.link/` |

### Initialize Secured Ogmios Websocket Client
```java
ogmiosWSClient = new OgmiosWSClient(new URI("wss://ogmios-api.testnet.dandelion.link/"));
ogmiosWSClient.setSocketFactory(SSLSocketFactory.getDefault());
ogmiosWSClient.connectBlocking(60, TimeUnit.SECONDS);
```

### Basic Current Protocol Parameters Query Example
```java
CurrentProtocolParameters currentProtocolParameters = ogmiosWSClient.currentProtocolParameters();
log.info(currentProtocolParameters.toString());
```

## Clone & Build with Maven
```shell
git clone https://github.com/adabox-aio/ogmios-java-client.git
cd ogmios-java-client
mvn clean install
```

## 💖 Sponsors


KtorZ




:triangular_ruler: Contributing
|
:gift_heart: Sponsors
|
Twitter Twitter (@AdaBoxIO)

[![License](https://img.shields.io:/github/license/adabox-aio/ogmios-java-client?style=for-the-badge&color=blue&label=License)](https://opensource.org/licenses/Apache-2.0)