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

Zig

Use the Zig SDK to store and retrieve data through a local daemon, a background service called antd. The client uses REST.

Install

Use Zig 0.14 and reference the exact ant-sdk v0.12.1 release source as a local dependency. This workflow does not use a registry package.

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

Place your Zig project beside ant-sdk and use this build.zig.zon dependency:

.{
    .name = .autonomi_example,
    .version = "0.0.0",
    .minimum_zig_version = "0.14.0",
    .paths = .{ "build.zig", "build.zig.zon", "src" },
    .dependencies = .{
        .antd = .{
            .path = "../ant-sdk/antd-zig",
        },
    },
}

Import the dependency in your build.zig:

Connect to antd

Follow Start the Local Daemon to run antd before connecting.

Expected output:

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
Zig type

HealthStatus

Zig struct

PutResult

Zig struct

Raw data

[]const u8

Error handling

antd 0.14.0 reports a valid address with no stored data as not found. Handle error.NotFound 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