Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/cli/command-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- verification:
source_repo: ant-client
source_ref: main
source_commit: 84332e2d752499df5402da797e5d8bba547bc58b
verified_date: 2026-06-10
source_commit: 4d0448458ec302af68a5504c533d105b0991c93c
verified_date: 2026-06-19
verification_mode: current-merged-truth
-->

Expand Down Expand Up @@ -110,6 +110,7 @@ Downloads a public file by address or a private file using a local DataMap file.
| `ADDRESS` | string | Conditionally | Public DataMap address. Required unless `--datamap` is provided. |
| `--datamap <PATH>` | path | No | Local `.datamap` file for private download |
| `-o, --output <PATH>` | path | Conditionally | Required for address-based downloads. Optional for `--datamap` downloads that can infer the original filename. |
| `--peers <COUNT>` | integer | No | Number of closest peers to try for each chunk fetch. Accepts a positive integer. `--peer-count` is accepted as an alias. |

**Example:**

Expand Down
12 changes: 9 additions & 3 deletions docs/mcp/mcp-server-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- verification:
source_repo: ant-sdk
source_ref: main
source_commit: e102df9b3ea1a17fba7cf731081f515d89552b82
verified_date: 2026-06-10
source_commit: e56292325d04f1cf398c7e6bc77619ff2ab44447
verified_date: 2026-06-19
verification_mode: current-merged-truth
-->

Expand Down Expand Up @@ -102,7 +102,13 @@ Uploads a local file to the network. When `private=True`, the returned `address`

**Tool:** `download_file(address, dest_path, private=False)`

Downloads a file to a local path. Pass the on-network address when `private=False` (default) or the caller-held DataMap when `private=True`.
Downloads a file to a local path. Pass the on-network address when `private=False` (default) or the caller-held DataMap when `private=True`. The daemon writes the file, so the daemon and the MCP server must share a filesystem.

### Stream a File Download

**Tool:** `stream_download_file(address, dest_path, private=False)`

Downloads a file to `dest_path` like `download_file`, but streams the bytes back to the MCP server process and writes them on the MCP server's host one chunk at a time with constant memory. Use it for large objects, or when the daemon and MCP server do not share a filesystem. Pass the on-network address when `private=False` (default) or the caller-held DataMap when `private=True`. The response includes `bytes_written`.

### Estimate Cost

Expand Down
5 changes: 2 additions & 3 deletions docs/rust/embed-a-node-in-your-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- verification:
source_repo: ant-node
source_ref: main
source_commit: fb7494e84dd02f664fce83cebd210a4c73ddcfe2
verified_date: 2026-06-10
source_commit: c53665bf4dda87cdbcf848606fa0182e822297d7
verified_date: 2026-06-19
verification_mode: current-merged-truth
-->

