Store and Retrieve Data with the SDKs
Store and retrieve your own public data, private data, and files using clients for a local daemon, a background service called antd. Use this arrangement to keep network access and upload payments outside your application process. For libraries that connect without that service, use the native SDK API reference; do not substitute native calls into these client examples.
These are independent recipes, not a sequence to run from top to bottom. Choose the operation you need and replace sample payloads, addresses, DataMaps, and absolute file paths with your own values. For a guided first upload with one retained address and byte-for-byte read-back, use Store Data on the Network.
Featured examples on this page use cURL, Python, Node.js / TypeScript, and Rust. The Language Bindings section lists API details and installation options for other languages.
Prerequisites
Your payload or an existing public address or private DataMap for a read.
For file operations, a source file and an existing destination directory on the machine running antd.
For paid writes, a low-value wallet with Autonomi Network Token (ANT) and ETH for transaction gas on the selected Arbitrum environment.
Set up once
1. Open your client project
Reuse the project from the read walkthrough or write walkthrough if you have one. Otherwise, follow Install your client: choose cURL, Python, Node.js / TypeScript, or the source-pinned Rust client. That setup includes the complete Cargo manifest and protoc requirement for Rust; antd-client is not installed from crates.io. Client installation does not install the antd executable.
Run your selected recipe as a complete program. Python recipes are complete app.py programs run with python app.py in the activated environment. TypeScript recipes are complete app.ts programs run with npx tsx app.ts. Rust recipes replace the example application's src/main.rs and run with cargo run. The cURL recipes are Bash scripts for macOS or Linux, not PowerShell; run each as bash recipe.sh.
2. Start the local service for your operation
Install and start antd using the OS-specific instructions in Start the Local Daemon. The clients here use http://localhost:8082. Reads need no wallet. For writes, stop a read-only instance and follow Start antd with a payment wallet, then inspect its configured wallet and balances with Prepare a Wallet for Uploads.
Use the built-in EVM_NETWORK=arbitrum-one or arbitrum-sepolia preset for the matching public environment. With antd 0.14.0, any individual override (EVM_RPC_URL, EVM_PAYMENT_TOKEN_ADDRESS, EVM_PAYMENT_VAULT_ADDRESS, or EVM_DATA_PAYMENTS_ADDRESS) selects custom payment encoding that mainnet storage nodes can reject after funds are spent. Remove all four; a custom RPC URL alone is not safe for public writes. Keep the unauthenticated service bound to loopback, not a public interface.
Assess your application's upload flow in the local-development setup before committing funds on the public Autonomi Network. That setup supplies its own local payment configuration; do not replace it with the public-network settings.
Check /health before writing. write_ready: false signals degraded connectivity; true is a best-effort peer-count signal, not a wallet check or a guarantee of storage. status: "ok" alone only confirms that the API responds.
The readiness fields require antd 0.12.1. The local-development setup uses antd 0.12.0, which omits them; a binding's default false or zero value is not a connectivity measurement.
3. Review cost and signing before a write
Use Estimate Costs and Handle Upload Payments for your actual payload or file before running an upload recipe. Estimates are sampled, gas is advisory, and /v1/data/cost excludes the additional public DataMap storage. An estimate is not a maximum charge. A failed write can still spend funds; inspect its error and transaction history before retrying.
For signing outside antd, follow Use External Signers for Upload Payments, not these direct-wallet recipes. That guide covers client limitations and payment reconciliation before retrying a failed finalization.
Recipes
Store public data
Replace Hello, Autonomi! with the bytes your application intends to publish. A successful result contains a public address; persist it before doing anything else, then use the public-read recipe to retrieve those bytes. The sample payload still uses a paid upload API, not a free-write bypass.
Before running: anyone with the address can read the payload. Do not upload secrets. This call spends ANT and gas and can automatically grant the payment vault an unlimited ANT allowance when the existing allowance is too low.
Use cURL 7.76+, base64, and tr in Bash:
Retrieve public data
Replace the address placeholder with your retained public address. This recipe reads existing data and makes no storage payment; it does not require the public-write recipe to run in the same session. The text output examples assume the original bytes are UTF-8; use a byte-oriented file write for binary content.
The REST response uses base64 in the data field. The Python, Node.js / TypeScript, and Rust SDKs decode it back into bytes.
Store private data
Private uploads return a serialized DataMap, the secret retrieval information for your data. Keep it in protected application storage: anyone with the DataMap can retrieve the content, and losing it can mean losing access. The private operation returns it to you rather than publishing it as a public address. The examples display it so you can retain it; do not run them in a recorded terminal or send their output to shared logs.
Before running: private storage is still paid. This call spends ANT and gas and can automatically grant the payment vault an unlimited ANT allowance when the existing allowance is too low. Keep both the original private payload and returned DataMap out of source control and shared logs.
Use cURL 7.76+, base64, and tr in Bash:
Expected response shape:
The Python and Rust SDKs surface the DataMap through DataPutResult.data_map; the Node.js / TypeScript SDK uses DataPutResult.dataMap.
Retrieve private data
Replace the placeholder with your retained DataMap in a protected local script, not a committed source file. This read does not spend funds. The examples display the recovered text; avoid shared logs and recorded terminals. For binary data, write bytes to a protected file rather than decoding as text.
Upload and download a file
These endpoints work on paths visible to the machine running antd. Replace both absolute paths with your source file and a new destination filename in an existing directory; do not choose a destination containing data you need to keep. Keep the source unchanged during this recipe. The comparison runs on the same machine as antd and checks the downloaded bytes against the original.
Before running: this recipe publishes the file, spends ANT and gas, and can automatically grant the payment vault an unlimited ANT allowance. Anyone with its public address can retrieve the file. Do not use a private document as the upload candidate.
Use cURL 7.76+, Python 3 for JSON parsing, and cmp in Bash:
Verify it worked
Public writes return a 64-character hexadecimal address. Private writes return a hex-encoded DataMap, not a public address. Neither result alone proves a complete round trip: retrieve and compare your original bytes, as demonstrated in the first-upload walkthrough. The file recipe performs that comparison and prints File round-trip verified only when it matches.
If a file download fails after upload, retain its printed address and retry only the download. Do not rerun the entire paid recipe to troubleshoot a read.
Common errors
400 Bad Request: Check base64 encoding, address length, and local path values.
402 Payment Required: Inspect the payment error, selected EVM preset, ANT balance, gas balance, and allowance before retrying. A failed storage attempt can already have spent funds.
503 Service Unavailable: antd does not have a wallet key for a direct write. Restart it with AUTONOMI_WALLET_KEY or let ant dev start provision a local environment.
404 Not Found during retrieval: No data was found for the address or DataMap. Confirm it, and check /health for connected peers: without them, a lookup can also report not found.
Next steps
Native SDK API reference for libraries without a local service
Use the CLI for shell commands
Build Directly in Rust for Rust access without a local service
Last updated