Store and Retrieve Data with the SDKs
In this guide, you use antd, the local daemon used by the SDKs, to store public data, private data, and files through language SDKs.
If you want direct shell access instead, see Use the CLI. If you want direct programmatic Rust access without the daemon, see Build Directly in Rust.
Featured examples on this page use cURL, Python, Node.js / TypeScript, and Rust. Other SDK languages are available in the Language Bindings section.
Prerequisites
antdrunning onhttp://localhost:8082(see Start the Local Daemon)For the write examples on this page, a write-enabled daemon. On the default network, restart
antdwith wallet configuration first. On a local devnet,ant dev startprovisions that for you. See Prepare a Wallet for Uploads for the default-network setup.Optional: the runtime or toolchain for the SDK examples you want to run, such as Python, Node.js, or Rust
The read examples work with any running daemon if you already have an address or DataMap. The write examples on this page require the write-enabled setup above.
Steps
1. Store public data
DATA_B64=$(printf 'Hello, Autonomi!' | base64)
curl -X POST http://localhost:8082/v1/data/public \
-H "Content-Type: application/json" \
-d "{\"data\":\"$DATA_B64\"}"from antd import AntdClient
client = AntdClient()
result = client.data_put_public(b"Hello, Autonomi!")
print(result.address)import { createClient } from "antd";
async function main() {
const client = createClient();
const result = await client.dataPutPublic(Buffer.from("Hello, Autonomi!"));
console.log(result.address);
}
main().catch((error) => {
console.error(error);
process.exit(1);
});2. Retrieve public data
The REST response uses base64 in the data field. The Python, Node.js / TypeScript, and Rust SDKs decode it back into bytes.
3. Store private data
Private uploads return a serialized DataMap. The DataMap is not stored on-network; keep it to retrieve the data later.
Expected response shape:
The Python and Rust SDKs surface the DataMap through DataPutResult.data_map; the Node.js / TypeScript SDK uses DataPutResult.dataMap.
4. Retrieve private data
5. Upload and download a file
These endpoints work on paths visible to the machine running antd.
Verify it worked
For raw data, compare the retrieved bytes to the original payload. For files, compare the downloaded output on disk with the original local source before you uploaded it.
Common errors
400 Bad Request: Check base64 encoding, address length, and local path values.
402 Payment Required: Fund the configured wallet or switch to a local devnet with test funds.
503 Service Unavailable: The daemon does not have wallet configuration. Restart it with AUTONOMI_WALLET_KEY or let ant dev start provision a local environment.
Next steps
Last updated