Expand Down Expand Up @@ -76,7 +76,6 @@ tokio::spawn(async move {
- `upgrade`
- `payment.rewards_address`
- `payment.evm_network`
- `bootstrap_cache`
- `storage`
- `close_group_cache_dir`
- `max_message_size`
Expand Down
18 changes: 12 additions & 6 deletions docs/sdk/how-to-guides/use-external-signers-for-upload-payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<!-- verification:
source_repo: ant-sdk
source_ref: main
source_commit: e102df9b3ea1a17fba7cf731081f515d89552b82
verified_date: 2026-06-10
source_commit: e56292325d04f1cf398c7e6bc77619ff2ab44447
verified_date: 2026-06-19
verification_mode: current-merged-truth
-->
<!-- verification:
source_repo: ant-client
source_ref: main
source_commit: 84332e2d752499df5402da797e5d8bba547bc58b
verified_date: 2026-06-10
source_commit: 4d0448458ec302af68a5504c533d105b0991c93c
verified_date: 2026-06-19
verification_mode: current-merged-truth
-->
<!-- verification:
Expand Down Expand Up @@ -129,7 +129,9 @@ Wave-batch prepare response:
"total_amount": "<atto_token_amount>",
"payment_vault_address": "0x...",
"payment_token_address": "0x...",
"rpc_url": "https://your-rpc-endpoint"
"rpc_url": "https://your-rpc-endpoint",
"total_chunks": 12,
"already_stored_count": 4
}
```

Expand All @@ -155,12 +157,16 @@ Merkle prepare response:
"payment_vault_address": "0x...",
"total_amount": "0",
"payment_token_address": "0x...",
"rpc_url": "https://your-rpc-endpoint"
"rpc_url": "https://your-rpc-endpoint",
"total_chunks": 128,
"already_stored_count": 0
}
```

Each `pool_commitments` entry contains exactly 16 candidate payments. The sample above shows one candidate for brevity.

Both prepare shapes also return `total_chunks` and `already_stored_count`. `total_chunks` is the full chunk count for the upload, including chunks already on-network; `already_stored_count` is how many were already stored and so excluded from payment and the PUT. Pay for `total_chunks - already_stored_count` chunks, and reconcile against the full file size when a prepare comes back cheaper than expected.

For file uploads, the equivalent is `POST /v1/upload/prepare` with a local `path` field instead of `data`. To make the upload publicly retrievable by address, add `"visibility":"public"` to the prepare request. `antd` bundles the serialized DataMap chunk into the same payment batch, and the finalize response includes a `data_map_address` field with its Autonomi Network address.

### 3. Submit the payment externally
Expand Down
42 changes: 37 additions & 5 deletions docs/sdk/reference/grpc-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- verification:
source_repo: ant-sdk
source_ref: main
source_commit: e102df9b3ea1a17fba7cf731081f515d89552b82
verified_date: 2026-06-10
source_commit: e56292325d04f1cf398c7e6bc77619ff2ab44447
verified_date: 2026-06-19
verification_mode: current-merged-truth
-->

Expand Down Expand Up @@ -59,11 +59,41 @@ Fetches private data using a caller-held `data_map` string.

Fetches public data by address.

### Stream

**Signature:** `Stream(StreamDataRequest) -> stream DataChunk`

Streams private data from a caller-held `data_map` with constant memory, decrypting one batch at a time. This is the streaming counterpart of `Get` and the primitive that `StreamPublic` wraps.

**Request fields:**

| Name | Type | Description |
|------|------|-------------|
| `data_map` | string | Hex-encoded serialized DataMap |
| `include_progress` | bool | When `true`, the server interleaves `DownloadProgress` frames with the data frames on the same stream. Defaults to `false`, in which case the stream carries only data frames |

### Stream Public

**Signature:** `StreamPublic(StreamPublicDataRequest) -> stream DataChunk`

This RPC is exposed, but the handler returns `UNIMPLEMENTED`.
Resolves a public address to its DataMap and then streams the data, the public wrapper around `Stream`.

**Request fields:**

| Name | Type | Description |
|------|------|-------------|
| `address` | string | Hex data address |
| `include_progress` | bool | Same meaning as on `Stream`. Defaults to `false` |

Each `DataChunk` frame carries exactly one of two payloads through its `kind` oneof: `data` (a decrypted plaintext batch) or `progress` (a `DownloadProgress` update). A consumer that leaves `include_progress` at `false` receives only `data` frames.

`DownloadProgress` reports fetch progress in chunk counts:

| Name | Type | Description |
|------|------|-------------|
| `phase` | string | One of `resolving_map`, `resolved`, or `fetching` |
| `fetched` | uint64 | Chunks fetched so far in the current phase |
| `total` | uint64 | Total chunks for the current phase, or `0` while not yet known |

### Cost

Expand Down Expand Up @@ -310,8 +340,10 @@ The proto files define these reusable shapes:
|------|--------|
| `Cost` | `atto_tokens`, `file_size`, `chunk_count`, `estimated_gas_cost_wei`, `payment_mode` |
| `HealthCheckResponse` | `status`, `network`, `version`, `evm_network`, `uptime_seconds`, `build_commit`, `payment_token_address`, `payment_vault_address` |
| `PutPublicDataResponse` | `cost`, `address` |
| `PutDataResponse` | `cost`, `data_map` |
| `PutPublicDataResponse` | `cost`, `address`, `chunks_stored`, `payment_mode_used` |
| `PutDataResponse` | `cost`, `data_map`, `chunks_stored`, `payment_mode_used` |
| `DataChunk` | `kind` oneof of `data` (bytes) or `progress` (`DownloadProgress`) |
| `DownloadProgress` | `phase`, `fetched`, `total` |
| `PutFileRequest` | `path`, `payment_mode` |
| `PutFilePublicResponse` | `address`, `storage_cost_atto`, `gas_cost_wei`, `chunks_stored`, `payment_mode_used` |
| `PutFileResponse` | `data_map`, `storage_cost_atto`, `gas_cost_wei`, `chunks_stored`, `payment_mode_used` |
Expand Down
30 changes: 23 additions & 7 deletions docs/sdk/reference/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- verification:
source_repo: ant-sdk
source_ref: main
source_commit: e102df9b3ea1a17fba7cf731081f515d89552b82
verified_date: 2026-06-10
source_commit: e56292325d04f1cf398c7e6bc77619ff2ab44447
verified_date: 2026-06-19
verification_mode: current-merged-truth
-->

Expand Down Expand Up @@ -108,7 +108,12 @@ curl http://localhost:8082/v1/data/public/<addr>

**Endpoint:** `GET /v1/data/public/{addr}/stream`

This endpoint is exposed, but the handler is a stub and returns an empty SSE stream.
Streams a public object by address with constant memory, decrypting one batch at a time instead of buffering the whole object into a JSON body. Use this for large objects.

The response framing depends on the `Accept` header:

- Default (any `Accept` other than `application/x-ndjson`): a raw `application/octet-stream` body of the decrypted plaintext. The `Content-Length` header is set from the object's original size, so a client detects a failed download as a short read.
- `Accept: application/x-ndjson`: newline-delimited JSON (NDJSON) frames, one JSON object per line, so the caller can drive a determinate progress bar. A leading `{"type":"meta","total_size":<bytes>}` frame is followed by interleaved `{"type":"progress",...}` and `{"type":"data","chunk":"<base64>"}` frames, and a terminal `{"type":"error","message":"..."}` frame if the download fails partway. Each `progress` frame carries `phase` (`"resolving_map"`, `"resolved"`, or `"fetching"`), `fetched` (chunks fetched so far), and `total` (chunks for the phase, or `0` while still unknown).

**Parameters:**

Expand All @@ -119,7 +124,12 @@ This endpoint is exposed, but the handler is a stub and returns an empty SSE str
**Example:**

```bash
curl -N http://localhost:8082/v1/data/public/<addr>/stream
# Raw bytes
curl http://localhost:8082/v1/data/public/<addr>/stream -o object.bin

# Progress framing
curl -H "Accept: application/x-ndjson" \
http://localhost:8082/v1/data/public/<addr>/stream
```

### Store Private Data
Expand Down Expand Up @@ -291,7 +301,7 @@ Prepares one raw chunk for the external-signer flow. The daemon computes the chu

**Response:**

When the chunk already exists on the network:
When the chunk already exists on-network:

```json
{
Expand Down Expand Up @@ -613,7 +623,9 @@ The daemon returns `wave_batch` for uploads under 64 chunks and `merkle` for upl
"total_amount": "<atto_token_amount>",
"payment_vault_address": "0x...",
"payment_token_address": "0x...",
"rpc_url": "http://127.0.0.1:8545"
"rpc_url": "http://127.0.0.1:8545",
"total_chunks": 12,
"already_stored_count": 4
}
```

Expand All @@ -639,12 +651,16 @@ Merkle variant:
"payment_vault_address": "0x...",
"total_amount": "0",
"payment_token_address": "0x...",
"rpc_url": "http://127.0.0.1:8545"
"rpc_url": "http://127.0.0.1:8545",
"total_chunks": 128,
"already_stored_count": 0
}
```

Each `pool_commitments` entry contains exactly 16 candidate payments. The example above shows one candidate for brevity.

Both variants include `total_chunks` and `already_stored_count`. `total_chunks` is the full chunk count for the upload, including chunks already on-network; `already_stored_count` is how many of those were already stored and so excluded from payment and from the PUT. The external signer pays for `total_chunks - already_stored_count` chunks, which is why a prepared upload can cost less than the raw file size implies.

**Example:**

```bash
Expand Down
Loading