Skip to content

adabox-aio/ogmios-java-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build CodeQL Coverage Maven Sponsors

ogmios

What is Ogmios?

Ogmios Java Client Library is based on Ogmios JSON/RPC lightweight bridge interface for Cardano Node by Matthias Benkort.
It offers a WebSocket API that enables local clients to speak Ouroboros' mini-protocols 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. ✔️
chainTip The chain's current tip. ✔️
currentEpoch The current epoch of the ledger. ✔️
currentProtocolParameters The current protocol parameters. ✔️
delegationsAndRewards Current delegation settings and rewards of given reward accounts. ✔️
eraStart The information regarding the beginning of the current era. ✔️
eraSummaries Era bounds and slotting parameters details, required for proper slot arithmetic. ✔️
genesisConfig Get a compact version of the era's genesis configuration. ✔️
ledgerTip The most recent block tip known of the ledger. ✔️
nonMyopicMemberRewards Non-myopic member rewards for each pool. Used in ranking. ✔️
poolIds The list of all pool identifiers currently registered and active. ✔️
poolParameters Stake pool parameters submitted with registration certificates. ✔️
poolsRanking Retrieve stake pools ranking (a.k.a desirability). ✔️
proposedProtocolParameters The last update proposal w.r.t. protocol parameters, if any. ✔️
rewardsProvenance Get details about rewards calculation for the ongoing epoch. ✔️
stakeDistribution Distribution of the stake across all known stake pools. ✔️
systemStart The chain's start time (UTC). ✔️
utxo Current UTXO, possibly filtered by output reference. ✔️

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:

<dependency>
    <groupId>io.adabox</groupId>
    <artifactId>ogmios-java-client</artifactId>
    <version>1.0.0</version>
</dependency>

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.

Network URL
Mainnet wss://ogmios-api.mainnet.dandelion.link/
Testnet wss://ogmios-api.testnet.dandelion.link/

Initialize Secured Ogmios Websocket Client

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

CurrentProtocolParameters currentProtocolParameters = ogmiosWSClient.currentProtocolParameters();
log.info(currentProtocolParameters.toString());

Clone & Build with Maven

git clone https://github.com/adabox-aio/ogmios-java-client.git
cd ogmios-java-client
mvn clean install

💖 Sponsors

KtorZ


📐 Contributing | 💝 Sponsors | Twitter Twitter (@AdaBoxIO)

License