For the complete documentation index, see llms.txt. This page is also available as Markdown.

Java

Use the Java SDK to store and retrieve data through a local daemon, a background service called antd. The client uses REST by default, with asynchronous and gRPC clients also available.

Install

The Java binding is not published to Maven Central for ant-sdk v0.12.1. Use JDK 17 or later and publish the exact release source to your local Maven repository.

git clone --branch v0.12.1 --depth 1 https://github.com/WithAutonomi/ant-sdk.git
test "$(git -C ant-sdk rev-parse HEAD)" = "f9cd5c5fc08133847909e47e04af186593ccbaee"
cd ant-sdk/antd-java
./gradlew publishToMavenLocal

Add mavenLocal() to your application's repositories and add the locally built artifact:

plugins {
    application
}

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    implementation("com.autonomi:antd-java:0.1.0")
}

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
    }
}

application {
    mainClass.set("Connect")
}

The artifact version is 0.1.0 inside the ant-sdk v0.12.1 release source. The command above publishes only to your local Maven repository.

Connect to antd

Follow Start the Local Daemon to run antd before connecting.

Expected output:

The SDK also provides AsyncAntdClient and GrpcAntdClient.

Store and retrieve data

Start antd in a write-enabled mode before you upload. The public Autonomi Network requires wallet and Ethereum Virtual Machine (EVM) payment configuration. A local development network created with ant dev start includes that configuration.

Expected output:

Type mappings

Autonomi type
Java type

HealthStatus

com.autonomi.antd.models.HealthStatus

PutResult

com.autonomi.antd.models.PutResult

Raw data

byte[]

Error handling

antd 0.14.0 reports a valid address with no stored data as not found. Handle NotFoundException for this case. The client source is pinned independently to v0.12.1.

Output when the valid address is not stored:

Full API reference

For all available antd endpoints, see the REST API.

Last updated